Title: [88702] trunk/Source/WebKit2
Revision
88702
Author
[email protected]
Date
2011-06-13 14:58:20 -0700 (Mon, 13 Jun 2011)

Log Message

2011-06-13  Sangyong Park  <[email protected]>

        Reviewed by Eric Seidel.

        implement to handle wheel event of plugin on x11
        https://bugs.webkit.org/show_bug.cgi?id=62522

        Implement platformHandleWheelEvent() in NetscapePluginX11.cpp
        for to handle wheel event on plugins

        * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
        (WebKit::setCommonMouseEventFields): add template argument to support WebWheelEvent
        (WebKit::setXButtonEventFieldsByWebWheelEvent): initialize XButtonEvent by WebWheelEvent
        (WebKit::NetscapePlugin::platformHandleWheelEvent): handle wheel event on plugin

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (88701 => 88702)


--- trunk/Source/WebKit2/ChangeLog	2011-06-13 21:51:43 UTC (rev 88701)
+++ trunk/Source/WebKit2/ChangeLog	2011-06-13 21:58:20 UTC (rev 88702)
@@ -1,3 +1,18 @@
+2011-06-13  Sangyong Park  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        implement to handle wheel event of plugin on x11
+        https://bugs.webkit.org/show_bug.cgi?id=62522
+
+        Implement platformHandleWheelEvent() in NetscapePluginX11.cpp
+        for to handle wheel event on plugins
+
+        * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
+        (WebKit::setCommonMouseEventFields): add template argument to support WebWheelEvent
+        (WebKit::setXButtonEventFieldsByWebWheelEvent): initialize XButtonEvent by WebWheelEvent
+        (WebKit::NetscapePlugin::platformHandleWheelEvent): handle wheel event on plugin
+
 2011-06-13  Eunmi Lee  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp (88701 => 88702)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2011-06-13 21:51:43 UTC (rev 88701)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2011-06-13 21:58:20 UTC (rev 88702)
@@ -326,8 +326,8 @@
     return xModifiers;
 }
 
-template <typename XEventType>
-static inline void setCommonMouseEventFields(XEventType& xEvent, const WebMouseEvent& webEvent, const WebCore::IntPoint& pluginLocation)
+template <typename XEventType, typename WebEventType>
+static inline void setCommonMouseEventFields(XEventType& xEvent, const WebEventType& webEvent, const WebCore::IntPoint& pluginLocation)
 {
     xEvent.root = rootWindowID();
     xEvent.subwindow = 0;
@@ -366,6 +366,26 @@
     }
 }
 
+static inline void setXButtonEventFieldsByWebWheelEvent(XEvent& xEvent, const WebWheelEvent& webEvent, const WebCore::IntPoint& pluginLocation)
+{
+    XButtonEvent& xButton = xEvent.xbutton;
+    setCommonMouseEventFields(xButton, webEvent, pluginLocation);
+
+    xButton.type = ButtonPress;
+    FloatSize ticks = webEvent.wheelTicks();
+    if (ticks.height()) {
+        if (ticks.height() > 0)
+            xButton.button = 4; // up
+        else
+            xButton.button = 5; // down
+    } else {
+        if (ticks.width() > 0)
+            xButton.button = 6; // left
+        else
+            xButton.button = 7; // right
+    }
+}
+
 static inline void setXCrossingEventFields(XEvent& xEvent, const WebMouseEvent& webEvent, const WebCore::IntPoint& pluginLocation, int type)
 {
     XCrossingEvent& xCrossing = xEvent.xcrossing;
@@ -405,10 +425,16 @@
 const int kFocusInType = 9;
 const int kFocusOutType = 10;
 
-bool NetscapePlugin::platformHandleWheelEvent(const WebWheelEvent&)
+bool NetscapePlugin::platformHandleWheelEvent(const WebWheelEvent& event)
 {
-    notImplemented();
-    return false;
+    if (m_isWindowed)
+        return false;
+
+    XEvent xEvent;
+    initializeXEvent(xEvent);
+    setXButtonEventFieldsByWebWheelEvent(xEvent, event, m_frameRect.location());
+
+    return NPP_HandleEvent(&xEvent);
 }
 
 void NetscapePlugin::platformSetFocus(bool)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to