Upgrade to newer wayland SHA-1.
authorSamuel Rødal <samuel.rodal@nokia.com>
Wed, 29 Feb 2012 15:36:05 +0000 (16:36 +0100)
committerJørgen Lind <jorgen.lind@nokia.com>
Mon, 5 Mar 2012 07:55:30 +0000 (08:55 +0100)
Change-Id: If0c1d86a3011e266cafabeb875bc5616191a8cf4
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
19 files changed:
src/compositor/wayland_wrapper/wayland_wrapper.pri
src/compositor/wayland_wrapper/wlcompositor.cpp
src/compositor/wayland_wrapper/wldatadevice.cpp
src/compositor/wayland_wrapper/wldatadevice.h
src/compositor/wayland_wrapper/wlinputdevice.cpp
src/compositor/wayland_wrapper/wlregion.cpp [new file with mode: 0644]
src/compositor/wayland_wrapper/wlregion.h [new file with mode: 0644]
src/compositor/wayland_wrapper/wlshellsurface.cpp
src/compositor/wayland_wrapper/wlshellsurface.h
src/compositor/wayland_wrapper/wlsurface.cpp
src/compositor/wayland_wrapper/wlsurface.h
src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp
src/plugins/platforms/wayland/qwaylanddatadevicemanager.h
src/plugins/platforms/wayland/qwaylanddisplay.cpp
src/plugins/platforms/wayland/qwaylanddisplay.h
src/plugins/platforms/wayland/qwaylanddnd.cpp
src/plugins/platforms/wayland/qwaylandinputdevice.cpp
src/plugins/platforms/wayland/qwaylandinputdevice.h
wayland_sha1.txt

index 9e4f99e..abf4d64 100644 (file)
@@ -22,7 +22,8 @@ HEADERS += \
     $$PWD/wlsubsurface.h \
     $$PWD/wltouch.h \
     $$PWD/../../shared/qwaylandmimehelper.h \
-    $$PWD/wlsurfacebuffer.h
+    $$PWD/wlsurfacebuffer.h \
+    $$PWD/wlregion.h
 
 SOURCES += \
     $$PWD/wlcompositor.cpp \
@@ -41,7 +42,8 @@ SOURCES += \
     $$PWD/wlsubsurface.cpp \
     $$PWD/wltouch.cpp \
     $$PWD/../../shared/qwaylandmimehelper.cpp \
-    $$PWD/wlsurfacebuffer.cpp
+    $$PWD/wlsurfacebuffer.cpp \
+    $$PWD/wlregion.cpp
 
 INCLUDEPATH += $$PWD
 INCLUDEPATH += $$PWD/../../shared
index 46bb113..6cd9a3d 100644 (file)
@@ -53,6 +53,7 @@
 #include "wlshellsurface.h"
 #include "wltouch.h"
 #include "wlinputdevice.h"
+#include "wlregion.h"
 
 #include <QWindow>
 #include <QSocketNotifier>
@@ -89,8 +90,16 @@ void compositor_create_surface(struct wl_client *client,
      static_cast<Compositor *>(resource->data)->createSurface(client,id);
 }
 
+void compositor_create_region(struct wl_client *client,
+                              struct wl_resource *compositor, uint32_t id)
+{
+    Q_UNUSED(compositor);
+    new Region(client, id);
+}
+
 const static struct wl_compositor_interface compositor_interface = {
-    compositor_create_surface
+    compositor_create_surface,
+    compositor_create_region
 };
 
 void Compositor::bind_func(struct wl_client *client, void *data,
index 06c036e..abcf67b 100644 (file)
@@ -54,34 +54,19 @@ void DataDevice::start_drag(struct wl_client *client,
                    struct wl_resource *resource,
                    struct wl_resource *source,
                    struct wl_resource *surface,
+                   struct wl_resource *icon,
                    uint32_t time)
 {
     Q_UNUSED(client);
     Q_UNUSED(surface);
+    Q_UNUSED(icon);
     Q_UNUSED(time);
-
     DataDevice *data_device = static_cast<DataDevice *>(resource->data);
     DataSource *data_source = static_cast<DataSource *>(source->data);
-
     Q_UNUSED(data_device);
     Q_UNUSED(data_source);
 }
 
-void DataDevice::attach(struct wl_client *client,
-               struct wl_resource *resource,
-               uint32_t time,
-               struct wl_resource *buffer,
-               int32_t x,
-               int32_t y)
-{
-    Q_UNUSED(client);
-    Q_UNUSED(resource);
-    Q_UNUSED(time);
-    Q_UNUSED(buffer);
-    Q_UNUSED(x);
-    Q_UNUSED(y);
-}
-
 void DataDevice::set_selection(struct wl_client *client,
                       struct wl_resource *data_device_resource,
                       struct wl_resource *source,
@@ -98,7 +83,6 @@ void DataDevice::set_selection(struct wl_client *client,
 
 const struct wl_data_device_interface DataDevice::data_device_interface = {
     DataDevice::start_drag,
-    DataDevice::attach,
     DataDevice::set_selection
 };
 
index 8cdec52..373820c 100644 (file)
@@ -69,13 +69,8 @@ private:
                        struct wl_resource *resource,
                        struct wl_resource *source,
                        struct wl_resource *surface,
+                       struct wl_resource *icon,
                        uint32_t time);
-    static void attach(struct wl_client *client,
-                   struct wl_resource *resource,
-                   uint32_t time,
-                   struct wl_resource *buffer,
-                   int32_t x,
-                   int32_t y);
     static void set_selection(struct wl_client *client,
                           struct wl_resource *resource,
                           struct wl_resource *source,
index 57d1e3d..e9d8797 100644 (file)
@@ -223,10 +223,10 @@ Surface *InputDevice::mouseFocus() const
 
 void InputDevice::setMouseFocus(Surface *surface, const QPoint &globalPos, const QPoint &localPos)
 {
+    Q_UNUSED(globalPos);
     wl_input_device_set_pointer_focus(base(),
                                       surface ? surface->base() : 0,
                                       m_compositor->currentTimeMsecs(),
-                                      globalPos.x(), globalPos.y(),
                                       localPos.x(), localPos.y());
 }
 
diff --git a/src/compositor/wayland_wrapper/wlregion.cpp b/src/compositor/wayland_wrapper/wlregion.cpp
new file mode 100644 (file)
index 0000000..7553da7
--- /dev/null
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt Compositor.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+**     the names of its contributors may be used to endorse or promote
+**     products derived from this software without specific prior written
+**     permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "wlregion.h"
+
+#include "wlcompositor.h"
+
+namespace Wayland {
+
+void destroy_region(struct wl_resource *resource)
+{
+    delete resolve<Region>(resource);
+}
+
+Region::Region(struct wl_client *client, uint32_t id)
+{
+    addClientResource(client, base(), id, &wl_region_interface,
+            &region_interface, destroy_region);
+}
+
+Region::~Region()
+{
+}
+
+const struct wl_region_interface Region::region_interface = {
+    region_destroy,
+    region_add,
+    region_subtract
+};
+
+void Region::region_destroy(wl_client *client, wl_resource *region)
+{
+    Q_UNUSED(client);
+    wl_resource_destroy(region, Compositor::currentTimeMsecs());
+}
+
+void Region::region_add(wl_client *client, wl_resource *region,
+                       int32_t x, int32_t y, int32_t w, int32_t h)
+{
+    Q_UNUSED(client);
+    resolve<Region>(region)->m_region += QRect(x, y, w, h);
+}
+
+void Region::region_subtract(wl_client *client, wl_resource *region,
+                            int32_t x, int32_t y, int32_t w, int32_t h)
+{
+    Q_UNUSED(client);
+    resolve<Region>(region)->m_region -= QRect(x, y, w, h);
+}
+
+}
+
+
diff --git a/src/compositor/wayland_wrapper/wlregion.h b/src/compositor/wayland_wrapper/wlregion.h
new file mode 100644 (file)
index 0000000..d2f083a
--- /dev/null
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt Compositor.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+**     the names of its contributors may be used to endorse or promote
+**     products derived from this software without specific prior written
+**     permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WL_REGION_H
+#define WL_REGION_H
+
+#include "waylandexport.h"
+#include "waylandobject.h"
+
+#include <QRegion>
+
+#include <wayland-util.h>
+
+namespace Wayland {
+
+class Q_COMPOSITOR_EXPORT Region : public Object<wl_resource>
+{
+public:
+    Region(struct wl_client *client, uint32_t id);
+    ~Region();
+
+    uint id() const { return base()->object.id; }
+
+    QRegion region() const { return m_region; }
+
+    static const struct wl_region_interface region_interface;
+
+private:
+    Q_DISABLE_COPY(Region)
+
+    QRegion m_region;
+
+    static void region_destroy(wl_client *client, wl_resource *region);
+    static void region_add(wl_client *client, wl_resource *region,
+                           int32_t x, int32_t y, int32_t w, int32_t h);
+    static void region_subtract(wl_client *client, wl_resource *region,
+                                int32_t x, int32_t y, int32_t w, int32_t h);
+};
+
+}
+
+#endif // WL_REGION_H
+
index 39c60a2..ea4b54b 100644 (file)
@@ -134,10 +134,16 @@ void ShellSurface::set_transient(struct wl_client *client,
 }
 
 void ShellSurface::set_fullscreen(struct wl_client *client,
-                       struct wl_resource *shell_surface_resource)
+                       struct wl_resource *shell_surface_resource,
+                       uint32_t method,
+                       uint32_t framerate,
+                       struct wl_resource *output)
 {
     Q_UNUSED(client);
     Q_UNUSED(shell_surface_resource);
+    Q_UNUSED(method);
+    Q_UNUSED(framerate);
+    Q_UNUSED(output);
 }
 
 void ShellSurface::set_popup(wl_client *client, wl_resource *resource, wl_resource *input_device, uint32_t time, wl_resource *parent, int32_t x, int32_t y, uint32_t flags)
@@ -152,14 +158,23 @@ void ShellSurface::set_popup(wl_client *client, wl_resource *resource, wl_resour
     Q_UNUSED(flags);
 }
 
+void ShellSurface::set_maximized(struct wl_client *client,
+                       struct wl_resource *shell_surface_resource,
+                       struct wl_resource *output)
+{
+    Q_UNUSED(client);
+    Q_UNUSED(shell_surface_resource);
+    Q_UNUSED(output);
+}
+
 const struct wl_shell_surface_interface ShellSurface::shell_surface_interface = {
     ShellSurface::move,
     ShellSurface::resize,
     ShellSurface::set_toplevel,
     ShellSurface::set_transient,
     ShellSurface::set_fullscreen,
-    ShellSurface::set_popup
-
+    ShellSurface::set_popup,
+    ShellSurface::set_maximized
 };
 
 }
index 0f2469c..a4eacd7 100644 (file)
@@ -91,7 +91,10 @@ private:
                               int y,
                               uint32_t flags);
     static void set_fullscreen(struct wl_client *client,
-                               struct wl_resource *shell_surface_resource);
+                               struct wl_resource *shell_surface_resource,
+                               uint32_t method,
+                               uint32_t framerate,
+                               struct wl_resource *output);
     static void set_popup(struct wl_client *client,
                           struct wl_resource *resource,
                           struct wl_resource *input_device,
@@ -100,6 +103,9 @@ private:
                           int32_t x,
                           int32_t y,
                           uint32_t flags);
+    static void set_maximized(struct wl_client *client,
+                              struct wl_resource *shell_surface_resource,
+                              struct wl_resource *output);
 
     static const struct wl_shell_surface_interface shell_surface_interface;
 
index f7721c1..4bfe521 100644 (file)
@@ -47,6 +47,7 @@
 #include "wlshmbuffer.h"
 #include "wlinputdevice.h"
 #include "wlextendedsurface.h"
+#include "wlregion.h"
 #include "wlsubsurface.h"
 #include "wlsurfacebuffer.h"
 #include "wlshellsurface.h"
@@ -83,6 +84,8 @@ Surface::Surface(struct wl_client *client, uint32_t id, Compositor *compositor)
     , m_extendedSurface(0)
     , m_subSurface(0)
     , m_shellSurface(0)
+    , m_inputRegion(0)
+    , m_opaqueRegion(0)
 {
     wl_list_init(&m_frame_callback_list);
     addClientResource(client, &base()->resource, id, &wl_surface_interface,
@@ -164,10 +167,22 @@ QSize Surface::size() const
 
 void Surface::setSize(const QSize &size)
 {
-    bool emitChange = size != m_size;
-    m_size = size;
-    if (emitChange)
+    if (size != m_size) {
+        m_opaqueRegion = QRegion();
+        m_inputRegion = QRegion(QRect(QPoint(), size));
+        m_size = size;
         m_waylandSurface->sizeChanged();
+    }
+}
+
+QRegion Surface::inputRegion() const
+{
+    return m_inputRegion;
+}
+
+QRegion Surface::opaqueRegion() const
+{
+    return m_opaqueRegion;
 }
 
 QImage Surface::image() const
@@ -403,7 +418,9 @@ const struct wl_surface_interface Surface::surface_interface = {
         Surface::surface_destroy,
         Surface::surface_attach,
         Surface::surface_damage,
-        Surface::surface_frame
+        Surface::surface_frame,
+        Surface::surface_set_opaque_region,
+        Surface::surface_set_input_region
 };
 
 void Surface::surface_destroy(struct wl_client *, struct wl_resource *surface_resource)
@@ -436,5 +453,21 @@ void Surface::surface_frame(struct wl_client *client,
     wl_list_insert(&surface->m_frame_callback_list,&frame_callback->link);
 }
 
+void Surface::surface_set_opaque_region(struct wl_client *client, struct wl_resource *surfaceResource,
+                                        struct wl_resource *region)
+{
+    Q_UNUSED(client);
+    Surface *surface = resolve<Surface>(surfaceResource);
+    surface->m_opaqueRegion = region ? resolve<Region>(region)->region() : QRegion();
+}
+
+void Surface::surface_set_input_region(struct wl_client *client, struct wl_resource *surfaceResource,
+                                       struct wl_resource *region)
+{
+    Q_UNUSED(client);
+    Surface *surface = resolve<Surface>(surfaceResource);
+    surface->m_inputRegion = region ? resolve<Region>(region)->region() : QRegion(QRect(QPoint(), surface->size()));
+}
+
 } // namespace Wayland
 
index 7ad0bcd..0d917cb 100644 (file)
@@ -91,6 +91,9 @@ public:
     QSize size() const;
     void setSize(const QSize &size);
 
+    QRegion inputRegion() const;
+    QRegion opaqueRegion() const;
+
     QImage image() const;
 
 #ifdef QT_COMPOSITOR_WAYLAND_GL
@@ -138,6 +141,9 @@ private:
     SubSurface *m_subSurface;
     ShellSurface *m_shellSurface;
 
+    QRegion m_inputRegion;
+    QRegion m_opaqueRegion;
+
     static const int buffer_pool_size = 3;
     SurfaceBuffer *m_bufferPool[buffer_pool_size];
 
@@ -161,6 +167,10 @@ private:
                         int32_t x, int32_t y, int32_t width, int32_t height);
     static void surface_frame(struct wl_client *client, struct wl_resource *resource,
                        uint32_t callback);
+    static void surface_set_opaque_region(struct wl_client *client, struct wl_resource *resource,
+                                          struct wl_resource *region);
+    static void surface_set_input_region(struct wl_client *client, struct wl_resource *resource,
+                                         struct wl_resource *region);
 
 };
 
index 3b82ee5..5f5c136 100644 (file)
@@ -194,7 +194,8 @@ QWaylandDataDeviceManager::QWaylandDataDeviceManager(QWaylandDisplay *display, u
     , m_drag_data_offer(0)
     , m_drag_data_source(0)
     , m_drag_surface(0)
-    , m_drag_buffer(0)
+    , m_drag_icon_surface(0)
+    , m_drag_icon_buffer(0)
     , m_drag_can_drop(false)
 {
     m_data_device_manager = static_cast<struct wl_data_device_manager *>(wl_display_bind(display->wl_display(),id,&wl_data_device_manager_interface));
@@ -253,16 +254,18 @@ void QWaylandDataDeviceManager::createAndSetDrag(QDrag *drag)
     if (pixmap.isNull()) {
 //        pixmap = QPlatformDrag::defaultPixmap();
     }
-    m_drag_buffer = new QWaylandShmBuffer(m_display,pixmap.size(),QImage::Format_ARGB32_Premultiplied);
+
+    m_drag_icon_buffer = new QWaylandShmBuffer(m_display, pixmap.size(), QImage::Format_ARGB32_Premultiplied);
 
     {
-        QPainter p(m_drag_buffer->image());
+        QPainter p(m_drag_icon_buffer->image());
         p.drawPixmap(0,0,pixmap);
     }
 
-    wl_data_device_start_drag(transfer_device,m_drag_data_source->handle(),m_drag_surface,QWaylandDisplay::currentTimeMillisec());
-    wl_data_device_attach(transfer_device,QWaylandDisplay::currentTimeMillisec()
-                          ,m_drag_buffer->buffer(),drag->hotSpot().x(),drag->hotSpot().y());
+    m_drag_icon_surface = wl_compositor_create_surface(m_display->wl_compositor());
+    wl_surface_attach(m_drag_icon_surface, m_drag_icon_buffer->buffer(), -drag->hotSpot().x(), -drag->hotSpot().y());
+
+    wl_data_device_start_drag(transfer_device, m_drag_data_source->handle(), m_drag_surface, m_drag_icon_surface, QWaylandDisplay::currentTimeMillisec());
 }
 
 QMimeData *QWaylandDataDeviceManager::dragMime() const
@@ -283,6 +286,7 @@ bool QWaylandDataDeviceManager::canDropDrag() const
 void QWaylandDataDeviceManager::cancelDrag()
 {
     wl_data_source_destroy(m_drag_data_source->handle() );
+    wl_surface_destroy(m_drag_icon_surface);
     m_drag_data_source = 0;
 }
 
index 4382ba2..21d8bfb 100644 (file)
@@ -88,8 +88,9 @@ private:
     QWaylandDataOffer *m_drag_data_offer;
     QWaylandDataSource *m_drag_data_source;
     QWaylandWindow *m_drag_current_event_window;
-    struct wl_surface *m_drag_surface;
-    QWaylandShmBuffer *m_drag_buffer;
+    wl_surface *m_drag_surface;
+    wl_surface *m_drag_icon_surface;
+    QWaylandShmBuffer *m_drag_icon_buffer;
     bool m_drag_can_drop;
     uint32_t m_drag_last_event_time;
     QPoint m_drag_position;
index 73b46c4..223b547 100644 (file)
@@ -166,7 +166,7 @@ QWaylandDisplay::~QWaylandDisplay(void)
 #ifdef QT_WAYLAND_GL_SUPPORT
     delete mEglIntegration;
 #endif
-    wl_display_destroy(mDisplay);
+    wl_display_disconnect(mDisplay);
 }
 
 void QWaylandDisplay::createNewScreen(struct wl_output *output, QRect geometry)
index ed9cc55..2a6f832 100644 (file)
@@ -88,6 +88,7 @@ public:
     void setCursor(QWaylandBuffer *buffer, int32_t x, int32_t y);
 
     struct wl_display *wl_display() const { return mDisplay; }
+    struct wl_compositor *wl_compositor() const { return mCompositor; }
 
     QWaylandShell *shell() const { return mShell; }
 
index 325c1fd..79fc9ae 100644 (file)
@@ -61,6 +61,7 @@ QMimeData * QWaylandDrag::platformDropData()
 
 Qt::DropAction QWaylandDrag::drag(QDrag *m_drag)
 {
+    Q_UNUSED(m_drag);
 //    m_display->dndSelectionHandler()->createAndSetDrag(drag);
     return Qt::IgnoreAction;
 }
index 1f66ea9..98980e6 100644 (file)
@@ -124,7 +124,6 @@ struct wl_data_device *QWaylandInputDevice::transferDevice() const
 void QWaylandInputDevice::inputHandleMotion(void *data,
                                            struct wl_input_device *input_device,
                                            uint32_t time,
-                                           int32_t x, int32_t y,
                                            int32_t surface_x, int32_t surface_y)
 {
     Q_UNUSED(input_device);
@@ -137,13 +136,14 @@ void QWaylandInputDevice::inputHandleMotion(void *data,
        return;
     }
 
-    inputDevice->mSurfacePos = QPoint(surface_x, surface_y);
-    inputDevice->mGlobalPos = QPoint(x, y);
+    QPoint pos(surface_x, surface_y);
+    QPoint global = window->window()->mapToGlobal(pos);
+
+    inputDevice->mSurfacePos = pos;
+    inputDevice->mGlobalPos = global;
     inputDevice->mTime = time;
     QWindowSystemInterface::handleMouseEvent(window->window(),
-                                            time,
-                                            inputDevice->mSurfacePos,
-                                            inputDevice->mGlobalPos,
+                                             time, pos, global,
                                              inputDevice->mButtons);
 }
 
@@ -323,39 +323,48 @@ void QWaylandInputDevice::inputHandleKey(void *data,
 #endif
 }
 
-void QWaylandInputDevice::inputHandlePointerFocus(void *data,
-                                                 struct wl_input_device *input_device,
-                                                 uint32_t time, struct wl_surface *surface,
-                                                 int32_t x, int32_t y, int32_t sx, int32_t sy)
+void QWaylandInputDevice::inputHandlePointerEnter(void *data,
+                                                  struct wl_input_device *input_device,
+                                                  uint32_t time, struct wl_surface *surface,
+                                                  int32_t sx, int32_t sy)
 {
     Q_UNUSED(input_device);
-    Q_UNUSED(x);
-    Q_UNUSED(y);
     Q_UNUSED(sx);
     Q_UNUSED(sy);
     QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
-    QWaylandWindow *window;
 
-    if (inputDevice->mPointerFocus) {
-       window = inputDevice->mPointerFocus;
-       QWindowSystemInterface::handleLeaveEvent(window->window());
-       inputDevice->mPointerFocus = NULL;
-    }
+    // shouldn't get pointer leave with no surface
+    Q_ASSERT(surface);
 
-    if (surface) {
-       window = (QWaylandWindow *) wl_surface_get_user_data(surface);
-       QWindowSystemInterface::handleEnterEvent(window->window());
-       inputDevice->mPointerFocus = window;
-    }
+    QWaylandWindow *window = (QWaylandWindow *) wl_surface_get_user_data(surface);
+    QWindowSystemInterface::handleEnterEvent(window->window());
+    inputDevice->mPointerFocus = window;
 
     inputDevice->mTime = time;
 }
 
-void QWaylandInputDevice::inputHandleKeyboardFocus(void *data,
-                                                  struct wl_input_device *input_device,
-                                                  uint32_t time,
-                                                  struct wl_surface *surface,
-                                                  struct wl_array *keys)
+void QWaylandInputDevice::inputHandlePointerLeave(void *data,
+                                                  struct wl_input_device *input_device,
+                                                  uint32_t time, struct wl_surface *surface)
+{
+    Q_UNUSED(input_device);
+    QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
+
+    // shouldn't get pointer leave with no surface
+    Q_ASSERT(surface);
+
+    QWaylandWindow *window = (QWaylandWindow *) wl_surface_get_user_data(surface);
+    QWindowSystemInterface::handleLeaveEvent(window->window());
+    inputDevice->mPointerFocus = 0;
+
+    inputDevice->mTime = time;
+}
+
+void QWaylandInputDevice::inputHandleKeyboardEnter(void *data,
+                                                   struct wl_input_device *input_device,
+                                                   uint32_t time,
+                                                   struct wl_surface *surface,
+                                                   struct wl_array *keys)
 {
     Q_UNUSED(input_device);
     Q_UNUSED(time);
@@ -378,16 +387,29 @@ void QWaylandInputDevice::inputHandleKeyboardFocus(void *data,
     Q_UNUSED(keys);
 #endif
 
-    if (surface) {
-       window = (QWaylandWindow *) wl_surface_get_user_data(surface);
-       inputDevice->mKeyboardFocus = window;
-        inputDevice->mQDisplay->setLastKeyboardFocusInputDevice(inputDevice);
-       QWindowSystemInterface::handleWindowActivated(window->window());
-    } else {
-       inputDevice->mKeyboardFocus = NULL;
-        inputDevice->mQDisplay->setLastKeyboardFocusInputDevice(0);
-       QWindowSystemInterface::handleWindowActivated(0);
-    }
+    // shouldn't get keyboard enter with no surface
+    Q_ASSERT(surface);
+
+    window = (QWaylandWindow *) wl_surface_get_user_data(surface);
+    inputDevice->mKeyboardFocus = window;
+    inputDevice->mQDisplay->setLastKeyboardFocusInputDevice(inputDevice);
+    QWindowSystemInterface::handleWindowActivated(window->window());
+}
+
+void QWaylandInputDevice::inputHandleKeyboardLeave(void *data,
+                                                   struct wl_input_device *input_device,
+                                                   uint32_t time,
+                                                   struct wl_surface *surface)
+{
+    Q_UNUSED(input_device);
+    Q_UNUSED(time);
+    Q_UNUSED(surface);
+
+    QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
+
+    inputDevice->mKeyboardFocus = NULL;
+    inputDevice->mQDisplay->setLastKeyboardFocusInputDevice(0);
+    QWindowSystemInterface::handleWindowActivated(0);
 }
 
 void QWaylandInputDevice::inputHandleTouchDown(void *data,
@@ -536,8 +558,10 @@ const struct wl_input_device_listener QWaylandInputDevice::inputDeviceListener =
     QWaylandInputDevice::inputHandleMotion,
     QWaylandInputDevice::inputHandleButton,
     QWaylandInputDevice::inputHandleKey,
-    QWaylandInputDevice::inputHandlePointerFocus,
-    QWaylandInputDevice::inputHandleKeyboardFocus,
+    QWaylandInputDevice::inputHandlePointerEnter,
+    QWaylandInputDevice::inputHandlePointerLeave,
+    QWaylandInputDevice::inputHandleKeyboardEnter,
+    QWaylandInputDevice::inputHandleKeyboardLeave,
     QWaylandInputDevice::inputHandleTouchDown,
     QWaylandInputDevice::inputHandleTouchUp,
     QWaylandInputDevice::inputHandleTouchMotion,
index abdd497..52e80a6 100644 (file)
@@ -87,7 +87,6 @@ private:
     static void inputHandleMotion(void *data,
                                  struct wl_input_device *input_device,
                                  uint32_t time,
-                                 int32_t x, int32_t y,
                                  int32_t sx, int32_t sy);
     static void inputHandleButton(void *data,
                                  struct wl_input_device *input_device,
@@ -95,15 +94,22 @@ private:
     static void inputHandleKey(void *data,
                               struct wl_input_device *input_device,
                               uint32_t time, uint32_t key, uint32_t state);
-    static void inputHandlePointerFocus(void *data,
-                                       struct wl_input_device *input_device,
-                                       uint32_t time, struct wl_surface *surface,
-                                       int32_t x, int32_t y, int32_t sx, int32_t sy);
-    static void inputHandleKeyboardFocus(void *data,
-                                        struct wl_input_device *input_device,
-                                        uint32_t time,
-                                        struct wl_surface *surface,
-                                        struct wl_array *keys);
+    static void inputHandlePointerEnter(void *data,
+                                        struct wl_input_device *input_device,
+                                        uint32_t time, struct wl_surface *surface,
+                                        int32_t sx, int32_t sy);
+    static void inputHandlePointerLeave(void *data,
+                                        struct wl_input_device *input_device,
+                                        uint32_t time, struct wl_surface *surface);
+    static void inputHandleKeyboardEnter(void *data,
+                                         struct wl_input_device *input_device,
+                                         uint32_t time,
+                                         struct wl_surface *surface,
+                                         struct wl_array *keys);
+    static void inputHandleKeyboardLeave(void *data,
+                                         struct wl_input_device *input_device,
+                                         uint32_t time,
+                                         struct wl_surface *surface);
     static void inputHandleTouchDown(void *data,
                                      struct wl_input_device *wl_input_device,
                                      uint32_t time,
index 9d574b8..a25d163 100644 (file)
@@ -1,3 +1,3 @@
 This version of Qt-Compositor is checked against the following sha1 from the
 Wayland repository:
-28e3cbc654a81c35a2948af93d6e86911159a13f
+0d22d25b8740688a4f243c70cdfd32bc05993778