diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2011-12-19 12:48:47 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2011-12-20 13:59:03 +0100 |
commit | 23b98c3ad7f4e495f0212b6e1471d1a81dcc8e4c (patch) | |
tree | d2ff200e01b9e3d6d07cfd87f0d5c061f4b09fd5 /src/plugins/platforms/wayland/gl_integration | |
parent | 317d72460806e86cacdb46ebe9c0b034b06a1cf4 (diff) |
Make all QWaylandWindows have a wl_surface for the entire lifespan
This solves that we dont have to cache the generic objects,
and we conform with upstream wayland
Change-Id: Ib8e15b734f09988f4f00989aeb1c274636709dc9
Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Diffstat (limited to 'src/plugins/platforms/wayland/gl_integration')
-rw-r--r-- | src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp | 37 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h | 3 |
2 files changed, 8 insertions, 32 deletions
diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp index e9da60263..97ba7ab65 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp @@ -55,15 +55,12 @@ QWaylandEglWindow::QWaylandEglWindow(QWindow *window) : QWaylandWindow(window) - , m_waylandEglWindow(0) + , m_eglIntegration(static_cast<QWaylandEglIntegration *>(mDisplay->eglIntegration())) + , m_waylandEglWindow(wl_egl_window_create(mSurface,window->width(),window->height())) , m_eglSurface(0) , m_eglConfig(0) , m_format(window->format()) { - m_eglIntegration = static_cast<QWaylandEglIntegration *>(mDisplay->eglIntegration()); - - //super creates a new surface - newSurfaceCreated(); } QWaylandEglWindow::~QWaylandEglWindow() @@ -72,6 +69,10 @@ QWaylandEglWindow::~QWaylandEglWindow() eglDestroySurface(m_eglIntegration->eglDisplay(), m_eglSurface); m_eglSurface = 0; } + + if (m_waylandEglWindow) { + wl_egl_window_destroy(m_waylandEglWindow); + } } QWaylandWindow::WindowType QWaylandEglWindow::windowType() const @@ -88,28 +89,6 @@ void QWaylandEglWindow::setGeometry(const QRect &rect) } } -void QWaylandEglWindow::newSurfaceCreated() -{ - if (m_waylandEglWindow) - wl_egl_window_destroy(m_waylandEglWindow); - - QSize size = geometry().size(); - if (!size.isValid()) - size = QSize(0,0); - - if (m_eglSurface) { - eglDestroySurface(m_eglIntegration->eglDisplay(), m_eglSurface); - m_eglSurface = 0; - } - - m_waylandEglWindow = wl_egl_window_create(mSurface, size.width(), size.height()); - -#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT - //remove when we don't delay wl_surface creation -// QWaylandWindowManagerIntegration::instance()->flushPropertyChanges(this); -#endif -} - QSurfaceFormat QWaylandEglWindow::format() const { return m_format; @@ -121,8 +100,8 @@ EGLSurface QWaylandEglWindow::eglSurface() const return 0; if (!m_eglSurface) { - if (!m_eglConfig) - m_eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), window()->format(), true); + m_eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), window()->format(), true); + const_cast<QWaylandEglWindow *>(this)->m_format = q_glFormatFromConfig(m_eglIntegration->eglDisplay(),m_eglConfig); EGLNativeWindowType window = m_waylandEglWindow; m_eglSurface = eglCreateWindowSurface(m_eglIntegration->eglDisplay(), m_eglConfig, window, 0); diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h index d435a511c..db0235160 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h @@ -60,9 +60,6 @@ public: QSurfaceFormat format() const; -protected: - void newSurfaceCreated(); - private: QWaylandEglIntegration *m_eglIntegration; struct wl_egl_window *m_waylandEglWindow; |