Start using the new wl_fixed_t type properly
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Wed, 9 May 2012 08:25:44 +0000 (11:25 +0300)
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>
Wed, 9 May 2012 12:17:07 +0000 (14:17 +0200)
The mouse and touch coordinates cannot just be treated as integers
anymore, they need to be converted from/to double using the helper
functions. Some necessary QPoint -> QPointF changes have also been
made.

For the Qt-specific touch extension we will not switch to wl_fixed_t
though. This is because the precision is unfortunately quite small
(factor of 256 vs. 10000).

Change-Id: I23deaaffe478a39495b12d336985bc62e38a6af4
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
13 files changed:
examples/qwindow-compositor/qwindowcompositor.cpp
examples/qwindow-compositor/qwindowcompositor.h
src/compositor/compositor_api/waylandinput.cpp
src/compositor/compositor_api/waylandinput.h
src/compositor/wayland_wrapper/wlinputdevice.cpp
src/compositor/wayland_wrapper/wlinputdevice.h
src/compositor/wayland_wrapper/wlshellsurface.cpp
src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp
src/plugins/platforms/wayland/qwaylanddatadevicemanager.h
src/plugins/platforms/wayland/qwaylandinputdevice.cpp
src/plugins/platforms/wayland/qwaylandinputdevice.h
tests/auto/client/mockinput.cpp
wayland_sha1.txt

index 6e571ce..b9661f0 100644 (file)
@@ -157,14 +157,14 @@ void QWindowCompositor::changeCursor(const QImage &image, int hotspotX, int hots
     }
 }
 
-WaylandSurface *QWindowCompositor::surfaceAt(const QPoint &point, QPoint *local)
+WaylandSurface *QWindowCompositor::surfaceAt(const QPointF &point, QPointF *local)
 {
     for (int i = m_surfaces.size() - 1; i >= 0; --i) {
         WaylandSurface *surface = m_surfaces.at(i);
-        QRect geo(surface->pos().toPoint(),surface->size());
+        QRectF geo(surface->pos(), surface->size());
         if (geo.contains(point)) {
             if (local)
-                *local = toSurface(surface, point).toPoint();
+                *local = toSurface(surface, point);
             return surface;
         }
     }
@@ -259,9 +259,9 @@ bool QWindowCompositor::eventFilter(QObject *obj, QEvent *event)
         m_renderScheduler.start(0);
         break;
     case QEvent::MouseButtonPress: {
-        QPoint local;
+        QPointF local;
         QMouseEvent *me = static_cast<QMouseEvent *>(event);
-        WaylandSurface *targetSurface = surfaceAt(me->pos(), &local);
+        WaylandSurface *targetSurface = surfaceAt(me->localPos(), &local);
         if (m_dragKeyIsPressed && targetSurface) {
             m_draggingWindow = targetSurface;
             m_drag_diff = local;
@@ -272,7 +272,7 @@ bool QWindowCompositor::eventFilter(QObject *obj, QEvent *event)
                 m_surfaces.append(targetSurface);
                 m_renderScheduler.start(0);
             }
-            input->sendMousePressEvent(me->button(),local,me->pos());
+            input->sendMousePressEvent(me->button(), local, me->localPos());
         }
         return true;
     }
@@ -280,25 +280,25 @@ bool QWindowCompositor::eventFilter(QObject *obj, QEvent *event)
         WaylandSurface *targetSurface = input->mouseFocus();
         if (m_draggingWindow) {
             m_draggingWindow = 0;
-            m_drag_diff = QPoint();
+            m_drag_diff = QPointF();
         } else {
             QMouseEvent *me = static_cast<QMouseEvent *>(event);
             QPointF localPos;
             if (targetSurface)
-                localPos = toSurface(targetSurface, me->pos());
-            input->sendMouseReleaseEvent(me->button(),localPos.toPoint(),me->pos());
+                localPos = toSurface(targetSurface, me->localPos());
+            input->sendMouseReleaseEvent(me->button(), localPos, me->localPos());
         }
         return true;
     }
     case QEvent::MouseMove: {
         QMouseEvent *me = static_cast<QMouseEvent *>(event);
         if (m_draggingWindow) {
-            m_draggingWindow->setPos(me->posF() - m_drag_diff);
+            m_draggingWindow->setPos(me->localPos() - m_drag_diff);
             m_renderScheduler.start(0);
         } else {
-            QPoint local;
-            WaylandSurface *targetSurface = surfaceAt(me->pos(), &local);
-            input->sendMouseMoveEvent(targetSurface, local,me->pos());
+            QPointF local;
+            WaylandSurface *targetSurface = surfaceAt(me->localPos(), &local);
+            input->sendMouseMoveEvent(targetSurface, local, me->localPos());
         }
         break;
     }
index 561b76e..78bab69 100644 (file)
@@ -67,7 +67,7 @@ protected:
     void surfaceDamaged(WaylandSurface *surface, const QRect &rect);
     void surfaceCreated(WaylandSurface *surface);
 
-    WaylandSurface* surfaceAt(const QPoint &point, QPoint *local = 0);
+    WaylandSurface* surfaceAt(const QPointF &point, QPointF *local = 0);
 
     GLuint composeSurface(WaylandSurface *surface);
     void paintChildren(WaylandSurface *surface, WaylandSurface *window);
@@ -94,7 +94,7 @@ private:
     //Dragging windows around
     WaylandSurface *m_draggingWindow;
     bool m_dragKeyIsPressed;
-    QPoint m_drag_diff;
+    QPointF m_drag_diff;
 
 };
 
index 52e4a7a..97a1315 100644 (file)
@@ -55,17 +55,17 @@ WaylandInputDevice::~WaylandInputDevice()
     delete d;
 }
 
-void WaylandInputDevice::sendMousePressEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos)
+void WaylandInputDevice::sendMousePressEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos)
 {
     d->sendMousePressEvent(button,localPos,globalPos);
 }
 
-void WaylandInputDevice::sendMouseReleaseEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos)
+void WaylandInputDevice::sendMouseReleaseEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos)
 {
     d->sendMouseReleaseEvent(button,localPos,globalPos);
 }
 
-void WaylandInputDevice::sendMouseMoveEvent(const QPoint &localPos, const QPoint &globalPos)
+void WaylandInputDevice::sendMouseMoveEvent(const QPointF &localPos, const QPointF &globalPos)
 {
     d->sendMouseMoveEvent(localPos,globalPos);
 }
@@ -73,7 +73,7 @@ void WaylandInputDevice::sendMouseMoveEvent(const QPoint &localPos, const QPoint
 /** Convenience function that will set the mouse focus to the surface, then send the mouse move event.
  *  If the mouse focus is the same surface as the surface passed in, then only the move event is sent
  **/
-void WaylandInputDevice::sendMouseMoveEvent(WaylandSurface *surface, const QPoint &localPos, const QPoint &globalPos)
+void WaylandInputDevice::sendMouseMoveEvent(WaylandSurface *surface, const QPointF &localPos, const QPointF &globalPos)
 {
     Wayland::Surface *wlsurface = surface? surface->handle():0;
     d->sendMouseMoveEvent(wlsurface,localPos,globalPos);
@@ -89,7 +89,7 @@ void WaylandInputDevice::sendKeyReleaseEvent(uint code)
     d->sendKeyReleaseEvent(code);
 }
 
-void WaylandInputDevice::sendTouchPointEvent(int id, int x, int y, Qt::TouchPointState state)
+void WaylandInputDevice::sendTouchPointEvent(int id, double x, double y, Qt::TouchPointState state)
 {
     d->sendTouchPointEvent(id,x,y,state);
 }
@@ -136,7 +136,7 @@ WaylandSurface *WaylandInputDevice::mouseFocus() const
     return 0;
 }
 
-void WaylandInputDevice::setMouseFocus(WaylandSurface *surface, const QPoint &localPos, const QPoint &globalPos)
+void WaylandInputDevice::setMouseFocus(WaylandSurface *surface, const QPointF &localPos, const QPointF &globalPos)
 {
     Wayland::Surface *wlsurface = surface?surface->handle():0;
     d->setMouseFocus(wlsurface,localPos,globalPos);
index 4c04837..826f135 100644 (file)
@@ -61,17 +61,17 @@ public:
     WaylandInputDevice(WaylandCompositor *compositor);
     ~WaylandInputDevice();
 
-    void sendMousePressEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos = QPoint());
-    void sendMouseReleaseEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos = QPoint());
-    void sendMouseMoveEvent(const QPoint &localPos, const QPoint &globalPos = QPoint());
-    void sendMouseMoveEvent(WaylandSurface *surface , const QPoint &localPos, const QPoint &globalPos = QPoint());
+    void sendMousePressEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos = QPointF());
+    void sendMouseReleaseEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos = QPointF());
+    void sendMouseMoveEvent(const QPointF &localPos, const QPointF &globalPos = QPointF());
+    void sendMouseMoveEvent(WaylandSurface *surface , const QPointF &localPos, const QPointF &globalPos = QPointF());
 
     void sendKeyPressEvent(uint code);
     void sendKeyReleaseEvent(uint code);
 
     void sendFullKeyEvent(QKeyEvent *event);
 
-    void sendTouchPointEvent(int id, int x, int y, Qt::TouchPointState state);
+    void sendTouchPointEvent(int id, double x, double y, Qt::TouchPointState state);
     void sendTouchFrameEvent();
     void sendTouchCancelEvent();
 
@@ -81,7 +81,7 @@ public:
     void setKeyboardFocus(WaylandSurface *surface);
 
     WaylandSurface *mouseFocus() const;
-    void setMouseFocus(WaylandSurface *surface, const QPoint &local_pos, const QPoint &global_pos = QPoint());
+    void setMouseFocus(WaylandSurface *surface, const QPointF &local_pos, const QPointF &global_pos = QPointF());
 
     WaylandCompositor *compositor() const;
     Wayland::InputDevice *handle() const;
index 5f3d862..9fc120b 100644 (file)
@@ -66,7 +66,7 @@ InputDevice::~InputDevice()
     qDeleteAll(m_data_devices);
 }
 
-void InputDevice::sendMousePressEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos)
+void InputDevice::sendMousePressEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos)
 {
     sendMouseMoveEvent(localPos,globalPos);
 
@@ -76,7 +76,7 @@ void InputDevice::sendMousePressEvent(Qt::MouseButton button, const QPoint &loca
     interface->button(base()->pointer_grab,time,toWaylandButton(button),1);
 }
 
-void InputDevice::sendMouseReleaseEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos)
+void InputDevice::sendMouseReleaseEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos)
 {
     sendMouseMoveEvent(localPos,globalPos);
 
@@ -86,19 +86,19 @@ void InputDevice::sendMouseReleaseEvent(Qt::MouseButton button, const QPoint &lo
     interface->button(base()->pointer_grab,time,toWaylandButton(button),0);
 }
 
-void InputDevice::sendMouseMoveEvent(const QPoint &localPos, const QPoint &globalPos)
+void InputDevice::sendMouseMoveEvent(const QPointF &localPos, const QPointF &globalPos)
 {
     Q_UNUSED(globalPos);
     uint32_t time = m_compositor->currentTimeMsecs();
     const struct wl_pointer_grab_interface *interface = base()->pointer_grab->interface;
-    base()->x = globalPos.x();
-    base()->y = globalPos.y();
+    base()->x = wl_fixed_from_double(globalPos.x());
+    base()->y = wl_fixed_from_double(globalPos.y());
     interface->motion(base()->pointer_grab,
                       time,
-                      localPos.x(), localPos.y());
+                      wl_fixed_from_double(localPos.x()), wl_fixed_from_double(localPos.y()));
 }
 
-void InputDevice::sendMouseMoveEvent(Surface *surface, const QPoint &localPos, const QPoint &globalPos)
+void InputDevice::sendMouseMoveEvent(Surface *surface, const QPointF &localPos, const QPointF &globalPos)
 {
     setMouseFocus(surface,localPos,globalPos);
     sendMouseMoveEvent(localPos,globalPos);
@@ -124,7 +124,7 @@ void InputDevice::sendKeyReleaseEvent(uint code)
     }
 }
 
-void InputDevice::sendTouchPointEvent(int id, int x, int y, Qt::TouchPointState state)
+void InputDevice::sendTouchPointEvent(int id, double x, double y, Qt::TouchPointState state)
 {
     uint32_t time = m_compositor->currentTimeMsecs();
     uint32_t serial = 0;
@@ -133,10 +133,12 @@ void InputDevice::sendTouchPointEvent(int id, int x, int y, Qt::TouchPointState
         return;
     switch (state) {
     case Qt::TouchPointPressed:
-        wl_input_device_send_touch_down(resource, serial, time, &base()->pointer_focus->resource, id, x, y);
+        wl_input_device_send_touch_down(resource, serial, time, &base()->pointer_focus->resource, id,
+                                        wl_fixed_from_double(x), wl_fixed_from_double(y));
         break;
     case Qt::TouchPointMoved:
-        wl_input_device_send_touch_motion(resource, time, id, x, y);
+        wl_input_device_send_touch_motion(resource, time, id,
+                                          wl_fixed_from_double(x), wl_fixed_from_double(y));
         break;
     case Qt::TouchPointReleased:
         wl_input_device_send_touch_up(resource, serial, time, id);
@@ -207,7 +209,7 @@ void InputDevice::sendFullTouchEvent(QTouchEvent *event)
     for (int i = 0; i < pointCount; ++i) {
         const QTouchEvent::TouchPoint &tp(points.at(i));
         // Convert the local pos in the compositor window to surface-relative.
-        QPoint p = (tp.pos() - pos).toPoint();
+        QPointF p = tp.pos() - pos;
         sendTouchPointEvent(tp.id(), p.x(), p.y(), tp.state());
     }
     sendTouchFrameEvent();
@@ -229,16 +231,16 @@ Surface *InputDevice::mouseFocus() const
     return wayland_cast<Surface>(base()->pointer_focus);
 }
 
-void InputDevice::setMouseFocus(Surface *surface, const QPoint &globalPos, const QPoint &localPos)
+void InputDevice::setMouseFocus(Surface *surface, const QPointF &globalPos, const QPointF &localPos)
 {
-    base()->x = globalPos.x();
-    base()->y = globalPos.y();
+    base()->x = wl_fixed_from_double(globalPos.x());
+    base()->y = wl_fixed_from_double(globalPos.y());
     base()->current = surface->base();
-    base()->current_x = localPos.x();
-    base()->current_y = localPos.y();
+    base()->current_x = wl_fixed_from_double(localPos.x());
+    base()->current_y = wl_fixed_from_double(localPos.y());
     base()->pointer_grab->interface->focus(base()->pointer_grab,
                         surface ? surface->base() : 0,
-                        localPos.x(), localPos.y());
+                        wl_fixed_from_double(localPos.x()), wl_fixed_from_double(localPos.y()));
 }
 
 void InputDevice::cleanupDataDeviceForClient(struct wl_client *client, bool destroyDev)
index b17ac41..a4c905a 100644 (file)
@@ -65,15 +65,15 @@ public:
     InputDevice(WaylandInputDevice *handle, Compositor *compositor);
     ~InputDevice();
 
-    void sendMousePressEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos = QPoint());
-    void sendMouseReleaseEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos = QPoint());
-    void sendMouseMoveEvent(const QPoint &localPos, const QPoint &globalPos = QPoint());
-    void sendMouseMoveEvent(Surface *surface, const QPoint &localPos, const QPoint &globalPos = QPoint());
+    void sendMousePressEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos = QPointF());
+    void sendMouseReleaseEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos = QPointF());
+    void sendMouseMoveEvent(const QPointF &localPos, const QPointF &globalPos = QPointF());
+    void sendMouseMoveEvent(Surface *surface, const QPointF &localPos, const QPointF &globalPos = QPointF());
 
     void sendKeyPressEvent(uint code);
     void sendKeyReleaseEvent(uint code);
 
-    void sendTouchPointEvent(int id, int x, int y, Qt::TouchPointState state);
+    void sendTouchPointEvent(int id, double x, double y, Qt::TouchPointState state);
     void sendTouchFrameEvent();
     void sendTouchCancelEvent();
 
@@ -84,7 +84,7 @@ public:
     void setKeyboardFocus(Surface *surface);
 
     Surface *mouseFocus() const;
-    void setMouseFocus(Surface *surface, const QPoint &localPos, const QPoint &globalPos);
+    void setMouseFocus(Surface *surface, const QPointF &localPos, const QPointF &globalPos);
 
     void clientRequestedDataDevice(DataDeviceManager *dndSelection, struct wl_client *client, uint32_t id);
     DataDevice *dataDevice(struct wl_client *client) const;
index 333934e..5dad93c 100644 (file)
@@ -104,8 +104,8 @@ void ShellSurface::adjustPosInResize()
     if (!m_resizeGrabber || !(m_resizeGrabber->resize_edges & WL_SHELL_SURFACE_RESIZE_TOP_LEFT))
         return;
 
-    int bottomLeftX = m_resizeGrabber->base()->x + m_resizeGrabber->width;
-    int bottomLeftY = m_resizeGrabber->base()->y + m_resizeGrabber->height;
+    int bottomLeftX = wl_fixed_to_int(m_resizeGrabber->base()->x) + m_resizeGrabber->width;
+    int bottomLeftY = wl_fixed_to_int(m_resizeGrabber->base()->y) + m_resizeGrabber->height;
     qreal x = surface()->pos().x();
     qreal y = surface()->pos().y();
     if (m_resizeGrabber->resize_edges & WL_SHELL_SURFACE_RESIZE_TOP)
@@ -163,8 +163,8 @@ void ShellSurface::move(struct wl_client *client,
     self->m_moveGrabber = new ShellSurfaceMoveGrabber(self);
     self->m_moveGrabber->base()->x = input_device->base()->x;
     self->m_moveGrabber->base()->y = input_device->base()->y;
-    self->m_moveGrabber->offset_x = input_device->base()->x - self->surface()->pos().x();
-    self->m_moveGrabber->offset_y = input_device->base()->y - self->surface()->pos().y();
+    self->m_moveGrabber->offset_x = wl_fixed_to_int(input_device->base()->x) - self->surface()->pos().x();
+    self->m_moveGrabber->offset_y = wl_fixed_to_int(input_device->base()->y) - self->surface()->pos().y();
 
     wl_input_device_start_pointer_grab(input_device->base(),self->m_moveGrabber->base());
 }
@@ -362,8 +362,8 @@ void ShellSurfaceResizeGrabber::motion(wl_pointer_grab *grab, uint32_t time, int
     ShellSurfaceResizeGrabber *resize_grabber = reinterpret_cast<ShellSurfaceResizeGrabber *>(grab);
     ShellSurface *shell_surface = resize_grabber->shell_surface;
     InputDevice *input_device = reinterpret_cast<InputDevice *>(grab->input_device);
-    int width_delta = grab->x - input_device->base()->x;
-    int height_delta = grab->y - input_device->base()->y;
+    int width_delta = wl_fixed_to_int(grab->x) - wl_fixed_to_int(input_device->base()->x);
+    int height_delta = wl_fixed_to_int(grab->y) - wl_fixed_to_int(input_device->base()->y);
     int new_width = resize_grabber->width;
     int new_height = resize_grabber->height;
     if (resize_grabber->resize_edges & WL_SHELL_SURFACE_RESIZE_TOP_LEFT) {
@@ -440,8 +440,8 @@ void ShellSurfaceMoveGrabber::motion(wl_pointer_grab *grab, uint32_t time, int32
     ShellSurfaceMoveGrabber *shell_surface_grabber = reinterpret_cast<ShellSurfaceMoveGrabber *>(grab);
     ShellSurface *shell_surface = shell_surface_grabber->shell_surface;
     InputDevice *input_device = reinterpret_cast<InputDevice *>(grab->input_device);
-    QPointF pos(input_device->base()->x - shell_surface_grabber->offset_x,
-                input_device->base()->y - shell_surface_grabber->offset_y);
+    QPointF pos(wl_fixed_to_int(input_device->base()->x) - shell_surface_grabber->offset_x,
+                wl_fixed_to_int(input_device->base()->y) - shell_surface_grabber->offset_y);
     shell_surface->surface()->setPos(pos);
     if (shell_surface->transientParent())
         shell_surface->setOffset(pos - shell_surface->transientParent()->surface()->pos());
index 3fda4eb..21adf26 100644 (file)
@@ -79,8 +79,8 @@ void QWaylandDataDeviceManager::enter(void *data,
               struct wl_data_device *wl_data_device,
               uint32_t time,
               struct wl_surface *surface,
-              int32_t x,
-              int32_t y,
+              wl_fixed_t x,
+              wl_fixed_t y,
               struct wl_data_offer *id)
 {
 
@@ -129,14 +129,14 @@ void QWaylandDataDeviceManager::leave(void *data,
 void QWaylandDataDeviceManager::motion(void *data,
                struct wl_data_device *wl_data_device,
                uint32_t time,
-               int32_t x,
-               int32_t y)
+               wl_fixed_t x,
+               wl_fixed_t y)
 {
     Q_UNUSED(wl_data_device);
     QWaylandDataDeviceManager *data_device_manager = static_cast<QWaylandDataDeviceManager *>(data);
     if (time < data_device_manager->m_drag_last_event_time)
         return;
-    data_device_manager->m_drag_position = QPoint(x,y);
+    data_device_manager->m_drag_position = QPoint(wl_fixed_to_int(x), wl_fixed_to_int(y));
 
 //    Qt::DropActions allActions =  Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
 //    QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(data_device_manager->m_drag_current_event_window->window(),
index 4eaf137..7db3dfc 100644 (file)
@@ -101,16 +101,16 @@ private:
                   struct wl_data_device *wl_data_device,
                   uint32_t time,
                   struct wl_surface *surface,
-                  int32_t x,
-                  int32_t y,
+                  wl_fixed_t x,
+                  wl_fixed_t y,
                   struct wl_data_offer *id);
     static void leave(void *data,
                   struct wl_data_device *wl_data_device);
     static void motion(void *data,
                    struct wl_data_device *wl_data_device,
                    uint32_t time,
-                   int32_t x,
-                   int32_t y);
+                   wl_fixed_t x,
+                   wl_fixed_t y);
     static void drop(void *data,
                  struct wl_data_device *wl_data_device);
     static void selection(void *data,
index 357cffa..942920f 100644 (file)
@@ -157,7 +157,7 @@ void QWaylandInputDevice::removeMouseButtonFromState(Qt::MouseButton button)
 void QWaylandInputDevice::inputHandleMotion(void *data,
                                            struct wl_input_device *input_device,
                                            uint32_t time,
-                                           int32_t surface_x, int32_t surface_y)
+                        wl_fixed_t surface_x, wl_fixed_t surface_y)
 {
     Q_UNUSED(input_device);
     Q_UNUSED(surface_x);
@@ -171,8 +171,10 @@ void QWaylandInputDevice::inputHandleMotion(void *data,
        return;
     }
 
-    QPoint pos(surface_x, surface_y);
-    QPoint global = window->window()->mapToGlobal(pos);
+    QPointF pos(wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y));
+    QPointF delta = pos - pos.toPoint();
+    QPointF global = window->window()->mapToGlobal(pos.toPoint());
+    global += delta;
 
     inputDevice->mSurfacePos = pos;
     inputDevice->mGlobalPos = global;
@@ -385,7 +387,7 @@ void QWaylandInputDevice::inputHandleKey(void *data,
 void QWaylandInputDevice::inputHandlePointerEnter(void *data,
                                                   struct wl_input_device *input_device,
                                                   uint32_t time, struct wl_surface *surface,
-                                                  int32_t sx, int32_t sy)
+                                                  wl_fixed_t sx, wl_fixed_t sy)
 {
     Q_UNUSED(input_device);
     Q_UNUSED(sx);
@@ -470,23 +472,23 @@ void QWaylandInputDevice::inputHandleTouchDown(void *data,
                                                uint32_t serial,
                                                uint32_t time,
                                                struct wl_surface *surface,
-                                               int id,
-                                               int x,
-                                               int y)
+                                               int32_t id,
+                                               wl_fixed_t x,
+                                               wl_fixed_t y)
 {
     Q_UNUSED(wl_input_device);
     Q_UNUSED(serial);
     Q_UNUSED(time);
     QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
     inputDevice->mTouchFocus = static_cast<QWaylandWindow *>(wl_surface_get_user_data(surface));
-    inputDevice->handleTouchPoint(id, x, y, Qt::TouchPointPressed);
+    inputDevice->handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointPressed);
 }
 
 void QWaylandInputDevice::inputHandleTouchUp(void *data,
                                              struct wl_input_device *wl_input_device,
                                              uint32_t serial,
                                              uint32_t time,
-                                             int id)
+                                             int32_t id)
 {
     Q_UNUSED(wl_input_device);
     Q_UNUSED(serial);
@@ -499,17 +501,17 @@ void QWaylandInputDevice::inputHandleTouchUp(void *data,
 void QWaylandInputDevice::inputHandleTouchMotion(void *data,
                                                  struct wl_input_device *wl_input_device,
                                                  uint32_t time,
-                                                 int id,
-                                                 int x,
-                                                 int y)
+                                                 int32_t id,
+                                                 wl_fixed_t x,
+                                                 wl_fixed_t y)
 {
     Q_UNUSED(wl_input_device);
     Q_UNUSED(time);
     QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
-    inputDevice->handleTouchPoint(id, x, y, Qt::TouchPointMoved);
+    inputDevice->handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointMoved);
 }
 
-void QWaylandInputDevice::handleTouchPoint(int id, int x, int y, Qt::TouchPointState state)
+void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::TouchPointState state)
 {
     QWindowSystemInterface::TouchPoint tp;
 
index d29723f..0146af9 100644 (file)
@@ -87,15 +87,15 @@ private:
     QWaylandWindow *mTouchFocus;
     static const struct wl_input_device_listener inputDeviceListener;
     Qt::MouseButtons mButtons;
-    QPoint mSurfacePos;
-    QPoint mGlobalPos;
+    QPointF mSurfacePos;
+    QPointF mGlobalPos;
     Qt::KeyboardModifiers mModifiers;
     uint32_t mTime;
 
     static void inputHandleMotion(void *data,
                                  struct wl_input_device *input_device,
                                  uint32_t time,
-                                 int32_t sx, int32_t sy);
+                  wl_fixed_t sx, wl_fixed_t sy);
     static void inputHandleButton(void *data,
                                  struct wl_input_device *input_device,
                                   uint32_t serial, uint32_t time,
@@ -112,7 +112,7 @@ private:
     static void inputHandlePointerEnter(void *data,
                                         struct wl_input_device *input_device,
                                         uint32_t time, struct wl_surface *surface,
-                                        int32_t sx, int32_t sy);
+                                        wl_fixed_t sx, wl_fixed_t sy);
     static void inputHandlePointerLeave(void *data,
                                         struct wl_input_device *input_device,
                                         uint32_t time, struct wl_surface *surface);
@@ -130,26 +130,26 @@ private:
                                      uint32_t serial,
                                      uint32_t time,
                                      struct wl_surface *surface,
-                                     int id,
-                                     int x,
-                                     int y);
+                                     int32_t id,
+                                     wl_fixed_t x,
+                                     wl_fixed_t y);
     static void inputHandleTouchUp(void *data,
                                    struct wl_input_device *wl_input_device,
                                    uint32_t serial,
                                    uint32_t time,
-                                   int id);
+                                   int32_t id);
     static void inputHandleTouchMotion(void *data,
                                        struct wl_input_device *wl_input_device,
                                        uint32_t time,
-                                       int id,
-                                       int x,
-                                       int y);
+                                       int32_t id,
+                                       wl_fixed_t x,
+                                       wl_fixed_t y);
     static void inputHandleTouchFrame(void *data,
                                       struct wl_input_device *wl_input_device);
     static void inputHandleTouchCancel(void *data,
                                        struct wl_input_device *wl_input_device);
 
-    void handleTouchPoint(int id, int x, int y, Qt::TouchPointState state);
+    void handleTouchPoint(int id, double x, double y, Qt::TouchPointState state);
     void handleTouchFrame();
     QList<QWindowSystemInterface::TouchPoint> mTouchPoints;
     QList<QWindowSystemInterface::TouchPoint> mPrevTouchPoints;
index 4138e8f..f2a7640 100644 (file)
@@ -106,8 +106,10 @@ void Compositor::sendMousePress(void *data, const QList<QVariant> &parameters)
         return;
 
     QPoint pos = parameters.last().toPoint();
-    wl_input_device_set_pointer_focus(&compositor->m_input, surface, pos.x(), pos.y());
-    wl_input_device_send_motion(compositor->m_input.pointer_focus_resource, compositor->time(), pos.x(), pos.y());
+    wl_input_device_set_pointer_focus(&compositor->m_input, surface,
+                                      wl_fixed_from_int(pos.x()), wl_fixed_from_int(pos.y()));
+    wl_input_device_send_motion(compositor->m_input.pointer_focus_resource, compositor->time(),
+                                wl_fixed_from_double(pos.x()), wl_fixed_from_double(pos.y()));
     wl_input_device_send_button(compositor->m_input.pointer_focus_resource,
         compositor->nextSerial(), compositor->time(), 0x110, 1);
 }
index 3b2c751..05da057 100644 (file)
@@ -1,3 +1,3 @@
 This version of Qt-Compositor is checked against the following sha1 from the
 Wayland repository:
-3f7048e0e99af50fe3555ab3f61f0ef1292959e4
+6b8816bab46172abc975674dcefadcea4edcef08