diff options
author | Jorgen Lind <jorgen.lind@digia.com> | 2014-02-11 08:05:30 +0100 |
---|---|---|
committer | Andy Nichols <andy.nichols@digia.com> | 2014-02-11 17:32:58 +0100 |
commit | 87d2b0b860e0250639d4fc9136ef23d3983f171a (patch) | |
tree | dce7f5577cfd23c11093894772346579d1c96059 | |
parent | 188b3fddb1f7e9d905ed146197e83c9e2c8b70aa (diff) | |
download | qtwayland-87d2b0b860e0250639d4fc9136ef23d3983f171a.tar.gz qtwayland-87d2b0b860e0250639d4fc9136ef23d3983f171a.tar.bz2 qtwayland-87d2b0b860e0250639d4fc9136ef23d3983f171a.zip |
Cleanup extension and hw integration initialization
Change-Id: I84dc6581b93c213c88762dc3477b8f932d08519b
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
-rw-r--r-- | src/compositor/compositor_api/qwaylandcompositor.cpp | 2 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlcompositor.cpp | 66 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlcompositor_p.h | 1 |
3 files changed, 33 insertions, 36 deletions
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index be001a9c..1de0056c 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -80,7 +80,7 @@ QWaylandCompositor::QWaylandCompositor(QWindow *window, const char *socketName, qRegisterMetaType<QWaylandSurface*>("WaylandSurface*"); #endif m_compositor->initializeHardwareIntegration(); - m_compositor->initializeWindowManagerProtocol(); + m_compositor->initializeExtensions(); m_compositor->initializeDefaultInputDevice(); } diff --git a/src/compositor/wayland_wrapper/qwlcompositor.cpp b/src/compositor/wayland_wrapper/qwlcompositor.cpp index bf198c8c..36b5bc36 100644 --- a/src/compositor/wayland_wrapper/qwlcompositor.cpp +++ b/src/compositor/wayland_wrapper/qwlcompositor.cpp @@ -158,9 +158,6 @@ Compositor::Compositor(QWaylandCompositor *qt_compositor, QWaylandCompositor::Ex m_timer.start(); compositor = this; - if (extensions & QWaylandCompositor::WindowManagerExtension) - m_windowManagerIntegration = new WindowManagerServerIntegration(qt_compositor, this); - wl_global_create(m_display->handle(), &wl_compositor_interface, wl_compositor_interface.version, @@ -180,31 +177,6 @@ Compositor::Compositor(QWaylandCompositor *qt_compositor, QWaylandCompositor::Ex m_shell, Shell::bind_func); -#if defined (QT_COMPOSITOR_WAYLAND_GL) - if (extensions & QWaylandCompositor::HardwareIntegrationExtension) - m_hw_integration.reset(new HardwareIntegration(this)); - QWindow *window = qt_compositor->window(); - if (window && window->surfaceType() != QWindow::RasterSurface) { - loadClientBufferIntegration(); - loadServerBufferIntegration(); - } -#endif - - if (extensions & QWaylandCompositor::OutputExtension) - m_outputExtension = new OutputExtensionGlobal(this); - if (extensions & QWaylandCompositor::SurfaceExtension) - m_surfaceExtension = new SurfaceExtensionGlobal(this); - if (extensions & QWaylandCompositor::SubSurfaceExtension) - m_subSurfaceExtension = new SubSurfaceExtensionGlobal(this); - if (extensions & QWaylandCompositor::TouchExtension) - m_touchExtension = new TouchExtensionGlobal(this); - if (extensions & QWaylandCompositor::QtKeyExtension) - m_qtkeyExtension = new QtKeyExtensionGlobal(this); - if (extensions & QWaylandCompositor::TextInputExtension) { - m_textInputManager.reset(new TextInputManager(this)); - m_inputPanel.reset(new InputPanel(this)); - } - if (wl_display_add_socket(m_display->handle(), qt_compositor->socketName())) { fprintf(stderr, "Fatal: Failed to open server socket\n"); exit(EXIT_FAILURE); @@ -224,7 +196,7 @@ Compositor::Compositor(QWaylandCompositor *qt_compositor, QWaylandCompositor::Ex //initialize distancefieldglyphcache here #ifdef QT_COMPOSITOR_QUICK - if (QQuickWindow *w = qobject_cast<QQuickWindow *>(window)) { + if (QQuickWindow *w = qobject_cast<QQuickWindow *>(qt_compositor->window())) { connect(w, SIGNAL(beforeSynchronizing()), this, SLOT(cleanupGraphicsResources()), Qt::DirectConnection); } else #endif @@ -364,6 +336,14 @@ QWaylandServerBufferIntegration * Compositor::serverBufferIntegration() const void Compositor::initializeHardwareIntegration() { #ifdef QT_COMPOSITOR_WAYLAND_GL + if (m_extensions & QWaylandCompositor::HardwareIntegrationExtension) + m_hw_integration.reset(new HardwareIntegration(this)); + QWindow *window = m_qt_compositor->window(); + if (window && window->surfaceType() != QWindow::RasterSurface) { + loadClientBufferIntegration(); + loadServerBufferIntegration(); + } + if (m_client_buffer_integration) m_client_buffer_integration->initializeHardware(m_display); if (m_server_buffer_integration) @@ -371,16 +351,32 @@ void Compositor::initializeHardwareIntegration() #endif } -void Compositor::initializeDefaultInputDevice() +void Compositor::initializeExtensions() { - m_default_wayland_input_device = new QWaylandInputDevice(m_qt_compositor); - m_default_input_device = m_default_wayland_input_device->handle(); + if (m_extensions & QWaylandCompositor::OutputExtension) + m_outputExtension = new OutputExtensionGlobal(this); + if (m_extensions & QWaylandCompositor::SurfaceExtension) + m_surfaceExtension = new SurfaceExtensionGlobal(this); + if (m_extensions & QWaylandCompositor::SubSurfaceExtension) + m_subSurfaceExtension = new SubSurfaceExtensionGlobal(this); + if (m_extensions & QWaylandCompositor::TouchExtension) + m_touchExtension = new TouchExtensionGlobal(this); + if (m_extensions & QWaylandCompositor::QtKeyExtension) + m_qtkeyExtension = new QtKeyExtensionGlobal(this); + if (m_extensions & QWaylandCompositor::TextInputExtension) { + m_textInputManager.reset(new TextInputManager(this)); + m_inputPanel.reset(new InputPanel(this)); + } + if (m_extensions & QWaylandCompositor::WindowManagerExtension) { + m_windowManagerIntegration = new WindowManagerServerIntegration(m_qt_compositor, this); + m_windowManagerIntegration->initialize(m_display); + } } -void Compositor::initializeWindowManagerProtocol() +void Compositor::initializeDefaultInputDevice() { - if (m_windowManagerIntegration) - m_windowManagerIntegration->initialize(m_display); + m_default_wayland_input_device = new QWaylandInputDevice(m_qt_compositor); + m_default_input_device = m_default_wayland_input_device->handle(); } QList<struct wl_client *> Compositor::clients() const diff --git a/src/compositor/wayland_wrapper/qwlcompositor_p.h b/src/compositor/wayland_wrapper/qwlcompositor_p.h index 90529e5e..9709efff 100644 --- a/src/compositor/wayland_wrapper/qwlcompositor_p.h +++ b/src/compositor/wayland_wrapper/qwlcompositor_p.h @@ -105,6 +105,7 @@ public: QWaylandClientBufferIntegration *clientBufferIntegration() const; QWaylandServerBufferIntegration *serverBufferIntegration() const; void initializeHardwareIntegration(); + void initializeExtensions(); void initializeDefaultInputDevice(); void initializeWindowManagerProtocol(); |