[Xfce4-commits] <xfwm4:master> Workaround Adobe AIR setting workspace to 0xFF instead of 0xFFFFFFFF for all workspaces as per EWMH specifications (Bug #8304)
Olivier Fourdan
noreply at xfce.org
Sun Jan 8 15:14:04 CET 2012
Updating branch refs/heads/master
to a1253635f26c0bc9ae855c71ff945b3139fb7333 (commit)
from ab54b1d7322adaac89b4218e52912d75dc395747 (commit)
commit a1253635f26c0bc9ae855c71ff945b3139fb7333
Author: Olivier Fourdan <fourdan at xfce.org>
Date: Sun Jan 8 12:16:07 2012 +0100
Workaround Adobe AIR setting workspace to 0xFF instead of 0xFFFFFFFF for all workspaces as per EWMH specifications (Bug #8304)
src/client.c | 6 ++++++
src/client.h | 2 +-
src/events.c | 23 ++---------------------
src/netwm.c | 37 +++++++++++++++++++++++++++++++++++++
src/netwm.h | 2 ++
5 files changed, 48 insertions(+), 22 deletions(-)
diff --git a/src/client.c b/src/client.c
index 6ca134d..1eb4e59 100644
--- a/src/client.c
+++ b/src/client.c
@@ -2157,6 +2157,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 9e5aa41..d080711 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/events.c b/src/events.c
index 2f9fa64..302ee26 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1964,27 +1964,8 @@ handleClientMessage (DisplayInfo *display_info, XClientMessageEvent * ev)
}
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);
- if (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 (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_STICK) && FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
- {
- clientUnstick (c, TRUE);
- frameQueueDraw (c, FALSE);
- }
- if (ev->data.l[0] != (long) c->win_workspace)
- {
- clientSetWorkspace (c, (guint) ev->data.l[0], TRUE);
- }
- }
+ TRACE ("client \"%s\" (0x%lx) has received a NET_WM_DESKTOP event (0x%lx)", c->name, c->window);
+ clientUpdateNetWmDesktop (c, ev);
}
else if ((ev->message_type == display_info->atoms[NET_CLOSE_WINDOW]) && (ev->format == 32))
{
diff --git a/src/netwm.c b/src/netwm.c
index 1886474..545e64a 100644
--- a/src/netwm.c
+++ b/src/netwm.c
@@ -271,6 +271,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