Merge pull request #2017 from Airblader/bug-2011
Activate root output if RandR request fails.
This commit is contained in:
commit
0425f48835
36
src/randr.c
36
src/randr.c
|
@ -604,7 +604,6 @@ void randr_query_outputs(void) {
|
||||||
Output *output, *other, *first;
|
Output *output, *other, *first;
|
||||||
xcb_randr_get_output_primary_cookie_t pcookie;
|
xcb_randr_get_output_primary_cookie_t pcookie;
|
||||||
xcb_randr_get_screen_resources_current_cookie_t rcookie;
|
xcb_randr_get_screen_resources_current_cookie_t rcookie;
|
||||||
resources_reply *res;
|
|
||||||
|
|
||||||
/* timestamp of the configuration so that we get consistent replies to all
|
/* timestamp of the configuration so that we get consistent replies to all
|
||||||
* requests (if the configuration changes between our different calls) */
|
* requests (if the configuration changes between our different calls) */
|
||||||
|
@ -621,28 +620,31 @@ void randr_query_outputs(void) {
|
||||||
ELOG("Could not get RandR primary output\n");
|
ELOG("Could not get RandR primary output\n");
|
||||||
else
|
else
|
||||||
DLOG("primary output is %08x\n", primary->output);
|
DLOG("primary output is %08x\n", primary->output);
|
||||||
if ((res = xcb_randr_get_screen_resources_current_reply(conn, rcookie, NULL)) == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
cts = res->config_timestamp;
|
resources_reply *res = xcb_randr_get_screen_resources_current_reply(conn, rcookie, NULL);
|
||||||
|
if (res == NULL) {
|
||||||
|
ELOG("Could not query screen resources.\n");
|
||||||
|
} else {
|
||||||
|
cts = res->config_timestamp;
|
||||||
|
|
||||||
int len = xcb_randr_get_screen_resources_current_outputs_length(res);
|
int len = xcb_randr_get_screen_resources_current_outputs_length(res);
|
||||||
randr_outputs = xcb_randr_get_screen_resources_current_outputs(res);
|
randr_outputs = xcb_randr_get_screen_resources_current_outputs(res);
|
||||||
|
|
||||||
/* Request information for each output */
|
/* Request information for each output */
|
||||||
xcb_randr_get_output_info_cookie_t ocookie[len];
|
xcb_randr_get_output_info_cookie_t ocookie[len];
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
ocookie[i] = xcb_randr_get_output_info(conn, randr_outputs[i], cts);
|
ocookie[i] = xcb_randr_get_output_info(conn, randr_outputs[i], cts);
|
||||||
|
|
||||||
/* Loop through all outputs available for this X11 screen */
|
/* Loop through all outputs available for this X11 screen */
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
xcb_randr_get_output_info_reply_t *output;
|
xcb_randr_get_output_info_reply_t *output;
|
||||||
|
|
||||||
if ((output = xcb_randr_get_output_info_reply(conn, ocookie[i], NULL)) == NULL)
|
if ((output = xcb_randr_get_output_info_reply(conn, ocookie[i], NULL)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
handle_output(conn, randr_outputs[i], output, cts, res);
|
handle_output(conn, randr_outputs[i], output, cts, res);
|
||||||
free(output);
|
free(output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there's no randr output, enable the output covering the root window. */
|
/* If there's no randr output, enable the output covering the root window. */
|
||||||
|
|
Loading…
Reference in New Issue