From 6d858a0fdb896d2c4f9f6411f691f0648c084cd7 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 5 Dec 2013 17:33:24 +0100 Subject: [PATCH] XCB plugin: query screen resources without _current xcb_randr_get_screen_resources() and xcb_randr_get_screen_resources_current() do basically the same, but for one case: if nothing has queried these information ever before. So if an application is the very first client ever to connect to an X server it may just return nothing. A call to xcb_randr_get_screen_info_reply() will then cause the X server to allocate the needed information and send an update notification, resulting in a second QXcbScreen being created, but the other one is still around and probably used. The behavior I observed with a simple test application was that the application was not visible on the screen when it was the first client ever on the X server. Killing the application and starting it again made it work just fine. Change-Id: Id64f267e8ebcfa5b39d21d98307170a09e5169df Reviewed-by: Uli Schlachter Reviewed-by: Gatis Paeglis Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 030090d98d..a68ae8cf71 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -144,23 +144,23 @@ void QXcbConnection::updateScreens() xcb_generic_error_t *error = NULL; xcb_randr_get_output_primary_cookie_t primaryCookie = xcb_randr_get_output_primary(xcb_connection(), xcbScreen->root); - xcb_randr_get_screen_resources_current_cookie_t resourcesCookie = - xcb_randr_get_screen_resources_current(xcb_connection(), xcbScreen->root); + xcb_randr_get_screen_resources_cookie_t resourcesCookie = + xcb_randr_get_screen_resources(xcb_connection(), xcbScreen->root); xcb_randr_get_output_primary_reply_t *primary = xcb_randr_get_output_primary_reply(xcb_connection(), primaryCookie, &error); if (!primary || error) { qWarning("QXcbConnection: Failed to get the primary output of the screen"); free(error); } else { - xcb_randr_get_screen_resources_current_reply_t *resources = - xcb_randr_get_screen_resources_current_reply(xcb_connection(), resourcesCookie, &error); + xcb_randr_get_screen_resources_reply_t *resources = + xcb_randr_get_screen_resources_reply(xcb_connection(), resourcesCookie, &error); if (!resources || error) { qWarning("QXcbConnection: Failed to get the screen resources"); free(error); } else { xcb_timestamp_t timestamp = resources->config_timestamp; - outputCount = xcb_randr_get_screen_resources_current_outputs_length(resources); - xcb_randr_output_t *outputs = xcb_randr_get_screen_resources_current_outputs(resources); + outputCount = xcb_randr_get_screen_resources_outputs_length(resources); + xcb_randr_output_t *outputs = xcb_randr_get_screen_resources_outputs(resources); for (int i = 0; i < outputCount; i++) { xcb_randr_get_output_info_reply_t *output =