Bug 602787 part.7 Don't implement methods which use Widget*Event in qt/nsWindow.h r=romaxa
☠☠ backed out by 3c5efc154d58 ☠ ☠
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 22 Oct 2013 22:27:35 +0900
changeset 166459 3b9f1062d915eac40ae1d14dd56d7f262e60ab65
parent 166458 3ee56eacc84b198ee48ef65125c776d79542d452
child 166460 57ca2861ea307d39f596cd3e06d4f168c028119f
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersromaxa
bugs602787
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 602787 part.7 Don't implement methods which use Widget*Event in qt/nsWindow.h r=romaxa
widget/qt/nsWindow.cpp
widget/qt/nsWindow.h
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -2803,16 +2803,24 @@ nsWindow::GetDPI()
     if (heightInches < 0.25) {
         // Something's broken, but we'd better not crash.
         return 96.0f;
     }
 
     return float(rootWindow->height()/heightInches);
 }
 
+nsEventStatus
+nsWindow::DispatchEvent(WidgetGUIEvent* aEvent)
+{
+    nsEventStatus status;
+    DispatchEvent(aEvent, status);
+    return status;
+}
+
 void
 nsWindow::DispatchActivateEvent(void)
 {
     if (mWidgetListener)
       mWidgetListener->WindowActivated();
 }
 
 void
@@ -3165,8 +3173,42 @@ nsWindow::GetGLFrameBufferFormat()
 {
     if (mLayerManager &&
         mLayerManager->GetBackendType() == mozilla::layers::LAYERS_OPENGL) {
         return MozQGLWidgetWrapper::isRGBAContext() ? LOCAL_GL_RGBA : LOCAL_GL_RGB;
     }
     return LOCAL_GL_NONE;
 }
 
+void
+nsWindow::ProcessMotionEvent()
+{
+    if (mPinchEvent.needDispatch) {
+        double distance = DistanceBetweenPoints(mPinchEvent.centerPoint,
+                                                mPinchEvent.touchPoint);
+        distance *= 2;
+        mPinchEvent.delta = distance - mPinchEvent.prevDistance;
+        nsIntPoint centerPoint(mPinchEvent.centerPoint.x(),
+                               mPinchEvent.centerPoint.y());
+        DispatchGestureEvent(NS_SIMPLE_GESTURE_MAGNIFY_UPDATE,
+                             0, mPinchEvent.delta, centerPoint);
+        mPinchEvent.prevDistance = distance;
+    }
+    if (mMoveEvent.needDispatch) {
+        WidgetMouseEvent event(true, NS_MOUSE_MOVE, this,
+                               WidgetMouseEvent::eReal);
+
+        event.refPoint.x = nscoord(mMoveEvent.pos.x());
+        event.refPoint.y = nscoord(mMoveEvent.pos.y());
+
+        event.InitBasicModifiers(mMoveEvent.modifiers & Qt::ControlModifier,
+                                 mMoveEvent.modifiers & Qt::AltModifier,
+                                 mMoveEvent.modifiers & Qt::ShiftModifier,
+                                 mMoveEvent.modifiers & Qt::MetaModifier);
+        event.clickCount      = 0;
+
+        DispatchEvent(&event);
+        mMoveEvent.needDispatch = false;
+    }
+
+    mTimerStarted = false;
+}
+
--- a/widget/qt/nsWindow.h
+++ b/widget/qt/nsWindow.h
@@ -11,17 +11,17 @@
 #include <QKeyEvent>
 #include <QGestureEvent>
 #include <qgraphicswidget.h>
 #include <QTime>
 
 #include "nsAutoPtr.h"
 
 #include "nsBaseWidget.h"
-#include "mozilla/MouseEvents.h"
+#include "mozilla/EventForwards.h"
 
 #include "nsWeakReference.h"
 
 #include "nsGkAtoms.h"
 #include "nsIIdleServiceInternal.h"
 #include "nsIRunnable.h"
 #include "nsThreadUtils.h"
 
@@ -178,22 +178,17 @@ public:
     // event handling code
 
     void DispatchActivateEvent(void);
     void DispatchDeactivateEvent(void);
     void DispatchActivateEventOnTopLevelWindow(void);
     void DispatchDeactivateEventOnTopLevelWindow(void);
     void DispatchResizeEvent(nsIntRect &aRect, nsEventStatus &aStatus);
 
-    nsEventStatus DispatchEvent(mozilla::WidgetGUIEvent* aEvent)
-    {
-        nsEventStatus status;
-        DispatchEvent(aEvent, status);
-        return status;
-    }
+    nsEventStatus DispatchEvent(mozilla::WidgetGUIEvent* aEvent);
 
     // Some of the nsIWidget methods
     virtual bool IsEnabled() const;
 
     // called when we are destroyed
     void OnDestroy(void);
 
     // called to check and see if a widget's dimensions are sane
@@ -373,45 +368,17 @@ private:
         *flag &= ~mask;
     }
     int32_t mQCursor;
 
     // Call this function when the users activity is the direct cause of an
     // event (like a keypress or mouse click).
     void UserActivity();
 
-    inline void ProcessMotionEvent() {
-        if (mPinchEvent.needDispatch) {
-            double distance = DistanceBetweenPoints(mPinchEvent.centerPoint, mPinchEvent.touchPoint);
-            distance *= 2;
-            mPinchEvent.delta = distance - mPinchEvent.prevDistance;
-            nsIntPoint centerPoint(mPinchEvent.centerPoint.x(), mPinchEvent.centerPoint.y());
-            DispatchGestureEvent(NS_SIMPLE_GESTURE_MAGNIFY_UPDATE,
-                                 0, mPinchEvent.delta, centerPoint);
-            mPinchEvent.prevDistance = distance;
-        }
-        if (mMoveEvent.needDispatch) {
-            WidgetMouseEvent event(true, NS_MOUSE_MOVE, this,
-                                   WidgetMouseEvent::eReal);
-
-            event.refPoint.x = nscoord(mMoveEvent.pos.x());
-            event.refPoint.y = nscoord(mMoveEvent.pos.y());
-
-            event.InitBasicModifiers(mMoveEvent.modifiers & Qt::ControlModifier,
-                                     mMoveEvent.modifiers & Qt::AltModifier,
-                                     mMoveEvent.modifiers & Qt::ShiftModifier,
-                                     mMoveEvent.modifiers & Qt::MetaModifier);
-            event.clickCount      = 0;
-
-            DispatchEvent(&event);
-            mMoveEvent.needDispatch = false;
-        }
-
-        mTimerStarted = false;
-    }
+    inline void ProcessMotionEvent();
 
     void DispatchMotionToMainThread() {
         if (!mTimerStarted) {
             nsCOMPtr<nsIRunnable> event =
                 NS_NewRunnableMethod(this, &nsWindow::ProcessMotionEvent);
             NS_DispatchToMainThread(event);
             mTimerStarted = true;
         }