Remove most uses of XCB_CURRENT_TIME

XCB_CURRENT_TIME really should be avoided as much as possible (see
ICCCM).

However, the screen, mousegrabber and keygrabber code have cases where
they really want up-to-date information / want to activate a grab *now*.
These cases are fine with XCB_CURRENT_TIME since they are not related to
some events.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-04-15 12:05:42 +02:00
parent 148dc269a8
commit 29aee713f3
4 changed files with 13 additions and 9 deletions

View file

@ -107,7 +107,7 @@ awesome_atexit(bool restart)
* Work around this by placing the focus where we like it to be.
*/
xcb_set_input_focus(globalconf.connection, XCB_INPUT_FOCUS_POINTER_ROOT,
XCB_NONE, XCB_CURRENT_TIME);
XCB_NONE, globalconf.timestamp);
xcb_aux_sync(globalconf.connection);
xkb_free();
@ -266,7 +266,7 @@ acquire_WM_Sn(bool replace)
/* Acquire the selection */
xcb_set_selection_owner(globalconf.connection, globalconf.selection_owner_window,
globalconf.selection_atom, XCB_CURRENT_TIME);
globalconf.selection_atom, globalconf.timestamp);
if (get_sel_reply->owner != XCB_NONE)
{
/* Wait for the old owner to go away */
@ -286,7 +286,7 @@ acquire_WM_Sn(bool replace)
ev.window = globalconf.screen->root;
ev.format = 32;
ev.type = MANAGER;
ev.data.data32[0] = XCB_CURRENT_TIME;
ev.data.data32[0] = globalconf.timestamp;
ev.data.data32[1] = globalconf.selection_atom;
ev.data.data32[2] = globalconf.selection_owner_window;
ev.data.data32[3] = ev.data.data32[4] = 0;

View file

@ -221,7 +221,7 @@ event_handle_button(xcb_button_press_event_t *ev)
if(ev->child == XCB_NONE)
xcb_allow_events(globalconf.connection,
XCB_ALLOW_ASYNC_POINTER,
XCB_CURRENT_TIME);
ev->time);
}
else if((c = client_getbyframewin(ev->event)) || (c = client_getbywin(ev->event)))
{
@ -263,7 +263,7 @@ event_handle_button(xcb_button_press_event_t *ev)
}
xcb_allow_events(globalconf.connection,
XCB_ALLOW_REPLAY_POINTER,
XCB_CURRENT_TIME);
ev->time);
}
else if(ev->child == XCB_NONE)
if(globalconf.screen->root == ev->event)
@ -837,6 +837,10 @@ event_handle_randr_output_change_notify(xcb_randr_notify_event_t *ev)
xcb_randr_get_output_info_reply_t *info = NULL;
lua_State *L = globalconf_get_lua_State();
/* The following explicitly uses XCB_CURRENT_TIME since we want to know
* the final state of the connection. There could be more notification
* events underway and using some "old" timestamp causes problems.
*/
info = xcb_randr_get_output_info_reply(globalconf.connection,
xcb_randr_get_output_info_unchecked(globalconf.connection,
output,

2
root.c
View file

@ -276,7 +276,7 @@ luaA_root_fake_input(lua_State *L)
xcb_test_fake_input(globalconf.connection,
type,
detail,
XCB_CURRENT_TIME,
0, /* This is a delay, not a timestamp! */
XCB_NONE,
x, y,
0);

View file

@ -90,7 +90,7 @@ systray_register(void)
ev.window = xscreen->root;
ev.format = 32;
ev.type = MANAGER;
ev.data.data32[0] = XCB_CURRENT_TIME;
ev.data.data32[0] = globalconf.timestamp;
ev.data.data32[1] = globalconf.systray.atom;
ev.data.data32[2] = globalconf.systray.window;
ev.data.data32[3] = ev.data.data32[4] = 0;
@ -98,7 +98,7 @@ systray_register(void)
xcb_set_selection_owner(globalconf.connection,
globalconf.systray.window,
globalconf.systray.atom,
XCB_CURRENT_TIME);
globalconf.timestamp);
xcb_send_event(globalconf.connection, false, xscreen->root, 0xFFFFFF, (char *) &ev);
}
@ -116,7 +116,7 @@ systray_cleanup(void)
xcb_set_selection_owner(globalconf.connection,
XCB_NONE,
globalconf.systray.atom,
XCB_CURRENT_TIME);
globalconf.timestamp);
xcb_unmap_window(globalconf.connection,
globalconf.systray.window);