Update wayland-sha and implement the surface on the touchdown event
authorJørgen Lind <jorgen.lind@nokia.com>
Fri, 23 Dec 2011 07:57:11 +0000 (08:57 +0100)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Fri, 23 Dec 2011 08:30:21 +0000 (09:30 +0100)
Change-Id: I32435569e6e1181c6bbafb87d885834a883bf43b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
src/compositor/wayland_wrapper/wlsurface.cpp
src/plugins/platforms/wayland/qwaylandinputdevice.cpp
src/plugins/platforms/wayland/qwaylandinputdevice.h
wayland_sha1.txt

index 1730f14..e9de121 100644 (file)
@@ -589,7 +589,7 @@ void Surface::sendTouchPointEvent(int id, int x, int y, Qt::TouchPointState stat
     struct wl_resource *resource = d->compositor->defaultInputDevice()->base()->pointer_focus_resource;
     switch (state) {
     case Qt::TouchPointPressed:
-        wl_resource_post_event(resource, WL_INPUT_DEVICE_TOUCH_DOWN, time, id, x, y);
+        wl_resource_post_event(resource, WL_INPUT_DEVICE_TOUCH_DOWN, time, this, id, x, y);
         break;
     case Qt::TouchPointMoved:
         wl_resource_post_event(resource, WL_INPUT_DEVICE_TOUCH_MOTION, time, id, x, y);
index 47fdc6b..2b248e5 100644 (file)
@@ -381,6 +381,7 @@ void QWaylandInputDevice::inputHandleKeyboardFocus(void *data,
 void QWaylandInputDevice::inputHandleTouchDown(void *data,
                                                struct wl_input_device *wl_input_device,
                                                uint32_t time,
+                                               struct wl_surface *surface,
                                                int id,
                                                int x,
                                                int y)
@@ -388,6 +389,7 @@ void QWaylandInputDevice::inputHandleTouchDown(void *data,
     Q_UNUSED(wl_input_device);
     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);
 }
 
@@ -399,6 +401,7 @@ void QWaylandInputDevice::inputHandleTouchUp(void *data,
     Q_UNUSED(wl_input_device);
     Q_UNUSED(time);
     QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
+    inputDevice->mTouchFocus = 0;
     inputDevice->handleTouchPoint(id, 0, 0, Qt::TouchPointReleased);
 }
 
@@ -432,11 +435,16 @@ void QWaylandInputDevice::handleTouchPoint(int id, int x, int y, Qt::TouchPointS
     if (!coordsOk) {
         // x and y are surface relative.
         // We need a global (screen) position.
-        QWaylandWindow *win = mPointerFocus;
+        QWaylandWindow *win = mTouchFocus;
+
+        //is it possible that mTouchFocus is null;
+        if (!win)
+            win = mPointerFocus;
         if (!win)
             win = mKeyboardFocus;
         if (!win || !win->window())
             return;
+
         tp.area = QRectF(0, 0, 8, 8);
         tp.area.moveCenter(win->window()->mapToGlobal(QPoint(x, y)));
     }
index 126f073..d0cba2e 100644 (file)
@@ -75,6 +75,7 @@ private:
     struct wl_data_device *mTransferDevice;
     QWaylandWindow *mPointerFocus;
     QWaylandWindow *mKeyboardFocus;
+    QWaylandWindow *mTouchFocus;
     static const struct wl_input_device_listener inputDeviceListener;
     Qt::MouseButtons mButtons;
     QPoint mSurfacePos;
@@ -106,6 +107,7 @@ private:
     static void inputHandleTouchDown(void *data,
                                      struct wl_input_device *wl_input_device,
                                      uint32_t time,
+                                     struct wl_surface *surface,
                                      int id,
                                      int x,
                                      int y);
index 8dec178..e4dc6fc 100644 (file)
@@ -1,3 +1,3 @@
 This version of Qt-Compositor is checked against the following sha1 from the
 Wayland repository:
-187eace6139754eae58a21303c808a270f70dc3f
+e68529b52f30974841974c53605f00c9a8ca1580