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

Olivier Fourdan olivier at xfce.org
Wed Dec 13 21:15:19 CET 2006


Author: olivier
Date: 2006-12-13 20:15:19 +0000 (Wed, 13 Dec 2006)
New Revision: 24096

Modified:
   xfwm4/trunk/src/client.c
   xfwm4/trunk/src/display.c
   xfwm4/trunk/src/display.h
   xfwm4/trunk/src/events.c
   xfwm4/trunk/src/focus.c
   xfwm4/trunk/src/focus.h
   xfwm4/trunk/src/hints.c
   xfwm4/trunk/src/main.c
   xfwm4/trunk/src/screen.c
   xfwm4/trunk/src/screen.h
   xfwm4/trunk/src/stacking.c
   xfwm4/trunk/src/workspaces.c
   xfwm4/trunk/src/workspaces.h
Log:
Use timestamp provided by NET_ACTIVE_WINDOW and NET_CURRENT_DESKTOP messages from EWMH version 1.3 and above, fix focus transition with NET_CURRENT_DESKTOP messages causing either flickering or wrong restacking on workspace switch (bug #2654), fix serious bug introduced with previous commit causing xfwm4 to quit on any selection MESSAGE notify.

Modified: xfwm4/trunk/src/client.c
===================================================================
--- xfwm4/trunk/src/client.c	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/client.c	2006-12-13 20:15:19 UTC (rev 24096)
@@ -1952,7 +1952,7 @@
             }
             else
             {
-                clientFocusNew(c);
+                clientFocusNew(c, myDisplayGetCurrentTime (display_info));
                 grabbed = TRUE;
             }
         }
@@ -2123,7 +2123,7 @@
     {
         XFree (wins);
     }
-    clientFocusTop (screen_info, WIN_LAYER_NORMAL);
+    clientFocusTop (screen_info, WIN_LAYER_NORMAL, myDisplayGetCurrentTime (display_info));
     xfwmWindowDelete (&shield);
     myDisplayUngrabServer (display_info);
     XSync (display_info->dpy, FALSE);
@@ -2352,7 +2352,7 @@
     display_info = screen_info->display_info;
 
     TRACE ("hiding client \"%s\" (0x%lx)", c->name, c->window);
-    clientPassFocus(c->screen_info, c, c);
+    clientPassFocus(c->screen_info, c, c, myDisplayGetCurrentTime (display_info));
     if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
     {
         FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_VISIBLE);
@@ -2481,7 +2481,7 @@
                 clientHide (c, c->win_workspace, TRUE);
             }
         }
-        clientFocusTop (screen_info, WIN_LAYER_DESKTOP);
+        clientFocusTop (screen_info, WIN_LAYER_DESKTOP, myDisplayGetCurrentTime (screen_info->display_info));
     }
     else
     {
@@ -2494,7 +2494,7 @@
             }
             FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN);
         }
-        clientFocusTop (screen_info, WIN_LAYER_NORMAL);
+        clientFocusTop (screen_info, WIN_LAYER_NORMAL, myDisplayGetCurrentTime (screen_info->display_info));
     }
 }
 
@@ -3534,14 +3534,14 @@
 
                 if (edge & CLIENT_CONSTRAINED_TOP)
                 {
-                    if (workspaceMove (screen_info, -1, 0, c))
+                    if (workspaceMove (screen_info, -1, 0, c, xevent->xkey.time))
                     {
                         c->y = maxy + maxh;
                     }
                 }
                 else if (edge & CLIENT_CONSTRAINED_BOTTOM)
                 {
-                    if (workspaceMove (screen_info, 1, 0, c))
+                    if (workspaceMove (screen_info, 1, 0, c, xevent->xkey.time))
                     {
                         c->y = maxy + frameTop (c);
                     }
@@ -3549,14 +3549,14 @@
 
                 if (edge & CLIENT_CONSTRAINED_LEFT)
                 {
-                    if (workspaceMove (screen_info, 0, -1, c))
+                    if (workspaceMove (screen_info, 0, -1, c, xevent->xkey.time))
                     {
                         c->x = maxx + maxw - frameWidth (c) + frameRight (c);
                     }
                 }
                 else if (edge & CLIENT_CONSTRAINED_RIGHT)
                 {
-                    if (workspaceMove (screen_info, 0, 1, c))
+                    if (workspaceMove (screen_info, 0, 1, c, xevent->xkey.time))
                     {
                         c->x = maxx + frameLeft (c);
                     }
@@ -3607,7 +3607,7 @@
             }
             if (screen_info->current_ws != passdata->cancel_workspace)
             {
-                workspaceSwitch (screen_info, passdata->cancel_workspace, c, FALSE);
+                workspaceSwitch (screen_info, passdata->cancel_workspace, c, FALSE, xevent->xkey.time);
             }
             if (toggled_maximize)
             {
@@ -3715,14 +3715,14 @@
                     {
                         if (msx == 0)
                         {
-                            if (workspaceMove (screen_info, 0, -1, c))
+                            if (workspaceMove (screen_info, 0, -1, c, xevent->xmotion.time))
                             {
                                 rx = 4 * maxx / 5;
                             }
                         }
                         else
                         {
-                            if (workspaceMove (screen_info, 0, 1, c))
+                            if (workspaceMove (screen_info, 0, 1, c, xevent->xmotion.time))
                             {
                                 rx = -4 * maxx / 5;
                             }
@@ -3738,14 +3738,14 @@
                     {
                         if (msy == 0)
                         {
-                            if (workspaceMove (screen_info, -1, 0, c))
+                            if (workspaceMove (screen_info, -1, 0, c, xevent->xmotion.time))
                             {
                                 ry = 4 * maxy / 5;
                             }
                         }
                         else
                         {
-                            if (workspaceMove (screen_info, 1, 0, c))
+                            if (workspaceMove (screen_info, 1, 0, c, xevent->xmotion.time))
                             {
                                 ry = -4 * maxy / 5;
                             }
@@ -4772,7 +4772,7 @@
 
         if (workspace != screen_info->current_ws)
         {
-            workspaceSwitch (screen_info, workspace, c, FALSE);
+            workspaceSwitch (screen_info, workspace, c, FALSE, myDisplayGetCurrentTime (display_info));
         }
 
         if ((focused) && (passdata.c != focused))

Modified: xfwm4/trunk/src/display.c
===================================================================
--- xfwm4/trunk/src/display.c	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/display.c	2006-12-13 20:15:19 UTC (rev 24096)
@@ -708,14 +708,31 @@
 {
     g_return_val_if_fail (display != NULL, (Time) CurrentTime);
 
+    TRACE ("myDisplayGetCurrentTime gives timestamp=%u", display->current_time);
     return (Time) display->current_time;
 }
 
 Time
+myDisplayGetTime (DisplayInfo * display, Time timestamp)
+{
+    Time time;
+
+    time = timestamp;
+    if (time == (Time) CurrentTime)
+    {
+        time = getXServerTime (display);
+    }
+
+    TRACE ("myDisplayGetTime gives timestamp=%u", time);
+    return (time);
+}
+
+Time
 myDisplayGetLastUserTime (DisplayInfo *display)
 {
     g_return_val_if_fail (display != NULL, (Time) CurrentTime);
 
+    TRACE ("myDisplayGetLastUserTime gives timestamp=%u", display->last_user_time);
     return (Time) display->last_user_time;
 }
 

Modified: xfwm4/trunk/src/display.h
===================================================================
--- xfwm4/trunk/src/display.h	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/display.h	2006-12-13 20:15:19 UTC (rev 24096)
@@ -331,6 +331,8 @@
 Time                     myDisplayUpdateCurrentTime             (DisplayInfo *,
                                                                  XEvent *);
 Time                     myDisplayGetCurrentTime                (DisplayInfo *);
+Time                     myDisplayGetTime                       (DisplayInfo *, 
+                                                                 Time);
 Time                     myDisplayGetLastUserTime               (DisplayInfo *);
 void                     myDisplaySetLastUserTime               (DisplayInfo *,
                                                                  Time);

Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/events.c	2006-12-13 20:15:19 UTC (rev 24096)
@@ -259,7 +259,7 @@
 static gboolean
 check_button_time (XButtonEvent *ev)
 {
-    static Time last_button_time = (Time) 0;
+    static Time last_button_time = (Time) CurrentTime;
 
     if (last_button_time > ev->time)
     {
@@ -445,22 +445,22 @@
                 clientToggleFullscreen (c);
                 break;
             case KEY_MOVE_NEXT_WORKSPACE:
-                workspaceSwitch (screen_info, screen_info->current_ws + 1, c, TRUE);
+                workspaceSwitch (screen_info, screen_info->current_ws + 1, c, TRUE, ev->time);
                 break;
             case KEY_MOVE_PREV_WORKSPACE:
-                workspaceSwitch (screen_info, screen_info->current_ws - 1, c, TRUE);
+                workspaceSwitch (screen_info, screen_info->current_ws - 1, c, TRUE, ev->time);
                 break;
             case KEY_MOVE_UP_WORKSPACE:
-                workspaceMove (screen_info, -1, 0, c);
+                workspaceMove (screen_info, -1, 0, c, ev->time);
                 break;
             case KEY_MOVE_DOWN_WORKSPACE:
-                workspaceMove (screen_info, 1, 0, c);
+                workspaceMove (screen_info, 1, 0, c, ev->time);
                 break;
             case KEY_MOVE_LEFT_WORKSPACE:
-                workspaceMove (screen_info, 0, -1, c);
+                workspaceMove (screen_info, 0, -1, c, ev->time);
                 break;
             case KEY_MOVE_RIGHT_WORKSPACE:
-                workspaceMove (screen_info, 0, 1, c);
+                workspaceMove (screen_info, 0, 1, c, ev->time);
                 break;
             case KEY_MOVE_WORKSPACE_1:
             case KEY_MOVE_WORKSPACE_2:
@@ -477,7 +477,7 @@
                 if (key - KEY_MOVE_WORKSPACE_1 < screen_info->workspace_count)
                 {
                     clientRaise (c, None);
-                    workspaceSwitch (screen_info, key - KEY_MOVE_WORKSPACE_1, c, TRUE);
+                    workspaceSwitch (screen_info, key - KEY_MOVE_WORKSPACE_1, c, TRUE, ev->time);
                 }
                 break;
             case KEY_POPUP_MENU:
@@ -531,22 +531,22 @@
     switch (key)
     {
         case KEY_NEXT_WORKSPACE:
-            workspaceSwitch (screen_info, screen_info->current_ws + 1, NULL, TRUE);
+            workspaceSwitch (screen_info, screen_info->current_ws + 1, NULL, TRUE, ev->time);
             break;
         case KEY_PREV_WORKSPACE:
-            workspaceSwitch (screen_info, screen_info->current_ws - 1, NULL, TRUE);
+            workspaceSwitch (screen_info, screen_info->current_ws - 1, NULL, TRUE, ev->time);
             break;
         case KEY_UP_WORKSPACE:
-            workspaceMove(screen_info, -1, 0, NULL);
+            workspaceMove(screen_info, -1, 0, NULL, ev->time);
             break;
         case KEY_DOWN_WORKSPACE:
-            workspaceMove(screen_info, 1, 0, NULL);
+            workspaceMove(screen_info, 1, 0, NULL, ev->time);
             break;
         case KEY_LEFT_WORKSPACE:
-            workspaceMove(screen_info, 0, -1, NULL);
+            workspaceMove(screen_info, 0, -1, NULL, ev->time);
             break;
         case KEY_RIGHT_WORKSPACE:
-            workspaceMove(screen_info, 0, 1, NULL);
+            workspaceMove(screen_info, 0, 1, NULL, ev->time);
             break;
         case KEY_ADD_WORKSPACE:
             workspaceSetCount (screen_info, screen_info->workspace_count + 1);
@@ -568,7 +568,7 @@
         case KEY_WORKSPACE_12:
             if (key - KEY_WORKSPACE_1 < screen_info->workspace_count)
             {
-                workspaceSwitch (screen_info, key - KEY_WORKSPACE_1, NULL, TRUE);
+                workspaceSwitch (screen_info, key - KEY_WORKSPACE_1, NULL, TRUE, ev->time);
             }
             break;
         case KEY_SHOW_DESKTOP:
@@ -768,7 +768,7 @@
 static void
 rootScrollButton (DisplayInfo *display_info, XButtonEvent * ev)
 {
-    static Time lastscroll = (Time) 0;
+    static Time lastscroll = (Time) CurrentTime;
     ScreenInfo *screen_info;
 
     if ((ev->time - lastscroll) < 25)  /* ms */
@@ -787,11 +787,11 @@
 
     if (ev->button == Button4)
     {
-        workspaceSwitch (screen_info, screen_info->current_ws - 1, NULL, TRUE);
+        workspaceSwitch (screen_info, screen_info->current_ws - 1, NULL, TRUE, ev->time);
     }
     else if (ev->button == Button5)
     {
-        workspaceSwitch (screen_info, screen_info->current_ws + 1, NULL, TRUE);
+        workspaceSwitch (screen_info, screen_info->current_ws + 1, NULL, TRUE, ev->time);
     }
 }
 
@@ -1104,7 +1104,7 @@
     if (c)
     {
         TRACE ("DestroyNotify for \"%s\" (0x%lx)", c->name, c->window);
-        clientPassFocus (c->screen_info, c, c);
+        clientPassFocus (c->screen_info, c, c, myDisplayGetCurrentTime (display_info));
         clientUnframe (c, FALSE);
     }
 }
@@ -1142,7 +1142,7 @@
         if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY) ||
             (c->win_workspace == screen_info->current_ws))
         {
-            clientFocusNew(c);
+            clientFocusNew(c, myDisplayGetCurrentTime (display_info));
         }
     }
     else
@@ -1223,7 +1223,7 @@
         if ((ev->event == screen_info->xroot) && (ev->send_event))
         {
             TRACE ("ICCCM UnmapNotify for \"%s\"", c->name);
-            clientPassFocus (screen_info, c, c);
+            clientPassFocus (screen_info, c, c, myDisplayGetCurrentTime (display_info));
             clientUnframe (c, FALSE);
             return;
         }
@@ -1238,7 +1238,7 @@
         {
             TRACE ("unmapping \"%s\" as ignore_unmap is %i",
                  c->name, c->ignore_unmap);
-            clientPassFocus (screen_info, c, c);
+            clientPassFocus (screen_info, c, c, myDisplayGetCurrentTime (display_info));
             clientUnframe (c, FALSE);
         }
     }
@@ -1418,6 +1418,7 @@
             }
             constrained = TRUE;
         }
+
         /* 
            Let's say that if the client performs a XRaiseWindow, we show the window if focus 
            stealing prevention is not activated, otherwise we just set the "demands attention"
@@ -1425,21 +1426,25 @@
          */
         if ((ev->value_mask & CWStackMode) && (wc.stack_mode == Above) && (wc.sibling == None))
         {
-            ev->value_mask &= ~CWStackMode;
-            if (c != clientGetLastRaise (screen_info))
+            Client *last_raised;
+            
+            last_raised = clientGetLastRaise (screen_info);
+            if (last_raised && (c != last_raised))
             {
                 if (screen_info->params->prevent_focus_stealing)
                 {
+                    ev->value_mask &= ~CWStackMode;
                     TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window); 
                     FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
                     clientSetNetState (c);
                 }
                 else
                 {
-                    clientActivate (c, myDisplayGetCurrentTime(display_info));
+                    clientActivate (c, getXServerTime (display_info));
                 }
             }
         }
+
         clientConfigure (c, &wc, ev->value_mask, (constrained ? CFG_CONSTRAINED : 0) | CFG_REQUEST);
     }
     else
@@ -1452,7 +1457,7 @@
 static void
 handleEnterNotify (DisplayInfo *display_info, XCrossingEvent * ev)
 {
-    static Time lastresist = (Time) 0;
+    static Time lastresist = (Time) CurrentTime;
     ScreenInfo *screen_info;
     Client *c;
     gboolean warp_pointer;
@@ -1567,14 +1572,14 @@
             edge_scroll_x = 0;
             if (msx == 0)
             {
-                if (workspaceMove (screen_info, 0, -1, NULL))
+                if (workspaceMove (screen_info, 0, -1, NULL, ev->time))
                 {
                     rx = 4 * maxx / 5;
                 }
             }
             else
             {
-                if (workspaceMove (screen_info, 0, 1, NULL))
+                if (workspaceMove (screen_info, 0, 1, NULL, ev->time))
                 {
                     rx = -4 * maxx / 5;
                 }
@@ -1586,14 +1591,14 @@
             edge_scroll_y = 0;
             if (msy == 0)
             {
-                if (workspaceMove (screen_info, -1, 0, NULL))
+                if (workspaceMove (screen_info, -1, 0, NULL, ev->time))
                 {
                     ry = 4 * maxy / 5;
                 }
             }
             else
             {
-                if (workspaceMove (screen_info, 1, 0, NULL))
+                if (workspaceMove (screen_info, 1, 0, NULL, ev->time))
                 {
                     ry = -4 * maxy / 5;
                 }
@@ -1673,14 +1678,11 @@
         clientSetFocus (screen_info, c, getXServerTime (display_info), FOCUS_FORCE);
         return;
     }
-
-    if ((ev->mode == NotifyGrab) || (ev->mode == NotifyUngrab) ||
-             (ev->detail > NotifyNonlinearVirtual))
+    if ((ev->mode == NotifyGrab) || (ev->mode == NotifyUngrab))
     {
         /* We're not interested in such notifications */
         return;
     }
-
     c = myDisplayGetClientFromWindow (display_info, ev->window, ANY);
     user_focus = clientGetUserFocus ();
     current_focus = clientGetFocus ();
@@ -1688,7 +1690,7 @@
     TRACE ("FocusIn on window (0x%lx)", ev->window);
     if ((c) && (c != current_focus))
     {
-        TRACE ("focus set to \"%s\" (0x%lx)", c->name, c->window);
+        TRACE ("Focus transfered to \"%s\" (0x%lx)", c->name, c->window);
 
         screen_info = c->screen_info;
 
@@ -1706,15 +1708,16 @@
              */
             if (screen_info->params->prevent_focus_stealing)
             {
+                TRACE ("Setting focus back to \"%s\" (0x%lx)", user_focus->name, user_focus->window); 
+                clientSetFocus (user_focus->screen_info, user_focus, getXServerTime (display_info), NO_FOCUS_FLAG);
+            }
+
+            if (current_focus)
+            {
                 TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window); 
                 FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
                 clientSetNetState (c);
-                clientSetFocus (user_focus->screen_info, user_focus, getXServerTime (display_info), NO_FOCUS_FLAG);
             }
-            else
-            {
-                clientRaise (c, None);
-            }
         }
 
         if (screen_info->params->raise_on_focus)
@@ -1758,6 +1761,14 @@
                 (ev->detail == NotifyDetailNone) ?
                 "NotifyDetailNone" :
                 "(unknown)");
+
+    if ((ev->mode == NotifyGrab) || (ev->mode == NotifyUngrab) || 
+        (ev->detail == NotifyInferior) || (ev->detail > NotifyNonlinearVirtual))
+    {
+        /* We're not interested in such notifications */
+        return;
+    }
+
     if ((ev->mode == NotifyNormal)
         && ((ev->detail == NotifyNonlinear)
             || (ev->detail == NotifyNonlinearVirtual)))
@@ -1807,7 +1818,7 @@
         }
         else if (ev->atom == display_info->atoms[MOTIF_WM_HINTS])
         {
-            TRACE ("client \"%s\" (0x%lx) has received a motif_wm_hints notify", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a MOTIF_WM_HINTS notify", c->name, c->window);
             clientGetMWMHints (c, TRUE);
         }
         else if (ev->atom == XA_WM_HINTS)
@@ -1838,14 +1849,14 @@
         }
         else if (ev->atom == display_info->atoms[WM_PROTOCOLS])
         {
-            TRACE ("client \"%s\" (0x%lx) has received a wm_protocols notify", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a WM_PROTOCOLS notify", c->name, c->window);
             clientGetWMProtocols (c);
         }
         else if (ev->atom == display_info->atoms[WM_TRANSIENT_FOR])
         {
             Window w;
 
-            TRACE ("client \"%s\" (0x%lx) has received a wm_transient_for notify", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a WM_TRANSIENT_FOR notify", c->name, c->window);
             getTransientFor (display_info, c->screen_info->xroot, c->window, &w);
             if (clientCheckTransientWindow (c, w))
             {
@@ -1873,19 +1884,19 @@
         }
         else if (ev->atom == display_info->atoms[WIN_HINTS])
         {
-            TRACE ("client \"%s\" (0x%lx) has received a win_hints notify", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a WIN_HINTS notify", c->name, c->window);
             getHint (display_info, c->window, WIN_HINTS, (long *) &c->win_hints);
         }
         else if (ev->atom == display_info->atoms[NET_WM_WINDOW_TYPE])
         {
-            TRACE ("client \"%s\" (0x%lx) has received a net_wm_window_type notify", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a NET_WM_WINDOW_TYPE notify", c->name, c->window);
             clientGetNetWmType (c);
             frameDraw (c, TRUE);
         }
         else if ((ev->atom == display_info->atoms[NET_WM_STRUT]) ||
                  (ev->atom == display_info->atoms[NET_WM_STRUT_PARTIAL]))
         {
-            TRACE ("client \"%s\" (0x%lx) has received a net_wm_strut notify", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a NET_WM_STRUT notify", c->name, c->window);
             if (clientGetNetStruts (c) && FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
             {
                 workspaceUpdateArea (c->screen_info);
@@ -1893,7 +1904,7 @@
         }
         else if (ev->atom == display_info->atoms[WM_COLORMAP_WINDOWS])
         {
-            TRACE ("client \"%s\" (0x%lx) has received a wm_colormap_windows notify", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a WM_COLORMAP_WINDOWS notify", c->name, c->window);
             clientUpdateColormaps (c);
             if (c == clientGetFocus ())
             {
@@ -1902,7 +1913,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);
+            TRACE ("client \"%s\" (0x%lx) has received a NET_WM_USER_TIME notify", c->name, c->window);
             if (getNetWMUserTime (display_info, c->window, &c->user_time))
             {
                 myDisplaySetLastUserTime (display_info, c->user_time);
@@ -1911,7 +1922,7 @@
         }
         else if (ev->atom == display_info->atoms[NET_WM_WINDOW_OPACITY])
         {
-            TRACE ("client \"%s\" (0x%lx) has received a net_wm_opacity notify", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a NET_WM_OPACITY notify", c->name, c->window);
             if (!getOpacity (display_info, c->window, &c->opacity))
             {
                 c->opacity =  NET_WM_OPAQUE;
@@ -1920,7 +1931,7 @@
         }
         else if (ev->atom == display_info->atoms[NET_WM_WINDOW_OPACITY_LOCKED])
         {
-            TRACE ("client \"%s\" (0x%lx) has received a net_wm_opacity_locked notify", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a NET_WM_OPACITY_LOCKED notify", c->name, c->window);
             c->opacity_locked = getOpacityLock (display_info, c->window);
         }
         else if ((screen_info->params->show_app_icon) &&
@@ -1963,7 +1974,7 @@
         gchar **names;
         int items;
 
-        TRACE ("root has received a net_desktop_names notify");
+        TRACE ("root has received a NET_DESKTOP_NAMES notify");
         if (getUTF8StringList (display_info, screen_info->xroot, NET_DESKTOP_NAMES, &names, &items))
         {
             workspaceSetNames (screen_info, names, items);
@@ -1971,13 +1982,13 @@
     }
     else if (ev->atom == display_info->atoms[GNOME_PANEL_DESKTOP_AREA])
     {
-        TRACE ("root has received a gnome_panel_desktop_area notify");
+        TRACE ("root has received a GNOME_PANEL_DESKTOP_AREA notify");
         getGnomeDesktopMargins (display_info, screen_info->xroot, screen_info->gnome_margins);
         workspaceUpdateArea (screen_info);
     }
     else if (ev->atom == display_info->atoms[NET_DESKTOP_LAYOUT])
     {
-        TRACE ("root has received a net_desktop_layout notify");
+        TRACE ("root has received a NET_DESKTOP_LAYOUT notify");
         getDesktopLayout(display_info, screen_info->xroot, screen_info->workspace_count, &screen_info->desktop_layout);
         placeSidewalks(screen_info, screen_info->params->wrap_workspaces);
     }
@@ -2000,20 +2011,20 @@
 
         if ((ev->message_type == display_info->atoms[WM_CHANGE_STATE]) && (ev->format == 32) && (ev->data.l[0] == IconicState))
         {
-            TRACE ("client \"%s\" (0x%lx) has received a wm_change_state event", c->name, c->window);
-            if (!FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED) &&  CLIENT_CAN_HIDE_WINDOW (c))
+            TRACE ("client \"%s\" (0x%lx) has received a WM_CHANGE_STATE event", c->name, c->window);
+            if (!FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED) && CLIENT_CAN_HIDE_WINDOW (c))
             {
                 clientHide (c, c->win_workspace, TRUE);
             }
         }
         else if ((ev->message_type == display_info->atoms[WIN_STATE]) && (ev->format == 32))
         {
-            TRACE ("client \"%s\" (0x%lx) has received a win_state event", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a WIN_STATE event", c->name, c->window);
             clientUpdateWinState (c, ev);
         }
         else if ((ev->message_type == display_info->atoms[WIN_LAYER]) && (ev->format == 32))
         {
-            TRACE ("client \"%s\" (0x%lx) has received a win_layer event", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a WIN_LAYER event", c->name, c->window);
             if ((ev->data.l[0] != c->win_layer) && !is_transient)
             {
                 clientSetLayer (c, ev->data.l[0]);
@@ -2021,7 +2032,7 @@
         }
         else if ((ev->message_type == display_info->atoms[WIN_WORKSPACE]) && (ev->format == 32))
         {
-            TRACE ("client \"%s\" (0x%lx) has received a win_workspace event", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a WIN_WORKSPACE event", c->name, c->window);
             if ((ev->data.l[0] != c->win_workspace) && !is_transient)
             {
                 clientSetWorkspace (c, ev->data.l[0], TRUE);
@@ -2029,7 +2040,7 @@
         }
         else if ((ev->message_type == display_info->atoms[NET_WM_DESKTOP]) && (ev->format == 32))
         {
-            TRACE ("client \"%s\" (0x%lx) has received a net_wm_desktop event", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a NET_WM_DESKTOP event", c->name, c->window);
             if (!is_transient)
             {
                 if (ev->data.l[0] == ALL_WORKSPACES)
@@ -2056,30 +2067,33 @@
         }
         else if ((ev->message_type == display_info->atoms[NET_CLOSE_WINDOW]) && (ev->format == 32))
         {
-            TRACE ("client \"%s\" (0x%lx) has received a net_close_window event", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a NET_CLOSE_WINDOW event", c->name, c->window);
             clientClose (c);
         }
         else if ((ev->message_type == display_info->atoms[NET_WM_STATE]) && (ev->format == 32))
         {
-            TRACE ("client \"%s\" (0x%lx) has received a net_wm_state event", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a NET_WM_STATE event", c->name, c->window);
             clientUpdateNetState (c, ev);
         }
         else if ((ev->message_type == display_info->atoms[NET_WM_MOVERESIZE]) && (ev->format == 32))
         {
-            TRACE ("client \"%s\" (0x%lx) has received a net_wm_moveresize event", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a NET_WM_MOVERESIZE event", c->name, c->window);
             clientNetMoveResize (c, ev);
         }
         else if ((ev->message_type == display_info->atoms[NET_ACTIVE_WINDOW]) && (ev->format == 32))
         {
-            TRACE ("client \"%s\" (0x%lx) has received a net_active_window event", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a NET_ACTIVE_WINDOW event", c->name, c->window);
             if (ev->data.l[0] != 0)
             {
-                Time current = myDisplayGetLastUserTime (screen_info->display_info);
+                Time current = myDisplayGetLastUserTime (display_info);
                 Time ev_time = (Time) ev->data.l[1];
 
                 TRACE ("Time of event received is %u, current XServer time is %u", (unsigned int) ev_time, (unsigned int) current);
-                if ((screen_info->params->prevent_focus_stealing) && (ev_time != (Time) 0) && TIMESTAMP_IS_BEFORE(ev_time, current))
+                if ((screen_info->params->prevent_focus_stealing) &&
+                    (ev_time != (Time) CurrentTime) && 
+                    TIMESTAMP_IS_BEFORE(ev_time, current))
                 {
+                    TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window); 
                     FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
                     clientSetNetState (c);
                 }
@@ -2090,12 +2104,12 @@
             }
             else
             {
-                clientActivate (c, myDisplayGetCurrentTime (screen_info->display_info));
+                clientActivate (c, getXServerTime (display_info));
             }
         }
         else if (ev->message_type == display_info->atoms[NET_REQUEST_FRAME_EXTENTS])
         {
-            TRACE ("client \"%s\" (0x%lx) has received a net_request_frame_extents event", c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) has received a NET_REQUEST_FRAME_EXTENTS event", c->name, c->window);
             setNetFrameExtents (display_info, c->window, frameTop (c), frameLeft (c),
                                                          frameRight (c), frameBottom (c));
         }
@@ -2111,10 +2125,16 @@
         if (((ev->message_type == display_info->atoms[WIN_WORKSPACE]) ||
              (ev->message_type == display_info->atoms[NET_CURRENT_DESKTOP])) && (ev->format == 32))
         {
-            TRACE ("root has received a win_workspace or a net_current_desktop event %li", ev->data.l[0]);
-            if ((ev->data.l[0] >= 0) && (ev->data.l[0] < screen_info->workspace_count) && (ev->data.l[0] != screen_info->current_ws))
+            TRACE ("root has received a win_workspace or a NET_CURRENT_DESKTOP event %li", ev->data.l[0]);
+            if ((ev->data.l[0] >= 0) && (ev->data.l[0] < screen_info->workspace_count) && 
+                (ev->data.l[0] != screen_info->current_ws))
             {
-                workspaceSwitch (screen_info, ev->data.l[0], NULL, TRUE);
+                Time ev_time = (Time) ev->data.l[1];
+                if (ev_time == (Time) CurrentTime)
+                {
+                    ev_time = getXServerTime (display_info);
+                }
+                workspaceSwitch (screen_info, ev->data.l[0], NULL, TRUE, ev_time);
             }
         }
         else if (((ev->message_type == display_info->atoms[WIN_WORKSPACE_COUNT]) ||
@@ -2127,23 +2147,16 @@
                 getDesktopLayout(display_info, screen_info->xroot, screen_info->workspace_count, &screen_info->desktop_layout);
             }
         }
-#ifdef ENABLE_KDE_SYSTRAY_PROXY
-        else if ((ev->message_type == display_info->atoms[MANAGER]) && (ev->data.l[1] == screen_info->net_system_tray_selection) && (ev->format == 32))
-        {
-            TRACE ("root has received a net_system_tray_manager event");
-            screen_info->systray = getSystrayWindow (display_info, screen_info->net_system_tray_selection);
-        }
-#endif
         else if ((ev->message_type == display_info->atoms[NET_SHOWING_DESKTOP]) && (ev->format == 32))
         {
-            TRACE ("root has received a net_showing_desktop event");
+            TRACE ("root has received a NET_SHOWING_DESKTOP event");
             screen_info->show_desktop = (ev->data.l[0] != 0);
             clientToggleShowDesktop (screen_info);
             setHint (display_info, screen_info->xroot, NET_SHOWING_DESKTOP, ev->data.l[0]);
         }
         else if (ev->message_type == display_info->atoms[NET_REQUEST_FRAME_EXTENTS])
         {
-            TRACE ("window (0x%lx) has received a net_request_frame_extents event", ev->window);
+            TRACE ("window (0x%lx) has received a NET_REQUEST_FRAME_EXTENTS event", ev->window);
             /* Size estimate from the decoration extents */
             setNetFrameExtents (display_info, ev->window,
                                 frameDecorationTop (screen_info),
@@ -2151,10 +2164,26 @@
                                 frameDecorationRight (screen_info),
                                 frameDecorationBottom (screen_info));
         }
-        else if (ev->message_type == display_info->atoms[MANAGER])
+        else if ((ev->message_type == display_info->atoms[MANAGER]) && (ev->format == 32))
         {
-            TRACE ("window (0x%lx) has received a manager event", ev->window);
-            display_info->quit = TRUE;
+            Atom selection;
+            
+            TRACE ("window (0x%lx) has received a MANAGER event", ev->window);
+            selection = (Atom) ev->data.l[1];
+            
+#ifdef ENABLE_KDE_SYSTRAY_PROXY
+            if (selection == screen_info->net_system_tray_selection)
+            {
+                TRACE ("root has received a NET_SYSTEM_TRAY_MANAGER selection event");
+                screen_info->systray = getSystrayWindow (display_info, screen_info->net_system_tray_selection);
+            }
+            else
+#endif
+            if (myScreenCheckWMAtom (screen_info, selection))
+            {
+                TRACE ("root has received a WM_Sn selection event");
+                display_info->quit = TRUE;
+            }
         }
         else
         {

Modified: xfwm4/trunk/src/focus.c
===================================================================
--- xfwm4/trunk/src/focus.c	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/focus.c	2006-12-13 20:15:19 UTC (rev 24096)
@@ -103,7 +103,7 @@
 }
 
 void
-clientFocusTop (ScreenInfo *screen_info, int layer)
+clientFocusTop (ScreenInfo *screen_info, int layer, Time timestamp)
 {
     ClientPair top_client;
     DisplayInfo *display_info;
@@ -113,19 +113,19 @@
     if (top_client.prefered)
     {
         clientSetFocus (screen_info, top_client.prefered,
-                        myDisplayGetCurrentTime (screen_info->display_info),
+                        timestamp,
                         NO_FOCUS_FLAG);
     }
     else
     {
         clientSetFocus (screen_info, top_client.highest,
-                        myDisplayGetCurrentTime (screen_info->display_info),
+                        timestamp,
                         NO_FOCUS_FLAG);
     }
 }
 
 gboolean
-clientFocusNew(Client * c)
+clientFocusNew(Client * c, Time timestamp)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
@@ -175,7 +175,7 @@
         clientRaise (c, None);
         clientShow (c, TRUE);
         clientSetFocus (screen_info, c,
-                        myDisplayGetCurrentTime (display_info),
+                        timestamp,
                         FOCUS_IGNORE_MODAL);
     }
     else
@@ -184,7 +184,7 @@
 
         if (prevented && c2 && (c2->win_layer == c->win_layer))
         {
-            TRACE ("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);
@@ -288,7 +288,7 @@
 }
 
 void
-clientPassFocus (ScreenInfo *screen_info, Client *c, Client *exclude)
+clientPassFocus (ScreenInfo *screen_info, Client *c, Client *exclude, Time timestamp)
 {
     DisplayInfo *display_info;
     ClientPair top_most;
@@ -362,7 +362,7 @@
         new_focus = top_most.prefered ? top_most.prefered : top_most.highest;
     }
     clientSetFocus (screen_info, new_focus,
-                    myDisplayGetCurrentTime (screen_info->display_info),
+                    timestamp,
                     FOCUS_IGNORE_MODAL | FOCUS_FORCE);
 }
 
@@ -455,6 +455,12 @@
         {
             clientSortRing(c);
         }
+        if (FLAG_TEST(c->flags, CLIENT_FLAG_DEMANDS_ATTENTION))
+        {
+            TRACE ("Un-setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window); 
+            FLAG_UNSET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
+            clientSetNetState (c);
+        }
         data[0] = c->window;
         clientAdjustFullscreenLayer (c, TRUE);
         frameDraw (c, FALSE);
@@ -502,7 +508,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, timestamp);
         user_focus = c;
         if (FLAG_TEST(c->flags, CLIENT_FLAG_DEMANDS_ATTENTION))
         {
@@ -512,8 +518,7 @@
         }
         if ((c == client_focus) && !(flags & FOCUS_FORCE))
         {
-            TRACE ("client \"%s\" (0x%lx) is already focused, ignoring request",
-                c->name, c->window);
+            TRACE ("client \"%s\" (0x%lx) is already focused, ignoring request", c->name, c->window);
             return;
         }
         if (!clientAcceptFocus (c))

Modified: xfwm4/trunk/src/focus.h
===================================================================
--- xfwm4/trunk/src/focus.h	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/focus.h	2006-12-13 20:15:19 UTC (rev 24096)
@@ -39,8 +39,10 @@
 #define FOCUS_FORCE                     (1<<2)
 
 void                     clientFocusTop                         (ScreenInfo *, 
-                                                                 int);
-gboolean                 clientFocusNew                         (Client *);
+                                                                 int,
+                                                                 Time);
+gboolean                 clientFocusNew                         (Client *,
+                                                                 Time);
 gboolean                 clientSelectMask                       (Client *, 
                                                                  int, 
                                                                  int);
@@ -50,7 +52,8 @@
                                                                  int);
 void                     clientPassFocus                        (ScreenInfo *, 
                                                                  Client *, 
-                                                                 Client *);
+                                                                 Client *,
+                                                                 Time);
 gboolean                 clientAcceptFocus                      (Client *);
 void                     clientSortRing                         (Client *);
 void                     clientUpdateFocus                      (ScreenInfo *, 

Modified: xfwm4/trunk/src/hints.c
===================================================================
--- xfwm4/trunk/src/hints.c	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/hints.c	2006-12-13 20:15:19 UTC (rev 24096)
@@ -1196,19 +1196,22 @@
 
     g_return_val_if_fail (display_info, (Time) CurrentTime);
     timestamp = myDisplayGetCurrentTime (display_info);
-    if (timestamp == CurrentTime)
+    if (timestamp == (Time) CurrentTime)
     {
         screen_info = myDisplayGetDefaultScreen (display_info);
         g_return_val_if_fail (screen_info,  (Time) CurrentTime);
 
+        TRACE ("getXServerTime: Using X server roundtrip");
         XChangeProperty (display_info->dpy, screen_info->xfwm4_win, 
                          display_info->atoms[XFWM4_TIMESTAMP_PROP],
                          display_info->atoms[XFWM4_TIMESTAMP_PROP],
                          8, PropModeReplace, (unsigned char *) &c, 1);
         XIfEvent (display_info->dpy, &xevent, checkPropEvent, (XPointer) display_info);
 
-        timestamp = (Time) xevent.xproperty.time;
+        timestamp = (Time) myDisplayUpdateCurrentTime (display_info, &xevent);
     }
+
+    TRACE ("getXServerTime gives timestamp=%u", timestamp);
     return timestamp;
 }
 

Modified: xfwm4/trunk/src/main.c
===================================================================
--- xfwm4/trunk/src/main.c	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/main.c	2006-12-13 20:15:19 UTC (rev 24096)
@@ -504,8 +504,7 @@
                                    screen_info->width,
                                    screen_info->height);
         workspaceUpdateArea (screen_info);
-        XSetInputFocus (display_info->dpy, screen_info->xfwm4_win, RevertToPointerRoot, 
-                        myDisplayGetCurrentTime (display_info));
+        XSetInputFocus (display_info->dpy, screen_info->xfwm4_win, RevertToPointerRoot, CurrentTime);
 
         clientFrameAll (screen_info);
 

Modified: xfwm4/trunk/src/screen.c
===================================================================
--- xfwm4/trunk/src/screen.c	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/screen.c	2006-12-13 20:15:19 UTC (rev 24096)
@@ -188,7 +188,7 @@
 
     g_snprintf (selection, sizeof (selection), "WM_S%d", screen_info->screen);
     wm_sn_atom = XInternAtom (display_info->dpy, selection, FALSE);
-    XSetSelectionOwner (display_info->dpy, wm_sn_atom, screen_info->xfwm4_win, myDisplayGetCurrentTime (display_info));
+    XSetSelectionOwner (display_info->dpy, wm_sn_atom, screen_info->xfwm4_win, CurrentTime);
 
     screen_info->box_gc = None;
     screen_info->black_gc = NULL;
@@ -328,6 +328,18 @@
 }
 
 gboolean
+myScreenCheckWMAtom (ScreenInfo *screen_info, Atom atom)
+{
+    gchar selection[32];
+    Atom wm_sn_atom;
+
+    g_snprintf (selection, sizeof (selection), "WM_S%d", screen_info->screen);
+    wm_sn_atom = XInternAtom (myScreenGetXDisplay (screen_info), selection, FALSE);
+
+    return (atom == wm_sn_atom);
+}
+
+gboolean
 myScreenGrabPointer (ScreenInfo *screen_info, unsigned int event_mask, Cursor cursor, Time time)
 {
     gboolean grab;

Modified: xfwm4/trunk/src/screen.h
===================================================================
--- xfwm4/trunk/src/screen.h	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/screen.h	2006-12-13 20:15:19 UTC (rev 24096)
@@ -160,6 +160,8 @@
 GtkWidget               *myScreenGetGtkWidget                   (ScreenInfo *);
 GtkWidget               *myScreenGetGtkWidget                   (ScreenInfo *);
 GdkWindow               *myScreenGetGdkWindow                   (ScreenInfo *);
+gboolean                 myScreenCheckWMAtom                    (ScreenInfo *,
+                                                                 Atom atom);
 gboolean                 myScreenGrabKeyboard                   (ScreenInfo *,
                                                                  Time);
 gboolean                 myScreenGrabPointer                    (ScreenInfo *,

Modified: xfwm4/trunk/src/stacking.c
===================================================================
--- xfwm4/trunk/src/stacking.c	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/stacking.c	2006-12-13 20:15:19 UTC (rev 24096)
@@ -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);
+        clientPassFocus (screen_info, c, NULL, myDisplayGetCurrentTime (display_info));
         if (screen_info->last_raise == c)
         {
             screen_info->last_raise = NULL;

Modified: xfwm4/trunk/src/workspaces.c
===================================================================
--- xfwm4/trunk/src/workspaces.c	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/workspaces.c	2006-12-13 20:15:19 UTC (rev 24096)
@@ -23,9 +23,14 @@
 #include <config.h>
 #endif
 
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xmd.h>
+
 #include <glib.h>
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
@@ -174,14 +179,14 @@
 
 /* returns TRUE if the workspace was changed, FALSE otherwise */
 gboolean
-workspaceMove (ScreenInfo *screen_info, int rowmod, int colmod, Client * c)
+workspaceMove (ScreenInfo *screen_info, int rowmod, int colmod, Client * c, Time timestamp)
 {
     int row, col, newrow, newcol, previous_ws, n;
 
-    workspaceGetPosition(screen_info, screen_info->current_ws, &row, &col);
-    newrow = modify_with_wrap(row, rowmod, screen_info->desktop_layout.rows, screen_info->params->wrap_layout);
-    newcol = modify_with_wrap(col, colmod, screen_info->desktop_layout.cols, screen_info->params->wrap_layout);
-    n = workspaceGetNumber(screen_info, newrow, newcol);
+    workspaceGetPosition (screen_info, screen_info->current_ws, &row, &col);
+    newrow = modify_with_wrap (row, rowmod, screen_info->desktop_layout.rows, screen_info->params->wrap_layout);
+    newcol = modify_with_wrap (col, colmod, screen_info->desktop_layout.cols, screen_info->params->wrap_layout);
+    n = workspaceGetNumber (screen_info, newrow, newcol);
 
     if (n == screen_info->current_ws)
     {
@@ -191,7 +196,7 @@
     previous_ws = screen_info->current_ws;
     if ((n >= 0) && (n < screen_info->workspace_count))
     {
-        workspaceSwitch(screen_info, n, c, TRUE);
+        workspaceSwitch (screen_info, n, c, TRUE, timestamp);
     }
     else if (screen_info->params->wrap_layout)
     {
@@ -218,16 +223,16 @@
                 return FALSE;
             }
 
-            n = workspaceGetNumber(screen_info, newrow, newcol);
+            n = workspaceGetNumber (screen_info, newrow, newcol);
         }
-        workspaceSwitch(screen_info, n, c, TRUE);
+        workspaceSwitch (screen_info, n, c, TRUE, timestamp);
     }
 
     return (screen_info->current_ws != previous_ws);
 }
 
 void
-workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2, gboolean update_focus)
+workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2, gboolean update_focus, Time timestamp)
 {
     DisplayInfo *display_info;
     Client *c, *new_focus;
@@ -268,7 +273,7 @@
         return;
     }
 
-    myScreenGrabPointer (screen_info, EnterWindowMask, None, myDisplayGetCurrentTime (display_info));
+    myScreenGrabPointer (screen_info, EnterWindowMask, None, timestamp);
 
     screen_info->previous_ws = screen_info->current_ws;
     screen_info->current_ws = new_ws;
@@ -325,7 +330,7 @@
             if (c == previous)
             {
                 FLAG_SET (previous->xfwm_flags, XFWM_FLAG_FOCUS);
-                clientSetFocus (screen_info, NULL, myDisplayGetCurrentTime (display_info), FOCUS_IGNORE_MODAL);
+                clientSetFocus (screen_info, NULL, timestamp, FOCUS_IGNORE_MODAL);
             }
             if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE) && !FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
             {
@@ -381,15 +386,15 @@
     {
         if (new_focus)
         {
-            clientSetFocus (screen_info, new_focus, myDisplayGetCurrentTime (display_info), NO_FOCUS_FLAG);
+            clientSetFocus (screen_info, new_focus, timestamp, NO_FOCUS_FLAG);
         }
         else
         {
-            clientFocusTop (screen_info, WIN_LAYER_NORMAL);
+            clientFocusTop (screen_info, WIN_LAYER_NORMAL, timestamp);
         }
     }
 
-    myScreenUngrabPointer (screen_info, myDisplayGetCurrentTime (display_info));
+    myScreenUngrabPointer (screen_info, timestamp);
 }
 
 void
@@ -436,12 +441,12 @@
     }
     if (screen_info->current_ws > count - 1)
     {
-        workspaceSwitch (screen_info, count - 1, NULL, TRUE);
+        workspaceSwitch (screen_info, count - 1, NULL, TRUE, myDisplayGetCurrentTime (display_info));
     }
     setNetWorkarea (display_info, screen_info->xroot, screen_info->workspace_count,
                     screen_info->width, screen_info->height, screen_info->margins);
     /* Recompute the layout based on the (changed) number of desktops */
-    getDesktopLayout(display_info, screen_info->xroot, screen_info->workspace_count,
+    getDesktopLayout (display_info, screen_info->xroot, screen_info->workspace_count,
                      &screen_info->desktop_layout);
 }
 

Modified: xfwm4/trunk/src/workspaces.h
===================================================================
--- xfwm4/trunk/src/workspaces.h	2006-12-13 20:02:23 UTC (rev 24095)
+++ xfwm4/trunk/src/workspaces.h	2006-12-13 20:15:19 UTC (rev 24096)
@@ -26,21 +26,28 @@
 #  include "config.h"
 #endif
 
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xmd.h>
 #include <glib.h>
+
 #include "screen.h"
 #include "client.h"
 
 gboolean                workspaceMove                           (ScreenInfo *, 
                                                                  int, 
                                                                  int, 
-                                                                 Client *);
+                                                                 Client *,
+                                                                 Time);
 void                    workspaceSwitch                         (ScreenInfo *, 
                                                                  int, 
                                                                  Client *, 
-                                                                  gboolean);
+                                                                 gboolean,
+                                                                 Time);
 void                    workspaceSetNames                       (ScreenInfo *, 
                                                                  gchar **, 
                                                                  int);



More information about the Xfce4-commits mailing list