[Xfce4-commits] r24107 - xfwm4/trunk/src

Olivier Fourdan olivier at xfce.org
Thu Dec 14 22:49:51 CET 2006


Author: olivier
Date: 2006-12-14 21:49:51 +0000 (Thu, 14 Dec 2006)
New Revision: 24107

Modified:
   xfwm4/trunk/src/client.c
   xfwm4/trunk/src/display.c
   xfwm4/trunk/src/events.c
   xfwm4/trunk/src/focus.c
   xfwm4/trunk/src/focus.h
   xfwm4/trunk/src/hints.c
   xfwm4/trunk/src/stacking.c
Log:
Fix user focus timetamp being falsely reset to 0 causing some windows to be started un-focused (Bug #2664), re-add some traces (which compile with -Werror this time), small code/api cleanup.

Modified: xfwm4/trunk/src/client.c
===================================================================
--- xfwm4/trunk/src/client.c	2006-12-14 21:39:54 UTC (rev 24106)
+++ xfwm4/trunk/src/client.c	2006-12-14 21:49:51 UTC (rev 24107)
@@ -1761,6 +1761,9 @@
     }
     c->fullscreen_old_layer = c->win_layer;
 
+    /* net_wm_user_time standard */
+    clientGetUserTime (c);
+
     /* Apply startup notification properties if available */
     sn_client_startup_properties (c);
 
@@ -1929,9 +1932,6 @@
     wc.height = c->height;
     clientConfigure (c, &wc, CWX | CWY | CWHeight | CWWidth, CFG_NOTIFY | CFG_FORCE_REDRAW);
 
-    /* net_wm_user_time standard */
-    clientGetUserTime (c);
-
     /* Notify the compositor about this new window */
     compositorAddWindow (display_info, c->frame, c);
 
@@ -1949,7 +1949,7 @@
             }
             else
             {
-                clientFocusNew(c, myDisplayGetCurrentTime (display_info));
+                clientFocusNew(c);
                 grabbed = TRUE;
             }
         }
@@ -2349,7 +2349,7 @@
     display_info = screen_info->display_info;
 
     TRACE ("hiding client \"%s\" (0x%lx)", c->name, c->window);
-    clientPassFocus(c->screen_info, c, c, myDisplayGetCurrentTime (display_info));
+    clientPassFocus(c->screen_info, c, c);
     if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
     {
         FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_VISIBLE);

Modified: xfwm4/trunk/src/display.c
===================================================================
--- xfwm4/trunk/src/display.c	2006-12-14 21:39:54 UTC (rev 24106)
+++ xfwm4/trunk/src/display.c	2006-12-14 21:49:51 UTC (rev 24107)
@@ -709,6 +709,7 @@
 {
     g_return_val_if_fail (display != NULL, (Time) CurrentTime);
 
+    TRACE ("myDisplayGetCurrentTime gives timestamp=%u", (unsigned int) display->current_time);
     return (Time) display->current_time;
 }
 
@@ -723,6 +724,7 @@
         time = getXServerTime (display);
     }
 
+    TRACE ("myDisplayGetTime gives timestamp=%u", (unsigned int) time);
     return (time);
 }
 
@@ -731,6 +733,7 @@
 {
     g_return_val_if_fail (display != NULL, (Time) CurrentTime);
 
+    TRACE ("myDisplayGetLastUserTime gives timestamp=%u", (unsigned int) display->last_user_time);
     return (Time) display->last_user_time;
 }
 

Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c	2006-12-14 21:39:54 UTC (rev 24106)
+++ xfwm4/trunk/src/events.c	2006-12-14 21:49:51 UTC (rev 24107)
@@ -1103,7 +1103,7 @@
     if (c)
     {
         TRACE ("DestroyNotify for \"%s\" (0x%lx)", c->name, c->window);
-        clientPassFocus (c->screen_info, c, c, myDisplayGetCurrentTime (display_info));
+        clientPassFocus (c->screen_info, c, c);
         clientUnframe (c, FALSE);
     }
 }
@@ -1141,7 +1141,7 @@
         if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY) ||
             (c->win_workspace == screen_info->current_ws))
         {
-            clientFocusNew(c, myDisplayGetCurrentTime (display_info));
+            clientFocusNew(c);
         }
     }
     else
@@ -1222,7 +1222,7 @@
         if ((ev->event == screen_info->xroot) && (ev->send_event))
         {
             TRACE ("ICCCM UnmapNotify for \"%s\"", c->name);
-            clientPassFocus (screen_info, c, c, myDisplayGetCurrentTime (display_info));
+            clientPassFocus (screen_info, c, c);
             clientUnframe (c, FALSE);
             return;
         }
@@ -1237,7 +1237,7 @@
         {
             TRACE ("unmapping \"%s\" as ignore_unmap is %i",
                  c->name, c->ignore_unmap);
-            clientPassFocus (screen_info, c, c, myDisplayGetCurrentTime (display_info));
+            clientPassFocus (screen_info, c, c);
             clientUnframe (c, FALSE);
         }
     }

Modified: xfwm4/trunk/src/focus.c
===================================================================
--- xfwm4/trunk/src/focus.c	2006-12-14 21:39:54 UTC (rev 24106)
+++ xfwm4/trunk/src/focus.c	2006-12-14 21:49:51 UTC (rev 24107)
@@ -122,7 +122,7 @@
 }
 
 gboolean
-clientFocusNew(Client * c, Time timestamp)
+clientFocusNew(Client * c)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
@@ -145,7 +145,7 @@
     }
     else if ((client_focus) && (prevent_focus_stealing))
     {
-        if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STARTUP_TIME) && (c->user_time == (Time) 0))
+        if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STARTUP_TIME) && (c->user_time == (Time) CurrentTime))
         {
             TRACE ("Given startup time is 0, not focusing");
             give_focus = FALSE;
@@ -172,16 +172,16 @@
         clientRaise (c, None);
         clientShow (c, TRUE);
         clientSetFocus (screen_info, c,
-                        timestamp,
+                        myDisplayGetCurrentTime (display_info),
                         FOCUS_IGNORE_MODAL);
     }
     else
     {
         Client *c2 = clientGetFocus();
 
-        if (prevented && c2 && (c2->win_layer == c->win_layer))
+        if ((prevented) && (c2 != NULL) && (c2->win_layer == c->win_layer))
         {
-            TRACE ("clientFocusNew: Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window); 
+            TRACE ("clientFocusNew: Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window);
             FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
             clientSortRing(c);
             clientLower (c, c2->frame);
@@ -285,7 +285,7 @@
 }
 
 void
-clientPassFocus (ScreenInfo *screen_info, Client *c, Client *exclude, Time timestamp)
+clientPassFocus (ScreenInfo *screen_info, Client *c, Client *exclude)
 {
     DisplayInfo *display_info;
     ClientPair top_most;
@@ -359,7 +359,7 @@
         new_focus = top_most.prefered ? top_most.prefered : top_most.highest;
     }
     clientSetFocus (screen_info, new_focus,
-                    timestamp,
+                    myDisplayGetCurrentTime (display_info),
                     FOCUS_IGNORE_MODAL | FOCUS_FORCE);
 }
 
@@ -505,7 +505,7 @@
     c2 = ((client_focus != c) ? client_focus : NULL);
     if ((c) && FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
     {
-        TRACE ("setting focus to client \"%s\" (0x%lx)", c->name, c->window);
+        TRACE ("setting focus to client \"%s\" (0x%lx) with timestamp %u", c->name, c->window, (unsigned int) timestamp);
         user_focus = c;
         if (FLAG_TEST(c->flags, CLIENT_FLAG_DEMANDS_ATTENTION))
         {

Modified: xfwm4/trunk/src/focus.h
===================================================================
--- xfwm4/trunk/src/focus.h	2006-12-14 21:39:54 UTC (rev 24106)
+++ xfwm4/trunk/src/focus.h	2006-12-14 21:49:51 UTC (rev 24107)
@@ -40,8 +40,7 @@
 void                     clientFocusTop                         (ScreenInfo *, 
                                                                  int,
                                                                  Time);
-gboolean                 clientFocusNew                         (Client *,
-                                                                 Time);
+gboolean                 clientFocusNew                         (Client *);
 gboolean                 clientSelectMask                       (Client *, 
                                                                  int, 
                                                                  int);
@@ -51,8 +50,7 @@
                                                                  int);
 void                     clientPassFocus                        (ScreenInfo *, 
                                                                  Client *, 
-                                                                 Client *,
-                                                                 Time);
+                                                                 Client *);
 gboolean                 clientAcceptFocus                      (Client *);
 void                     clientSortRing                         (Client *);
 void                     clientUpdateFocus                      (ScreenInfo *, 

Modified: xfwm4/trunk/src/hints.c
===================================================================
--- xfwm4/trunk/src/hints.c	2006-12-14 21:39:54 UTC (rev 24106)
+++ xfwm4/trunk/src/hints.c	2006-12-14 21:49:51 UTC (rev 24107)
@@ -956,7 +956,7 @@
 
     TRACE ("entering getNetWMUserTime");
 
-    g_return_val_if_fail (window != None, None);
+    g_return_val_if_fail (window != None, FALSE);
 
     if (XGetWindowProperty (display_info->dpy, window, display_info->atoms[NET_WM_USER_TIME],
                             0L, 1L, FALSE, XA_CARDINAL, &actual_type, &actual_format, &nitems,
@@ -970,7 +970,8 @@
             return TRUE;
         }
     }
-    *time = 0L;
+    *time = (Time) 0;
+
     return FALSE;
 }
 
@@ -1214,6 +1215,7 @@
         timestamp = (Time) myDisplayUpdateCurrentTime (display_info, &xevent);
     }
 
+    TRACE ("getXServerTime gives timestamp=%u", (unsigned int) timestamp);
     return timestamp;
 }
 

Modified: xfwm4/trunk/src/stacking.c
===================================================================
--- xfwm4/trunk/src/stacking.c	2006-12-14 21:39:54 UTC (rev 24106)
+++ xfwm4/trunk/src/stacking.c	2006-12-14 21:49:51 UTC (rev 24107)
@@ -522,7 +522,7 @@
         clientApplyStackList (screen_info);
         clientSetNetClientList (screen_info, display_info->atoms[NET_CLIENT_LIST_STACKING], screen_info->windows_stack);
         clientPassGrabMouseButton (NULL);
-        clientPassFocus (screen_info, c, NULL, myDisplayGetCurrentTime (display_info));
+        clientPassFocus (screen_info, c, NULL);
         if (screen_info->last_raise == c)
         {
             screen_info->last_raise = NULL;



More information about the Xfce4-commits mailing list