dont trust the _NET_ACTIVE_WINDOW timestamp. (fixes bug #4519)
authorDana Jansens <danakj@orodu.net>
Mon, 15 Feb 2010 17:33:33 +0000 (12:33 -0500)
committerMikael Magnusson <mikachu@gmail.com>
Fri, 19 Feb 2010 20:26:38 +0000 (21:26 +0100)
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
openbox/event.c

index fd5d375f8909514d18d3965f9fc0617f26b0d1ef..cc55124069d71a542d9a1ba68dabf7b3d80352ff 100644 (file)
@@ -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);
index 7f1150fc53529f548706912b975371753d504b2e..f082cdb2aa491d26b9baf0729ff3036dec248784 100644 (file)
@@ -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 "