[Xfce4-commits] <xfwm4:xfce-4.8> 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:04 CET 2012


Updating branch refs/heads/xfce-4.8
         to dd04ae1a11c8cf4b8ce7a7a9b86f8b90f90a39c7 (commit)
       from e3004318c9473ec9f37060ab7135284b6dd686f3 (commit)

commit dd04ae1a11c8cf4b8ce7a7a9b86f8b90f90a39c7
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 d370f26..e4fed05 100644
--- a/src/display.c
+++ b/src/display.c
@@ -731,7 +731,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 14bf512..ecb0446 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1368,7 +1368,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 f2f901d..0e78636 100644
--- a/src/focus.c
+++ b/src/focus.c
@@ -537,7 +537,6 @@ clientUpdateFocus (ScreenInfo *screen_info, Client * c, unsigned short flags)
         clientUpdateOpacity (c2);
     }
     clientSetNetActiveWindow (screen_info, c, 0);
-    clientClearDelayedFocus ();
     pending_focus = NULL;
 }
 
@@ -807,13 +806,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;
 
@@ -832,7 +832,7 @@ clientClearDelayedFocus (void)
 }
 
 void
-clientAddDelayedFocus (Client *c)
+clientAddDelayedFocus (Client *c, guint32 timestamp)
 {
     ScreenInfo *screen_info;
 
@@ -841,7 +841,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 620c63e..6874ead 100644
--- a/src/focus.h
+++ b/src/focus.h
@@ -81,7 +81,8 @@ void                     clientPassGrabMouseButton              (Client *);
 Client                  *clientGetLastUngrab                    (void);
 void                     clientClearLastUngrab                  (void);
 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