summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Thurman <tthurman@gnome.org>2008-10-23 04:09:14 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2008-10-23 04:09:14 +0000
commitab9bdf228b25a0b7f8b53d716f27f18830caaacb (patch)
tree524c0784cb9fcf5380ca3d9e0c793bb6437d523a
parentc91475f20f65ff3c7e764d87c4605dd375dd060e (diff)
downloadmetacity-ab9bdf228b25a0b7f8b53d716f27f18830caaacb.tar.gz
Support _NET_WM_STATE_STICKY (i.e. allow third-party apps to decide
2008-10-23 Thomas Thurman <tthurman@gnome.org> Support _NET_WM_STATE_STICKY (i.e. allow third-party apps to decide whether a window is on all workspaces). Bug found by Ka-Hing Cheung. Closes #557536. * src/core/window.c (set_net_wm_state): report it * src/core/window.c (meta_window_client_message): set sticky if we receive it * src/core/window-props.c: set sticky if we find it * src/core/atomnames.h: add _NET_WM_STATE_STICKY svn path=/trunk/; revision=3991
-rw-r--r--ChangeLog12
-rw-r--r--src/core/atomnames.h3
-rw-r--r--src/core/window-props.c2
-rw-r--r--src/core/window.c21
4 files changed, 34 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e0a43bc..4bed9dc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-10-23 Thomas Thurman <tthurman@gnome.org>
+
+ Support _NET_WM_STATE_STICKY (i.e. allow third-party apps to decide
+ whether a window is on all workspaces). Bug found by Ka-Hing
+ Cheung. Closes #557536.
+
+ * src/core/window.c (set_net_wm_state): report it
+ * src/core/window.c (meta_window_client_message): set sticky
+ if we receive it
+ * src/core/window-props.c: set sticky if we find it
+ * src/core/atomnames.h: add _NET_WM_STATE_STICKY
+
2008-10-22 Thomas Thurman <tthurman@gnome.org>
* src/core/schema-bindings.c: support builds outside tree properly.
diff --git a/src/core/atomnames.h b/src/core/atomnames.h
index 18e5dcc0..f198b7a9 100644
--- a/src/core/atomnames.h
+++ b/src/core/atomnames.h
@@ -33,7 +33,7 @@
* again.
*
* If you also define EWMH_ATOMS_ONLY then you will only get _NET_WM_*
- * hints rather than all of them.
+ * atoms rather than all of them.
*/
#ifndef item
@@ -154,6 +154,7 @@ item(_NET_DESKTOP_VIEWPORT)
item(_NET_WM_USER_TIME_WINDOW)
item(_NET_WM_ACTION_ABOVE)
item(_NET_WM_ACTION_BELOW)
+item(_NET_WM_STATE_STICKY)
#if 0
/* We apparently never use: */
diff --git a/src/core/window-props.c b/src/core/window-props.c
index 9033ee77..59feadf7 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -580,6 +580,8 @@ reload_net_wm_state (MetaWindow *window,
window->wm_state_below = TRUE;
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_DEMANDS_ATTENTION)
window->wm_state_demands_attention = TRUE;
+ else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_STICKY)
+ window->on_all_workspaces = TRUE;
++i;
}
diff --git a/src/core/window.c b/src/core/window.c
index f4cd5931..a99eb154 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1228,7 +1228,7 @@ static void
set_net_wm_state (MetaWindow *window)
{
int i;
- unsigned long data[11];
+ unsigned long data[12];
i = 0;
if (window->shaded)
@@ -1286,6 +1286,11 @@ set_net_wm_state (MetaWindow *window)
data[i] = window->display->atom__NET_WM_STATE_DEMANDS_ATTENTION;
++i;
}
+ if (window->on_all_workspaces)
+ {
+ data[i] = window->display->atom__NET_WM_STATE_STICKY;
+ ++i;
+ }
meta_verbose ("Setting _NET_WM_STATE with %d atoms\n", i);
@@ -4928,9 +4933,19 @@ meta_window_client_message (MetaWindow *window,
{
if ((action == _NET_WM_STATE_ADD) ||
(action == _NET_WM_STATE_TOGGLE && !window->wm_state_demands_attention))
- meta_window_set_demands_attention(window);
+ meta_window_set_demands_attention (window);
else
- meta_window_unset_demands_attention(window);
+ meta_window_unset_demands_attention (window);
+ }
+
+ if (first == display->atom__NET_WM_STATE_STICKY ||
+ second == display->atom__NET_WM_STATE_STICKY)
+ {
+ if ((action == _NET_WM_STATE_ADD) ||
+ (action == _NET_WM_STATE_TOGGLE && !window->on_all_workspaces))
+ meta_window_stick (window);
+ else
+ meta_window_unstick (window);
}
return TRUE;