diff options
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbscreen.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbscreen.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 0b362c5256..d92004b1ac 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -277,6 +277,13 @@ QPixmap QXcbScreen::grabWindow(WId window, int x, int y, int width, int height) if (width == 0 || height == 0) return QPixmap(); + // TODO: handle multiple screens + QXcbScreen *screen = const_cast<QXcbScreen *>(this); + xcb_window_t root = screen->root(); + + if (window == 0) + window = root; + xcb_get_geometry_cookie_t geometry_cookie = xcb_get_geometry_unchecked(xcb_connection(), window); xcb_get_geometry_reply_t *reply = @@ -291,9 +298,6 @@ QPixmap QXcbScreen::grabWindow(WId window, int x, int y, int width, int height) if (height < 0) height = reply->height - y; - // TODO: handle multiple screens - QXcbScreen *screen = const_cast<QXcbScreen *>(this); - xcb_window_t root = screen->root(); geometry_cookie = xcb_get_geometry_unchecked(xcb_connection(), root); xcb_get_geometry_reply_t *root_reply = xcb_get_geometry_reply(xcb_connection(), geometry_cookie, NULL); |