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

Commit

Permalink
qgtkintegration: small fix to dcbf8b5
Browse files Browse the repository at this point in the history
when not running on x, we should be sure to return nullptr, otherwise
we're going to have a bad time.
  • Loading branch information
rburchell committed May 15, 2018
1 parent dcbf8b5 commit 91fd22b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/platform-plugin/qgtkintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,16 +295,18 @@ void *QGtkIntegration::nativeResourceForScreen(const QByteArray &resource, QScre
rootwin_warned = true;
}
Display *dpy = nullptr;
xcb_screen_t *screen = 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);
screen = xcb_setup_roots_iterator(xcb_get_setup(conn)).data;
} else {
qWarning() << "Can't get root X window, GDK_BACKEND is not X11.";
}

result = reinterpret_cast<void*>(screen ? screen->root : nullptr);
#endif
} else {
qWarning() << "Unimplemented request for " << resource << " on " << screen;
Expand Down

0 comments on commit 91fd22b

Please sign in to comment.