Author: olivier
Date: 2009-02-23 10:06:52 +0000 (Mon, 23 Feb 2009)
New Revision: 29542

Modified:
   xfwm4/trunk/ChangeLog
   xfwm4/trunk/src/client.c
   xfwm4/trunk/src/client.h
   xfwm4/trunk/src/events.c
   xfwm4/trunk/src/focus.c
   xfwm4/trunk/src/netwm.c
   xfwm4/trunk/src/netwm.h
Log:
        * src/netwm.h, src/netwm.c, src/client.h, src/client.c, src/events.c,
          src/focus.c: Capture user time at startup, a bit of refactoring to
          avoid duplication of code (that led to this bug to remain after a
          similar fix went previously in to events.c in revision 29456).

Modified: xfwm4/trunk/ChangeLog
===================================================================
--- xfwm4/trunk/ChangeLog       2009-02-23 09:08:34 UTC (rev 29541)
+++ xfwm4/trunk/ChangeLog       2009-02-23 10:06:52 UTC (rev 29542)
@@ -1,3 +1,10 @@
+2009-02-23     olivier
+
+       * src/netwm.h, src/netwm.c, src/client.h, src/client.c, src/events.c,
+         src/focus.c: Capture user time at startup, a bit of refactoring to
+         avoid duplication of code (that led to this bug to remain after a
+         similar fix went previously in to events.c in revision 29456).
+
 2009-02-19     olivier
 
        * src/events.c: Only release events on identified key shortcut

Modified: xfwm4/trunk/src/client.c
===================================================================
--- xfwm4/trunk/src/client.c    2009-02-23 09:08:34 UTC (rev 29541)
+++ xfwm4/trunk/src/client.c    2009-02-23 10:06:52 UTC (rev 29542)
@@ -1457,61 +1457,6 @@
 }
 
 static void
-clientGetUserTime (Client * c)
-{
-    ScreenInfo *screen_info;
-    DisplayInfo *display_info;
-
-    g_return_if_fail (c != NULL);
-    g_return_if_fail (c->window != None);
-
-    screen_info = c->screen_info;
-    display_info = screen_info->display_info;
-
-    if (getNetWMUserTime (display_info, c->window, &c->user_time) && 
(c->user_time != 0))
-    {
-        FLAG_SET (c->flags, CLIENT_FLAG_HAS_USER_TIME);
-        myDisplayUpdateLastUserTime (display_info, c->user_time);
-    }
-}
-
-void
-clientAddUserTimeWin (Client * c)
-{
-    ScreenInfo *screen_info;
-    DisplayInfo *display_info;
-
-    g_return_if_fail (c != NULL);
-    g_return_if_fail (c->window != None);
-
-    screen_info = c->screen_info;
-    display_info = screen_info->display_info;
-
-    if ((c->user_time_win != None) && (c->user_time_win != c->window))
-    {
-        XSelectInput (display_info->dpy, c->user_time_win, PropertyChangeMask);
-    }
-}
-
-void
-clientRemoveUserTimeWin (Client * c)
-{
-    ScreenInfo *screen_info;
-    DisplayInfo *display_info;
-
-    g_return_if_fail (c != NULL);
-    g_return_if_fail (c->window != None);
-
-    screen_info = c->screen_info;
-    display_info = screen_info->display_info;
-
-    if ((c->user_time_win != None) && (c->user_time_win != c->window))
-    {
-        XSelectInput (display_info->dpy, c->user_time_win, NoEventMask);
-    }
-}
-
-static void
 clientUpdateIconPix (Client * c)
 {
     ScreenInfo *screen_info;

Modified: xfwm4/trunk/src/client.h
===================================================================
--- xfwm4/trunk/src/client.h    2009-02-23 09:08:34 UTC (rev 29541)
+++ xfwm4/trunk/src/client.h    2009-02-23 10:06:52 UTC (rev 29542)
@@ -339,8 +339,6 @@
 void                     clientClearLastOpTime                  (Client *);
 void                     clientUpdateWinState                   (Client *,
                                                                  
XClientMessageEvent *);
-void                     clientAddUserTimeWin                   (Client *);
-void                     clientRemoveUserTimeWin                (Client *);
 void                     clientUpdateUrgency                    (Client *);
 void                     clientCoordGravitate                   (Client *,
                                                                  int,

Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c    2009-02-23 09:08:34 UTC (rev 29541)
+++ xfwm4/trunk/src/events.c    2009-02-23 10:06:52 UTC (rev 29542)
@@ -1832,16 +1832,7 @@
         else if (ev->atom == display_info->atoms[NET_WM_USER_TIME])
         {
             TRACE ("client \"%s\" (0x%lx) has received a NET_WM_USER_TIME 
notify", c->name, c->window);
-            /*
-             * We can use "c->user_time_win" safely here because this will be
-             * the same as "c->window" if the app does not support the protocol
-             * NET_WM_USER_TIME_WINDOW
-             */
-            if (getNetWMUserTime (display_info, c->user_time_win, 
&c->user_time) && (c->user_time != 0))
-            {
-                myDisplaySetLastUserTime (display_info, c->user_time);
-                FLAG_SET (c->flags, CLIENT_FLAG_HAS_USER_TIME);
-            }
+            clientGetUserTime (c);
         }
         else if (ev->atom == display_info->atoms[NET_WM_USER_TIME_WINDOW])
         {

Modified: xfwm4/trunk/src/focus.c
===================================================================
--- xfwm4/trunk/src/focus.c     2009-02-23 09:08:34 UTC (rev 29541)
+++ xfwm4/trunk/src/focus.c     2009-02-23 10:06:52 UTC (rev 29542)
@@ -185,11 +185,11 @@
         }
         else if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STARTUP_TIME | 
CLIENT_FLAG_HAS_USER_TIME))
         {
+            TRACE ("Current time is %u, time for \"%s\" is %u",
+                   (unsigned int) client_focus->user_time,
+                   c->name, (unsigned int) c->user_time);
             if (TIMESTAMP_IS_BEFORE (c->user_time, client_focus->user_time))
             {
-                TRACE ("Current time is %u, new time is %u, not focusing 
\"%s\" \n",
-                       (unsigned int) client_focus->user_time,
-                       (unsigned int) c->user_time, c->name);
                 give_focus = FALSE;
                 prevented = TRUE;
             }

Modified: xfwm4/trunk/src/netwm.c
===================================================================
--- xfwm4/trunk/src/netwm.c     2009-02-23 09:08:34 UTC (rev 29541)
+++ xfwm4/trunk/src/netwm.c     2009-02-23 10:06:52 UTC (rev 29542)
@@ -1446,3 +1446,68 @@
                             (gpointer) c, NULL);
     return (TRUE);
 }
+
+gboolean
+clientGetUserTime (Client * c)
+{
+    ScreenInfo *screen_info;
+    DisplayInfo *display_info;
+
+    g_return_val_if_fail (c != NULL, FALSE);
+    g_return_val_if_fail (c->window != None, FALSE);
+
+    screen_info = c->screen_info;
+    display_info = screen_info->display_info;
+
+    /*
+     * We can use "c->user_time_win" safely here because this will be
+     * the same as "c->window" if the app does not support the protocol
+     * NET_WM_USER_TIME_WINDOW
+     */
+
+    if (getNetWMUserTime (display_info, c->user_time_win, &c->user_time) && 
(c->user_time != 0))
+    {
+        myDisplaySetLastUserTime (display_info, c->user_time);
+        FLAG_SET (c->flags, CLIENT_FLAG_HAS_USER_TIME);
+
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+void
+clientAddUserTimeWin (Client * c)
+{
+    ScreenInfo *screen_info;
+    DisplayInfo *display_info;
+
+    g_return_if_fail (c != NULL);
+    g_return_if_fail (c->window != None);
+
+    screen_info = c->screen_info;
+    display_info = screen_info->display_info;
+
+    if ((c->user_time_win != None) && (c->user_time_win != c->window))
+    {
+        XSelectInput (display_info->dpy, c->user_time_win, PropertyChangeMask);
+    }
+}
+
+void
+clientRemoveUserTimeWin (Client * c)
+{
+    ScreenInfo *screen_info;
+    DisplayInfo *display_info;
+
+    g_return_if_fail (c != NULL);
+    g_return_if_fail (c->window != None);
+
+    screen_info = c->screen_info;
+    display_info = screen_info->display_info;
+
+    if ((c->user_time_win != None) && (c->user_time_win != c->window))
+    {
+        XSelectInput (display_info->dpy, c->user_time_win, NoEventMask);
+    }
+}

Modified: xfwm4/trunk/src/netwm.h
===================================================================
--- xfwm4/trunk/src/netwm.h     2009-02-23 09:08:34 UTC (rev 29541)
+++ xfwm4/trunk/src/netwm.h     2009-02-23 10:06:52 UTC (rev 29542)
@@ -55,10 +55,13 @@
 void                     clientSetNetActiveWindow               (ScreenInfo *,
                                                                  Client *,
                                                                  guint32);
-void                    clientRemoveNetWMPing                   (Client *);
-gboolean                clientSendNetWMPing                     (Client *,
+void                     clientRemoveNetWMPing                  (Client *);
+gboolean                 clientSendNetWMPing                    (Client *,
                                                                  guint32);
-void                    clientReceiveNetWMPong                  (ScreenInfo *,
+void                     clientReceiveNetWMPong                 (ScreenInfo *,
                                                                  guint32);
+gboolean                 clientGetUserTime                      (Client *);
+void                     clientAddUserTimeWin                   (Client *);
+void                     clientRemoveUserTimeWin                (Client *);
 
 #endif /* INC_NETWM_H */

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to