Browse Source

Support double click events in UIWebView, invert scroll on Windows too

Josh Engebretson 10 years ago
parent
commit
5a0f14df01

+ 1 - 1
Source/AtomicWebView/UIWebView.cpp

@@ -203,7 +203,7 @@ bool UIWebView::OnEvent(const TBWidgetEvent &ev)
 {
 {
     if (ev.type == EVENT_TYPE_POINTER_DOWN || ev.type == EVENT_TYPE_POINTER_UP)
     if (ev.type == EVENT_TYPE_POINTER_DOWN || ev.type == EVENT_TYPE_POINTER_UP)
     {
     {
-        webClient_->SendMouseClickEvent(ev.target_x, ev.target_y, 0, ev.type == EVENT_TYPE_POINTER_UP, 0);
+        webClient_->SendMouseClickEvent(ev.target_x, ev.target_y, 0, ev.type == EVENT_TYPE_POINTER_UP, 0, ev.count);
         return true;
         return true;
     }
     }
     else if (ev.type == EVENT_TYPE_POINTER_MOVE)
     else if (ev.type == EVENT_TYPE_POINTER_MOVE)

+ 10 - 8
Source/AtomicWebView/WebClient.cpp

@@ -375,7 +375,7 @@ WebClient::~WebClient()
     //d_->Release();
     //d_->Release();
 }
 }
 
 
-void WebClient::SendMouseClickEvent(int x, int y, unsigned button, bool mouseUp, unsigned modifier) const
+void WebClient::SendMouseClickEvent(int x, int y, unsigned button, bool mouseUp, unsigned modifier, int clickCount) const
 {
 {
     if (!d_->browser_.get())
     if (!d_->browser_.get())
         return;
         return;
@@ -391,14 +391,14 @@ void WebClient::SendMouseClickEvent(int x, int y, unsigned button, bool mouseUp,
     //MBT_MIDDLE,
     //MBT_MIDDLE,
     //MBT_RIGHT,
     //MBT_RIGHT,
 
 
-    host->SendMouseClickEvent(mevent, (CefBrowserHost::MouseButtonType) button, mouseUp, 1);
+    host->SendMouseClickEvent(mevent, (CefBrowserHost::MouseButtonType) button, mouseUp, clickCount);
 
 
 }
 }
 
 
-void WebClient::SendMousePressEvent(int x, int y, unsigned button, unsigned modifier) const
+void WebClient::SendMousePressEvent(int x, int y, unsigned button, unsigned modifier, int clickCount) const
 {
 {
-    SendMouseClickEvent(x, y, button, false, modifier);
-    SendMouseClickEvent(x, y, button, true, modifier);
+    SendMouseClickEvent(x, y, button, false, modifier, clickCount);
+    SendMouseClickEvent(x, y, button, true, modifier, clickCount);
 }
 }
 
 
 void WebClient::SendMouseMoveEvent(int x, int y, unsigned modifier, bool mouseLeave) const
 void WebClient::SendMouseMoveEvent(int x, int y, unsigned modifier, bool mouseLeave) const
@@ -438,11 +438,13 @@ void WebClient::SendMouseWheelEvent(int x, int y, unsigned modifier,int deltaX,
     mevent.y = y;
     mevent.y = y;
     mevent.modifiers = 0;
     mevent.modifiers = 0;
 
 
-#ifdef ATOMIC_PLATFORM_OSX
-    deltaY = -deltaY;
+    deltaY = -deltaY * 5;
+
+#ifndef ATOMIC_PLATFORM_OSX
+    deltaY *= 5;
 #endif
 #endif
 
 
-    host->SendMouseWheelEvent(mevent, deltaX, deltaY * 5);
+    host->SendMouseWheelEvent(mevent, deltaX, deltaY);
 
 
 }
 }
 
 

+ 2 - 2
Source/AtomicWebView/WebClient.h

@@ -35,9 +35,9 @@ public:
     void SetSize(int width, int height);
     void SetSize(int width, int height);
 
 
     /// Send a mouse click event to the browser
     /// Send a mouse click event to the browser
-    void SendMouseClickEvent(int x, int y, unsigned button, bool mouseUp, unsigned modifier) const;
+    void SendMouseClickEvent(int x, int y, unsigned button, bool mouseUp, unsigned modifier, int clickCount = 1) const;
     /// Send a mouse press event to the browser
     /// Send a mouse press event to the browser
-    void SendMousePressEvent(int x, int y, unsigned button = 0, unsigned modifier = 0) const;
+    void SendMousePressEvent(int x, int y, unsigned button = 0, unsigned modifier = 0, int clickCount = 1) const;
     /// Send a mouse move event to the browser
     /// Send a mouse move event to the browser
     void SendMouseMoveEvent(int x, int y, unsigned modifier, bool mouseLeave = false) const;
     void SendMouseMoveEvent(int x, int y, unsigned modifier, bool mouseLeave = false) const;
     /// Send a mouse wheel event to the browser
     /// Send a mouse wheel event to the browser