Fixed wrong coordinates sent for button press events.
authorSamuel Rødal <samuel.rodal@nokia.com>
Wed, 16 Mar 2011 11:29:12 +0000 (12:29 +0100)
committerSamuel Rødal <samuel.rodal@nokia.com>
Wed, 16 Mar 2011 11:29:12 +0000 (12:29 +0100)
src/qt-compositor/private/wlsurface.cpp

index ebdb8df..ae226b2 100644 (file)
@@ -244,21 +244,23 @@ uint32_t toWaylandButton(Qt::MouseButton button)
 void Surface::sendMousePressEvent(int x, int y, Qt::MouseButton button)
 {
     Q_D(Surface);
+    sendMouseMoveEvent(x, y);
     if (d->client) {
         uint32_t time = d->compositor->currentTimeMsecs();
         wl_client_post_event(d->client, &d->compositor->defaultInputDevice()->object,
                              WL_INPUT_DEVICE_BUTTON, time, toWaylandButton(button), 1);
     }
-    sendMouseMoveEvent(x, y);
 }
 
 void Surface::sendMouseReleaseEvent(int x, int y, Qt::MouseButton button)
 {
     Q_D(Surface);
-    if (d->client)
-        wl_client_post_event(d->client, &d->compositor->defaultInputDevice()->object,
-                             WL_INPUT_DEVICE_BUTTON, d->compositor->currentTimeMsecs(), toWaylandButton(button), 0);
     sendMouseMoveEvent(x, y);
+    if (d->client) {
+        uint32_t time = d->compositor->currentTimeMsecs();
+        wl_client_post_event(d->client, &d->compositor->defaultInputDevice()->object,
+                             WL_INPUT_DEVICE_BUTTON, time, toWaylandButton(button), 0);
+    }
 }
 
 void Surface::sendMouseMoveEvent(int x, int y)