From: Dana Jansens Date: Mon, 15 Feb 2010 17:33:33 +0000 (-0500) Subject: dont trust the _NET_ACTIVE_WINDOW timestamp. (fixes bug #4519) X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=343ca097f7321983e62cac14791d62e1331d8d87;p=chaz%2Fopenbox 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. --- diff --git a/openbox/client.c b/openbox/client.c index 968a4585..08ce6f37 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -722,7 +722,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)", self->window, steal_time, launch_time, event_last_user_time); diff --git a/openbox/event.c b/openbox/event.c index f466234b..14aa696b 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1357,11 +1357,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", client->title); + + event_curtime = event_get_server_time(); } else ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_ACTIVE_WINDOW message for window %s is "