[Xfce4-commits] <xfwm4:master> Do not cancel pending focus transition and use actual meaningful timestamp to avoid setting focus on wrong window in focus follow mouse (Bug #8323)

Olivier Fourdan noreply at xfce.org
Mon Jan 16 08:58:01 CET 2012


Updating branch refs/heads/master
         to 261bcc782d99f38ccc9218ea0c9461e721710e8d (commit)
       from 8491e20df9212c78bf9dd6fd0cc081120ee728af (commit)

commit 261bcc782d99f38ccc9218ea0c9461e721710e8d
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Mon Jan 16 08:52:02 2012 +0100

    Do not cancel pending focus transition and use actual meaningful timestamp to avoid setting focus on wrong window in focus follow mouse (Bug #8323)

 src/display.c |    2 +-
 src/events.c  |    2 +-
 src/focus.c   |    8 ++++----
 src/focus.h   |    3 ++-
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/display.c b/src/display.c
index 4234e29..00318d5 100644
--- a/src/display.c
+++ b/src/display.c
@@ -733,7 +733,7 @@ myDisplayUpdateCurrentTime (DisplayInfo *display, XEvent *ev)
             break;
     }
 
-    if ((timestamp == (guint32) CurrentTime) || TIMESTAMP_IS_BEFORE(display->current_time, timestamp))
+    if ((timestamp != (guint32) CurrentTime) && TIMESTAMP_IS_BEFORE(display->current_time, timestamp))
     {
         display->current_time = timestamp;
     }
diff --git a/src/events.c b/src/events.c
index 302ee26..665d4f5 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1362,7 +1362,7 @@ handleEnterNotify (DisplayInfo *display_info, XCrossingEvent * ev)
                 if(screen_info->params->focus_delay)
                 {
                     clientClearDelayedFocus ();
-                    clientAddDelayedFocus (c);
+                    clientAddDelayedFocus (c, ev->time);
                 }
                 else
                 {
diff --git a/src/focus.c b/src/focus.c
index f58807c..c3c7015 100644
--- a/src/focus.c
+++ b/src/focus.c
@@ -520,7 +520,6 @@ clientUpdateFocus (ScreenInfo *screen_info, Client * c, unsigned short flags)
         clientUpdateOpacity (c);
     }
     clientSetNetActiveWindow (screen_info, c, 0);
-    clientClearDelayedFocus ();
     pending_focus = NULL;
 }
 
@@ -747,13 +746,14 @@ delayed_focus_cb (gpointer data)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
+    guint32 timestamp = (guint32) GPOINTER_TO_INT (data);
 
     TRACE ("entering delayed_focus_cb");
     g_return_val_if_fail (delayed_focus != NULL, FALSE);
 
     screen_info = delayed_focus->screen_info;
     display_info = screen_info->display_info;
-    clientSetFocus (screen_info, delayed_focus, myDisplayGetCurrentTime (display_info), NO_FOCUS_FLAG);
+    clientSetFocus (screen_info, delayed_focus, timestamp, NO_FOCUS_FLAG);
     focus_timeout = 0;
     delayed_focus = NULL;
 
@@ -772,7 +772,7 @@ clientClearDelayedFocus (void)
 }
 
 void
-clientAddDelayedFocus (Client *c)
+clientAddDelayedFocus (Client *c, guint32 timestamp)
 {
     ScreenInfo *screen_info;
 
@@ -781,7 +781,7 @@ clientAddDelayedFocus (Client *c)
     focus_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT,
                                         screen_info->params->focus_delay,
                                         (GSourceFunc) delayed_focus_cb,
-                                        NULL, NULL);
+                                        GINT_TO_POINTER (timestamp), NULL);
 }
 
 Client *
diff --git a/src/focus.h b/src/focus.h
index 7e25277..e955049 100644
--- a/src/focus.h
+++ b/src/focus.h
@@ -78,7 +78,8 @@ void                     clientUngrabMouseButton                (Client *);
 void                     clientGrabMouseButtonForAll            (ScreenInfo *);
 void                     clientUngrabMouseButtonForAll          (ScreenInfo *);
 void                     clientClearDelayedFocus                (void);
-void                     clientAddDelayedFocus                  (Client *);
+void                     clientAddDelayedFocus                  (Client *,
+                                                                 guint32);
 Client                  *clientGetDelayedFocus                  (void);
 
 #endif /* INC_FOCUS_H */


More information about the Xfce4-commits mailing list