From f15559eb1f8a0b1e4c634c13754061228eae83b9 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 20 Aug 2011 17:48:07 +0200 Subject: [PATCH] =?utf8?q?Don=E2=80=99t=20die,=20but=20ELOG=20and=20fallba?= =?utf8?q?ck=20when=20the=20pointer=20cannot=20be=20queried=20(Thanks=20Ni?= =?utf8?q?klas)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main.c b/src/main.c index 90e5eb06..77e295fc 100644 --- a/src/main.c +++ b/src/main.c @@ -430,18 +430,21 @@ int main(int argc, char *argv[]) { } xcb_query_pointer_reply_t *pointerreply; - if (!(pointerreply = xcb_query_pointer_reply(conn, pointercookie, NULL))) - die("Could not query pointer position\n"); - - DLOG("Pointer at %d, %d\n", pointerreply->root_x, pointerreply->root_y); - Output *output = get_output_containing(pointerreply->root_x, pointerreply->root_y); - if (!output) { - ELOG("ERROR: No screen at (%d, %d), starting on the first screen\n", - pointerreply->root_x, pointerreply->root_y); + Output *output = NULL; + if (!(pointerreply = xcb_query_pointer_reply(conn, pointercookie, NULL))) { + ELOG("Could not query pointer position, using first screen\n"); output = get_first_output(); - } + } else { + DLOG("Pointer at %d, %d\n", pointerreply->root_x, pointerreply->root_y); + output = get_output_containing(pointerreply->root_x, pointerreply->root_y); + if (!output) { + ELOG("ERROR: No screen at (%d, %d), starting on the first screen\n", + pointerreply->root_x, pointerreply->root_y); + output = get_first_output(); + } - con_focus(con_descend_focused(output_get_content(output->con))); + con_focus(con_descend_focused(output_get_content(output->con))); + } tree_render(); -- 2.39.5