summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren gmail com>2006-05-15 18:37:53 +0000
committerElijah Newren <newren@src.gnome.org>2006-05-15 18:37:53 +0000
commit893b5a67e21910e4bf548667b022e255f560c167 (patch)
treeb40888627f0062c56e683e5685cf3281f95f8f35
parent772d96e21f16952c9ba528fa76fef05b4f70ff7f (diff)
downloadmetacity-893b5a67e21910e4bf548667b022e255f560c167.tar.gz
Clear _NET_WM_VISIBLE_NAME (and the ICON_ equivalent) when no longer being
2006-05-15 Elijah Newren <newren gmail com> Clear _NET_WM_VISIBLE_NAME (and the ICON_ equivalent) when no longer being used. Fixes #330671. * src/window.[ch] (struct MetaWindow): new using_net_wm_visible_name and using_net_wm_visible_icon_name bits, (meta_window_new_with_attrs): initialize these new bits to false * src/window-props.c (set_title_text, set_window_title, set_icon_title): if the _NET_WM_VISIBLE_(ICON_)NAME property was previously set but doesn't need to be this time, make sure to clear it
-rw-r--r--ChangeLog13
-rw-r--r--src/window-props.c38
-rw-r--r--src/window.c6
-rw-r--r--src/window.h6
4 files changed, 50 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 0fb80f31..183da50b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-05-15 Elijah Newren <newren gmail com>
+
+ Clear _NET_WM_VISIBLE_NAME (and the ICON_ equivalent) when no
+ longer being used. Fixes #330671.
+
+ * src/window.[ch] (struct MetaWindow): new
+ using_net_wm_visible_name and using_net_wm_visible_icon_name bits,
+ (meta_window_new_with_attrs): initialize these new bits to false
+
+ * src/window-props.c (set_title_text, set_window_title, set_icon_title):
+ if the _NET_WM_VISIBLE_(ICON_)NAME property was previously set but
+ doesn't need to be this time, make sure to clear it
+
2006-05-15 Paolo Borelli <pborelli@katamail.com>
* src/prefs.c (update_binding): plug a small leak.
diff --git a/src/window-props.c b/src/window-props.c
index f1039298..0112a32f 100644
--- a/src/window-props.c
+++ b/src/window-props.c
@@ -207,7 +207,11 @@ reload_net_wm_user_time (MetaWindow *window,
* Returns TRUE if a new title was set.
*/
static gboolean
-set_title_text (MetaWindow *window, const char *title, Atom atom, char **target)
+set_title_text (MetaWindow *window,
+ gboolean previous_was_modified,
+ const char *title,
+ Atom atom,
+ char **target)
{
char hostname[HOST_NAME_MAX + 1];
gboolean modified = FALSE;
@@ -239,8 +243,14 @@ set_title_text (MetaWindow *window, const char *title, Atom atom, char **target)
if (modified && atom != None)
meta_prop_set_utf8_string_hint (window->display,
- window->xwindow,
- atom, *target);
+ window->xwindow,
+ atom, *target);
+
+ /* Bug 330671 -- Don't forget to clear _NET_WM_VISIBLE_(ICON_)NAME */
+ if (!modified && previous_was_modified)
+ XDeleteProperty (window->display->xdisplay,
+ window->xwindow,
+ atom);
return modified;
}
@@ -251,8 +261,13 @@ set_window_title (MetaWindow *window,
{
char *str;
- set_title_text (window, title, window->display->atom_net_wm_visible_name,
- &window->title);
+ gboolean modified =
+ set_title_text (window,
+ window->using_net_wm_visible_name,
+ title,
+ window->display->atom_net_wm_visible_name,
+ &window->title);
+ window->using_net_wm_visible_name = modified;
/* strndup is a hack since GNU libc has broken %.10s */
str = g_strndup (window->title, 10);
@@ -297,8 +312,8 @@ reload_net_wm_name (MetaWindow *window,
static void
init_wm_name (MetaDisplay *display,
- Atom property,
- MetaPropValue *value)
+ Atom property,
+ MetaPropValue *value)
{
value->type = META_PROP_VALUE_TEXT_PROPERTY;
value->atom = XA_WM_NAME;
@@ -332,8 +347,13 @@ static void
set_icon_title (MetaWindow *window,
const char *title)
{
- set_title_text (window, title, window->display->atom_net_wm_visible_icon_name,
- &window->icon_name);
+ gboolean modified =
+ set_title_text (window,
+ window->using_net_wm_visible_icon_name,
+ title,
+ window->display->atom_net_wm_visible_icon_name,
+ &window->icon_name);
+ window->using_net_wm_visible_icon_name = modified;
}
static void
diff --git a/src/window.c b/src/window.c
index 65acc170..8b1212d0 100644
--- a/src/window.c
+++ b/src/window.c
@@ -529,8 +529,10 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->struts = NULL;
- window->using_net_wm_name = FALSE;
- window->using_net_wm_icon_name = FALSE;
+ window->using_net_wm_name = FALSE;
+ window->using_net_wm_visible_name = FALSE;
+ window->using_net_wm_icon_name = FALSE;
+ window->using_net_wm_visible_icon_name = FALSE;
window->need_reread_icon = TRUE;
window->update_icon_queued = FALSE;
diff --git a/src/window.h b/src/window.h
index 93377062..aa996000 100644
--- a/src/window.h
+++ b/src/window.h
@@ -270,8 +270,10 @@ struct _MetaWindow
guint transient_parent_is_root_window : 1;
/* Info on which props we got our attributes from */
- guint using_net_wm_name : 1; /* vs. plain wm_name */
- guint using_net_wm_icon_name : 1; /* vs. plain wm_icon_name */
+ guint using_net_wm_name : 1; /* vs. plain wm_name */
+ guint using_net_wm_visible_name : 1; /* tracked so we can clear it */
+ guint using_net_wm_icon_name : 1; /* vs. plain wm_icon_name */
+ guint using_net_wm_visible_icon_name : 1; /* tracked so we can clear it */
/* has a shape mask */
guint has_shape : 1;