Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

Commit

Permalink
qgtkintegration: Make requests for x11 root window work
Browse files Browse the repository at this point in the history
zeal uses these for global key shortcuts. The key shortcuts don't appear
to work, but at least we no longer crash with X protocol errors.

Reported-by: Donald Carr
  • Loading branch information
rburchell committed May 15, 2018
1 parent 5e0ab4b commit dcbf8b5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/platform-plugin/platform-plugin.pro
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ QT += gtkextras

CONFIG += qpa/genericunixfontdatabase

LIBS += -lX11-xcb
LIBS += -lX11-xcb -lxcb

CONFIG += link_pkgconfig
PKGCONFIG_PRIVATE += gdk-3.0 gtk+-3.0 libnotify
Expand Down
19 changes: 19 additions & 0 deletions src/platform-plugin/qgtkintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,25 @@ void *QGtkIntegration::nativeResourceForScreen(const QByteArray &resource, QScre
}

result = reinterpret_cast<void*>(type + 1);
} else if (resource == "rootwindow") {
#ifdef GDK_WINDOWING_X11
static bool rootwin_warned = false;
if (!rootwin_warned) {
qWarning() << "X root window requested; this is experimental, and may not work well.";
rootwin_warned = true;
}
Display *dpy = nullptr;
if (GDK_IS_X11_DISPLAY(m_display)) {
dpy = gdk_x11_display_get_xdisplay(m_display);
xcb_connection_t *conn = XGetXCBConnection(dpy);

// use the first screen... hopefully this is okay? sigh...
xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(conn)).data;
result = reinterpret_cast<void*>(screen->root);
} else {
qWarning() << "Can't get root X window, GDK_BACKEND is not X11.";
}
#endif
} else {
qWarning() << "Unimplemented request for " << resource << " on " << screen;
}
Expand Down

0 comments on commit dcbf8b5

Please sign in to comment.