randr: use root window in case of no randr outputs

This patch introduces a root output covering the root window. It is used
in two cases:

1. RandR is not available. In this case, the previous behaviour of
   creating a single output covering the root window is preserved.

2. RandR is available, but there is no active output. In this case,
   the root output is enabled and will be the only active output.
   If any RandR output becomes available, the root output will be
   disabled again. Existing mechanisms for migrating workspaces will
   just work without modification.

I've carefully slipped in a global variable `Output root_output` representing
that output.

Fixes #926 and #1489
This commit is contained in:
Nils Schneider
2015-09-14 22:12:47 +02:00
parent c87b256200
commit 78decb565a
3 changed files with 58 additions and 44 deletions

View File

@ -94,15 +94,15 @@ static void query_screens(xcb_connection_t *conn) {
*/
void xinerama_init(void) {
if (!xcb_get_extension_data(conn, &xcb_xinerama_id)->present) {
DLOG("Xinerama extension not found, disabling.\n");
disable_randr(conn);
DLOG("Xinerama extension not found, using root output.\n");
create_root_output(conn);
} else {
xcb_xinerama_is_active_reply_t *reply;
reply = xcb_xinerama_is_active_reply(conn, xcb_xinerama_is_active(conn), NULL);
if (reply == NULL || !reply->state) {
DLOG("Xinerama is not active (in your X-Server), disabling.\n");
disable_randr(conn);
DLOG("Xinerama is not active (in your X-Server), using root output.\n");
create_root_output(conn);
} else
query_screens(conn);