From 474cf33b44fdc1154aa004e4e7af2223d012af69 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 15 Feb 2010 12:33:33 -0500 Subject: [PATCH] dont trust the _NET_ACTIVE_WINDOW timestamp. (fixes bug #4519) if we decide to focus the window, do not use their provided timestamp. chromium gives a very old timestamp, which means we think we're focusing the window but it never actually gets focus, leading to inconsistent behaviour by openbox. use the timestamp for making decisions about passing focus if you want (we dont right now), but not for the XSetInputFocus call. --- openbox/client.c | 2 +- openbox/event.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/openbox/client.c b/openbox/client.c index fd5d375..cc55124 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -782,7 +782,7 @@ static gboolean client_can_steal_focus(ObClient *self, Time steal_time, /* This is focus stealing prevention */ ob_debug_type(OB_DEBUG_FOCUS, - "Want to focus new window 0x%x at time %u " + "Want to focus window 0x%x at time %u " "launched at %u (last user interaction time %u)\n", self->window, steal_time, launch_time, event_last_user_time); diff --git a/openbox/event.c b/openbox/event.c index 7f1150f..f082cdb 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1314,11 +1314,23 @@ static void event_handle_client(ObClient *client, XEvent *e) (e->xclient.data.l[0] == 2 ? "user" : "INVALID")))); /* XXX make use of data.l[2] !? */ if (e->xclient.data.l[0] == 1 || e->xclient.data.l[0] == 2) { - event_curtime = e->xclient.data.l[1]; + /* we can not trust the timestamp from applications. + e.g. chromium passes a very old timestamp. openbox thinks + the window will get focus and calls XSetInputFocus with the + (old) timestamp, which doesn't end up moving focus at all. + but the window is raised, not hilited, etc, as if it was + really going to get focus. + + so do not use this timestamp in event_curtime, as this would + be used in XSetInputFocus. + */ + /*event_curtime = e->xclient.data.l[1];*/ if (e->xclient.data.l[1] == 0) ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_ACTIVE_WINDOW message for window %s is" " missing a timestamp\n", client->title); + + event_curtime = event_get_server_time(); } else ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_ACTIVE_WINDOW message for window %s is " -- 1.9.1