summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylanddisplay.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-08-05 10:10:58 +0200
committerJohan Helsing <johan.helsing@qt.io>2016-08-09 10:58:10 +0000
commitb3b4778c237c43cfde02c4750017c37112c315c4 (patch)
tree9e9d8e01aa485386d2dd5b8a652ec0b17ca5d3ec /src/client/qwaylanddisplay.cpp
parent1db3dee9432f28f35ec9c971444b8a889bbdd6e2 (diff)
Make wl_shell and xdg_shell use the QWaylandShellIntegration interface
This simplifies the code in QWaylandDisplay and hopefully makes it easier to implement a prioritized shell selection mechanism later. Change-Id: I2bb3a13f8acedb60a6606cb3a8b5b228095eadf9 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Diffstat (limited to 'src/client/qwaylanddisplay.cpp')
-rw-r--r--src/client/qwaylanddisplay.cpp31
1 files changed, 11 insertions, 20 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 682172bf8..7225d24af 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -77,16 +77,8 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle)
QWaylandShellSurface *QWaylandDisplay::createShellSurface(QWaylandWindow *window)
{
- if (mWaylandIntegration->shellIntegration())
- return mWaylandIntegration->shellIntegration()->createShellSurface(window);
-
- if (shellXdg()) {
- return new QWaylandXdgSurface(shellXdg()->get_xdg_surface(window->object()), window);
- } else if (shell()) {
- return new QWaylandWlShellSurface(shell()->get_shell_surface(window->object()), window);
- }
-
- return Q_NULLPTR;
+ Q_ASSERT(mWaylandIntegration->shellIntegration());
+ return mWaylandIntegration->shellIntegration()->createShellSurface(window);
}
struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion)
@@ -248,11 +240,6 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
mCompositor.init(registry, id, mCompositorVersion);
} else if (interface == QStringLiteral("wl_shm")) {
mShm = static_cast<struct wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface,1));
- } else if (interface == QStringLiteral("xdg_shell")
- && qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) {
- mShellXdg.reset(new QWaylandXdgShell(registry,id));
- } else if (interface == QStringLiteral("wl_shell")){
- mShell.reset(new QtWayland::wl_shell(registry, id, 1));
} else if (interface == QStringLiteral("wl_seat")) {
QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id);
mInputDevices.append(inputDevice);
@@ -301,6 +288,15 @@ void QWaylandDisplay::registry_global_remove(uint32_t id)
}
}
+bool QWaylandDisplay::hasRegistryGlobal(const QString &interfaceName)
+{
+ Q_FOREACH (const RegistryGlobal &global, mGlobals)
+ if (global.interface == interfaceName)
+ return true;
+
+ return false;
+}
+
void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data)
{
Listener l = { listener, data };
@@ -356,11 +352,6 @@ void QWaylandDisplay::forceRoundTrip()
wl_callback_destroy(callback);
}
-QtWayland::xdg_shell *QWaylandDisplay::shellXdg()
-{
- return mShellXdg.data();
-}
-
bool QWaylandDisplay::supportsWindowDecoration() const
{
static bool disabled = qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").toInt();