[Xfce4-commits] <xfwm4:xfce-4.8> Workaround Adobe AIR setting workspace to 0xFF instead of 0xFFFFFFFF as per EWMH specifications (Bug 8304)

Olivier Fourdan noreply at xfce.org
Sun Jan 8 12:12:01 CET 2012


Updating branch refs/heads/xfce-4.8
         to 9c6463e5f9eb6f396d250554e10511774882485f (commit)
       from 00c9977b9c30229d7dbf496396d6403ef92c65cb (commit)

commit 9c6463e5f9eb6f396d250554e10511774882485f
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Sun Jan 8 11:52:49 2012 +0100

    Workaround Adobe AIR setting workspace to 0xFF instead of 0xFFFFFFFF as per EWMH specifications (Bug 8304)

 src/client.c |   10 ++++++++--
 src/client.h |    2 +-
 src/netwm.c  |   37 +++++++++++++++++++++++++++++++++++++
 src/netwm.h  |    2 ++
 4 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/src/client.c b/src/client.c
index 53f56ee..7e1691e 100644
--- a/src/client.c
+++ b/src/client.c
@@ -851,7 +851,7 @@ clientMoveResizeWindow (Client * c, XWindowChanges * wc, unsigned long mask)
         {
             clientRemoveMaximizeFlag (c);
         }
-        flags |= CFG_REQUEST;
+        flags |= CFG_CONSTRAINED | CFG_REQUEST;
     }
     if ((mask & (CWWidth | CWHeight)) && !(mask & (CWX | CWY)))
     {
@@ -860,7 +860,7 @@ clientMoveResizeWindow (Client * c, XWindowChanges * wc, unsigned long mask)
          * position, make sure the window remains fully visible in that
          * case so that the user does not have to relocate the window
          */
-        flags |= CFG_CONSTRAINED | CFG_KEEP_VISIBLE;
+        flags |= CFG_KEEP_VISIBLE;
     }
     /*
      * Let's say that if the client performs a XRaiseWindow, we show the window if focus
@@ -2305,6 +2305,12 @@ clientSetWorkspace (Client * c, guint ws, gboolean manage_mapping)
 
     TRACE ("entering clientSetWorkspace");
 
+    if (ws > c->screen_info->workspace_count - 1)
+    {
+        g_warning ("Requested workspace %d does not exist", ws);
+        return;
+    }
+
     list_of_windows = clientListTransientOrModal (c);
     for (list = list_of_windows; list; list = g_list_next (list))
     {
diff --git a/src/client.h b/src/client.h
index 10137f7..aec4dfe 100644
--- a/src/client.h
+++ b/src/client.h
@@ -180,7 +180,7 @@
                                         XFWM_FLAG_FIRST_MAP | \
                                         XFWM_FLAG_NEEDS_REDRAW
 
-#define ALL_WORKSPACES                  (int) 0xFFFFFFFF
+#define ALL_WORKSPACES                  (guint) 0xFFFFFFFF
 
 #define CONSTRAINED_WINDOW(c)           ((c->win_layer > WIN_LAYER_DESKTOP) && \
                                         !(c->type & (WINDOW_DESKTOP | WINDOW_DOCK)) && \
diff --git a/src/netwm.c b/src/netwm.c
index fcd6123..f673dd0 100644
--- a/src/netwm.c
+++ b/src/netwm.c
@@ -284,6 +284,43 @@ clientGetNetState (Client * c)
 }
 
 void
+clientUpdateNetWmDesktop (Client * c, XClientMessageEvent * ev)
+{
+    ScreenInfo *screen_info;
+
+    g_return_if_fail (c != NULL);
+    TRACE ("entering clientUpdateNetWmDesktop");
+    TRACE ("client \"%s\" (0x%lx), value 0x%lx", c->name, c->window, ev->data.l[0]);
+
+    screen_info = c->screen_info;
+
+    if ((guint) ev->data.l[0] == ALL_WORKSPACES)
+    {
+        if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_STICK) && !FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
+        {
+            clientStick (c, TRUE);
+            frameQueueDraw (c, FALSE);
+        }
+    }
+    else if ((guint) ev->data.l[0] < (guint) screen_info->workspace_count)
+    {
+        if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_STICK) && FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
+        {
+            clientUnstick (c, TRUE);
+            frameQueueDraw (c, FALSE);
+        }
+        if ((guint) ev->data.l[0] != (guint) c->win_workspace)
+        {
+            clientSetWorkspace (c, (guint) ev->data.l[0], TRUE);
+        }
+    }
+    else
+    {
+        TRACE ("Ignoring invalid NET_WM_DESKTOP value 0x%lx specified for client \"%s\" (0x%lx)", ev->data.l[0], c->name, c->window);
+    }
+}
+
+void
 clientUpdateNetState (Client * c, XClientMessageEvent * ev)
 {
     ScreenInfo *screen_info;
diff --git a/src/netwm.h b/src/netwm.h
index 92b0bf1..5156c1a 100644
--- a/src/netwm.h
+++ b/src/netwm.h
@@ -35,6 +35,8 @@
 
 void                     clientSetNetState                      (Client *);
 void                     clientGetNetState                      (Client *);
+void                     clientUpdateNetWmDesktop               (Client *,
+                                                                 XClientMessageEvent *);
 void                     clientUpdateNetState                   (Client *,
                                                                  XClientMessageEvent *);
 void                     clientNetMoveResize                    (Client *,


More information about the Xfce4-commits mailing list