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
This commit is contained in:
Michael Stapelberg 2011-10-09 20:18:38 +01:00
parent b9db72dc8a
commit d1d4f39f9e
2 changed files with 11 additions and 0 deletions

View File

@ -259,6 +259,8 @@ int handle_button_press(xcb_button_press_event_t *event) {
Con *con; Con *con;
DLOG("Button %d pressed on window 0x%08x\n", event->state, event->event); DLOG("Button %d pressed on window 0x%08x\n", event->state, event->event);
last_timestamp = event->time;
const uint32_t mod = config.floating_modifier; const uint32_t mod = config.floating_modifier;
bool mod_pressed = (mod != 0 && (event->state & mod) == mod); bool mod_pressed = (mod != 0 && (event->state & mod) == mod);
DLOG("floating_mod = %d, detail = %d\n", mod_pressed, event->detail); DLOG("floating_mod = %d, detail = %d\n", mod_pressed, event->detail);

View File

@ -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) { 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); DLOG("Keypress %d, state raw = %d\n", event->detail, event->state);
/* Remove the numlock bit, all other bits are modifiers we can bind to */ /* 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) { static int handle_enter_notify(xcb_enter_notify_event_t *event) {
Con *con; Con *con;
last_timestamp = event->time;
DLOG("enter_notify for %08x, mode = %d, detail %d, serial %d\n", DLOG("enter_notify for %08x, mode = %d, detail %d, serial %d\n",
event->event, event->mode, event->detail, event->sequence); event->event, event->mode, event->detail, event->sequence);
DLOG("coordinates %d, %d\n", event->event_x, event->event_y); 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) { 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 /* Skip events where the pointer was over a child window, we are only
* interested in events on the root window. */ * interested in events on the root window. */
if (event->child != 0) if (event->child != 0)
@ -1084,6 +1092,7 @@ void handle_event(int type, xcb_generic_event_t *event) {
case XCB_PROPERTY_NOTIFY: case XCB_PROPERTY_NOTIFY:
DLOG("Property notify\n"); DLOG("Property notify\n");
xcb_property_notify_event_t *e = (xcb_property_notify_event_t*)event; xcb_property_notify_event_t *e = (xcb_property_notify_event_t*)event;
last_timestamp = e->time;
property_notify(e->state, e->window, e->atom); property_notify(e->state, e->window, e->atom);
break; break;