diff --git a/event.c b/event.c index 3062c5ce2..3ae40ced0 100644 --- a/event.c +++ b/event.c @@ -992,10 +992,8 @@ void event_init(void) const xcb_query_extension_reply_t *reply; reply = xcb_get_extension_data(globalconf.connection, &xcb_randr_id); - if (reply && reply->present) { - xcb_randr_select_input(globalconf.connection, globalconf.screen->root, XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE); + if (reply && reply->present) globalconf.event_base_randr = reply->first_event; - } reply = xcb_get_extension_data(globalconf.connection, &xcb_shape_id); if (reply && reply->present) diff --git a/objects/screen.c b/objects/screen.c index 0521baa79..9ba884dcd 100644 --- a/objects/screen.c +++ b/objects/screen.c @@ -371,6 +371,11 @@ screen_scan_randr(lua_State *L, screen_array_t *screens) globalconf.have_randr_13 = minor_version >= 3; + /* We want to know when something changes */ + xcb_randr_select_input(globalconf.connection, + globalconf.screen->root, + XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE); + if (minor_version >= 5) screen_scan_randr_monitors(L, screens); else