Skip to content

Commit

Permalink
Make xdg-shell usage check better
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-fedin authored and john-preston committed Jun 20, 2021
1 parent bcb2d61 commit 7fadd9f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
11 changes: 0 additions & 11 deletions waylandshells/xdg-shell/main.cpp
Expand Up @@ -47,16 +47,6 @@ namespace WaylandShells {

using namespace QtWaylandClient;

namespace {

bool InUse = false;

}

bool XdgShell() {
return InUse;
}

class DesktopAppWaylandXdgShellIntegrationPlugin : public QWaylandShellIntegrationPlugin
{
Q_OBJECT
Expand All @@ -70,7 +60,6 @@ QWaylandShellIntegration *DesktopAppWaylandXdgShellIntegrationPlugin::create(con
{
Q_UNUSED(key);
Q_UNUSED(paramList);
InUse = true;
return new QWaylandXdgShellIntegration();
}

Expand Down
15 changes: 14 additions & 1 deletion waylandshells/xdg-shell/qwaylandxdgshellintegration.cpp
Expand Up @@ -49,8 +49,20 @@ namespace WaylandShells {

using namespace QtWaylandClient;

namespace {

bool InUse = false;

}

bool XdgShell() {
return InUse;
}

bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display)
{
InUse = false;

for (QWaylandDisplay::RegistryGlobal global : display->globals()) {
if (global.interface == QLatin1String("xdg_wm_base")) {
m_xdgShell.reset(new QWaylandXdgShell(display, global.id, global.version));
Expand All @@ -63,7 +75,8 @@ bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display)
return false;
}

return QWaylandShellIntegration::initialize(display);
InUse = QWaylandShellIntegration::initialize(display);
return InUse;
}

QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window)
Expand Down

0 comments on commit 7fadd9f

Please sign in to comment.