diff options
author | Johan Klokkhammer Helsing <johan.helsing@theqtcompany.com> | 2016-03-19 15:32:11 +0100 |
---|---|---|
committer | Giulio Camuffo <giulio.camuffo@kdab.com> | 2016-04-11 06:20:41 +0000 |
commit | 0b16a83b9d292d98d0ef6d2541af0eb58a8504f2 (patch) | |
tree | e7d0af6e4ec0fa5f1ab5fd131033938d259588a3 /examples | |
parent | f430e84e0642b5eec0b6069dadd8317d880932cc (diff) | |
download | qtwayland-0b16a83b9d292d98d0ef6d2541af0eb58a8504f2.tar.gz |
Create a fallback shellSurface in wl_shell::get_shell_surface
This makes QWaylandShellPrivate::shell_get_shell_surface behave
similarly to QWaylandCompositorPrivate::compositor_create_surface.
First, a signal is emitted letting a compositor implementation create
its own subclass of QWaylandShellSurface if desired. If it's not
created, a plain QWaylandShellSurface is created instead.
It also makes the API more consistent, as the creation of shell surfaces
now mimick the creation of surfaces and xdg surfaces.
qwindow-compositor has been updated to take advantage of the new API
Change-Id: I7c7262dd253dc37843e8e471a4ead5f6e87b0ced
Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/wayland/qwindow-compositor/windowcompositor.cpp | 18 | ||||
-rw-r--r-- | examples/wayland/qwindow-compositor/windowcompositor.h | 4 |
2 files changed, 10 insertions, 12 deletions
diff --git a/examples/wayland/qwindow-compositor/windowcompositor.cpp b/examples/wayland/qwindow-compositor/windowcompositor.cpp index a8504b51..5b3b6905 100644 --- a/examples/wayland/qwindow-compositor/windowcompositor.cpp +++ b/examples/wayland/qwindow-compositor/windowcompositor.cpp @@ -111,8 +111,8 @@ WindowCompositor::WindowCompositor(QWindow *window) , m_wlShell(new QWaylandWlShell(this)) , m_xdgShell(new QWaylandXdgShell(this)) { - connect(m_wlShell, &QWaylandWlShell::createShellSurface, this, &WindowCompositor::onCreateWlShellSurface); - connect(m_xdgShell, &QWaylandXdgShell::createXdgSurface, this, &WindowCompositor::onCreateXdgSurface); + connect(m_wlShell, &QWaylandWlShell::shellSurfaceCreated, this, &WindowCompositor::onWlShellSurfaceCreated); + connect(m_xdgShell, &QWaylandXdgShell::xdgSurfaceCreated, this, &WindowCompositor::onXdgSurfaceCreated); connect(m_xdgShell, &QWaylandXdgShell::createXdgPopup, this, &WindowCompositor::onCreateXdgPopup); } @@ -189,29 +189,27 @@ WindowCompositorView * WindowCompositor::findView(const QWaylandSurface *s) cons return Q_NULLPTR; } -void WindowCompositor::onCreateWlShellSurface(QWaylandSurface *s, const QWaylandResource &res) +void WindowCompositor::onWlShellSurfaceCreated(QWaylandWlShellSurface *wlShellSurface) { - QWaylandSurface *surface = s; - - QWaylandWlShellSurface *wlShellSurface = new QWaylandWlShellSurface(m_wlShell, surface, res); connect(wlShellSurface, &QWaylandWlShellSurface::startMove, this, &WindowCompositor::onStartMove); connect(wlShellSurface, &QWaylandWlShellSurface::startResize, this, &WindowCompositor::onWlStartResize); connect(wlShellSurface, &QWaylandWlShellSurface::setTransient, this, &WindowCompositor::onSetTransient); connect(wlShellSurface, &QWaylandWlShellSurface::setPopup, this, &WindowCompositor::onSetPopup); - WindowCompositorView *view = findView(s); + + WindowCompositorView *view = findView(wlShellSurface->surface()); Q_ASSERT(view); view->m_wlShellSurface = wlShellSurface; } -void WindowCompositor::onCreateXdgSurface(QWaylandSurface *surface, const QWaylandResource &res) +void WindowCompositor::onXdgSurfaceCreated(QWaylandXdgSurface *xdgSurface) { - QWaylandXdgSurface *xdgSurface = new QWaylandXdgSurface(m_xdgShell, surface, res); connect(xdgSurface, &QWaylandXdgSurface::startMove, this, &WindowCompositor::onStartMove); connect(xdgSurface, &QWaylandXdgSurface::startResize, this, &WindowCompositor::onXdgStartResize); - WindowCompositorView *view = findView(surface); + WindowCompositorView *view = findView(xdgSurface->surface()); Q_ASSERT(view); view->m_xdgSurface = xdgSurface; + connect(xdgSurface, &QWaylandXdgSurface::setMaximized, view, &WindowCompositorView::onXdgSetMaximized); connect(xdgSurface, &QWaylandXdgSurface::setFullscreen, view, &WindowCompositorView::onXdgSetFullscreen); connect(xdgSurface, &QWaylandXdgSurface::unsetMaximized, view, &WindowCompositorView::onXdgUnsetMaximized); diff --git a/examples/wayland/qwindow-compositor/windowcompositor.h b/examples/wayland/qwindow-compositor/windowcompositor.h index 63068d1a..c8b796ee 100644 --- a/examples/wayland/qwindow-compositor/windowcompositor.h +++ b/examples/wayland/qwindow-compositor/windowcompositor.h @@ -127,8 +127,8 @@ private slots: void triggerRender(); void onSurfaceCreated(QWaylandSurface *surface); - void onCreateWlShellSurface(QWaylandSurface *s, const QWaylandResource &resource); - void onCreateXdgSurface(QWaylandSurface *surface, const QWaylandResource &resource); + void onWlShellSurfaceCreated(QWaylandWlShellSurface *wlShellSurface); + void onXdgSurfaceCreated(QWaylandXdgSurface *xdgSurface); void onCreateXdgPopup(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandInputDevice *inputDevice, const QPoint &position, const QWaylandResource &resource); void onSetTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, QWaylandWlShellSurface::FocusPolicy focusPolicy); |