From: Michael Stapelberg Date: Sun, 9 Oct 2011 19:18:38 +0000 (+0100) Subject: save the last timestamp received by X11 in last_timestamp X-Git-Tag: 4.1~104^2~13 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d1d4f39f9eae26da05da8135e2319088f89bca67;p=i3%2Fi3 save the last timestamp received by X11 in last_timestamp We need it for startup notifications (to generate a unique id) Conflicts: include/i3.h src/main.c --- diff --git a/src/click.c b/src/click.c index c270bdec..8ea182eb 100644 --- a/src/click.c +++ b/src/click.c @@ -259,6 +259,8 @@ int handle_button_press(xcb_button_press_event_t *event) { Con *con; DLOG("Button %d pressed on window 0x%08x\n", event->state, event->event); + last_timestamp = event->time; + const uint32_t mod = config.floating_modifier; bool mod_pressed = (mod != 0 && (event->state & mod) == mod); DLOG("floating_mod = %d, detail = %d\n", mod_pressed, event->detail); diff --git a/src/handlers.c b/src/handlers.c index b3cb1df7..995622b9 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -80,6 +80,9 @@ bool event_is_ignored(const int sequence, const int response_type) { * */ static int handle_key_press(xcb_key_press_event_t *event) { + + last_timestamp = event->time; + DLOG("Keypress %d, state raw = %d\n", event->detail, event->state); /* Remove the numlock bit, all other bits are modifiers we can bind to */ @@ -156,6 +159,8 @@ static void check_crossing_screen_boundary(uint32_t x, uint32_t y) { static int handle_enter_notify(xcb_enter_notify_event_t *event) { Con *con; + last_timestamp = event->time; + DLOG("enter_notify for %08x, mode = %d, detail %d, serial %d\n", event->event, event->mode, event->detail, event->sequence); DLOG("coordinates %d, %d\n", event->event_x, event->event_y); @@ -227,6 +232,9 @@ static int handle_enter_notify(xcb_enter_notify_event_t *event) { * */ static int handle_motion_notify(xcb_motion_notify_event_t *event) { + + last_timestamp = event->time; + /* Skip events where the pointer was over a child window, we are only * interested in events on the root window. */ if (event->child != 0) @@ -1084,6 +1092,7 @@ void handle_event(int type, xcb_generic_event_t *event) { case XCB_PROPERTY_NOTIFY: DLOG("Property notify\n"); xcb_property_notify_event_t *e = (xcb_property_notify_event_t*)event; + last_timestamp = e->time; property_notify(e->state, e->window, e->atom); break;