diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2011-04-04 10:13:48 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-04-04 10:21:05 (GMT) |
commit | cc46428d5b421b3ebc3a2ff3171b5197af008022 (patch) | |
tree | 023967d9dc6ce574396afa4990e564cf962cd6a5 /src | |
parent | 991f59a295e7678165b1db7befc9beac8bdbe503 (diff) | |
download | Qt-cc46428d5b421b3ebc3a2ff3171b5197af008022.zip Qt-cc46428d5b421b3ebc3a2ff3171b5197af008022.tar.gz Qt-cc46428d5b421b3ebc3a2ff3171b5197af008022.tar.bz2 |
Wayland: Allways have a userPtr for QWaylandWindow
So that we can use it without having to check for 0 in input handling
Conflicts:
src/plugins/platforms/wayland/qwaylandinputdevice.cpp
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index e3b2d46..b79f355 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -54,9 +54,11 @@ #include <fcntl.h> #include <stdio.h> -struct wl_surface *QWaylandDisplay::createSurface() +struct wl_surface *QWaylandDisplay::createSurface(void *handle) { - return wl_compositor_create_surface(mCompositor); + struct wl_surface * surface = wl_compositor_create_surface(mCompositor); + wl_surface_set_user_data(surface, handle); + return surface; } struct wl_buffer *QWaylandDisplay::createShmBuffer(int fd, diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index fc26ad2..481f829 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -63,7 +63,7 @@ public: void createNewScreen(struct wl_output *output, QRect geometry); QList<QPlatformScreen *> screens() const { return mScreens; } - struct wl_surface *createSurface(); + struct wl_surface *createSurface(void *handle); struct wl_buffer *createShmBuffer(int fd, int width, int height, uint32_t stride, struct wl_visual *visual); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a912a83..9e851b3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -56,7 +56,7 @@ QWaylandWindow::QWaylandWindow(QWidget *window) static WId id = 1; mWindowId = id++; - mSurface = mDisplay->createSurface(); + mSurface = mDisplay->createSurface(this); } QWaylandWindow::~QWaylandWindow() @@ -76,13 +76,12 @@ void QWaylandWindow::setParent(const QPlatformWindow *parent) void QWaylandWindow::setVisible(bool visible) { - if (!mSurface) { - mSurface = mDisplay->createSurface(); + if (!mSurface && visible) { + mSurface = mDisplay->createSurface(this); newSurfaceCreated(); } if (visible) { - wl_surface_set_user_data(mSurface, this); wl_surface_map_toplevel(mSurface); } else { wl_surface_destroy(mSurface); |