Clear _NET_WM_VISIBLE_NAME (and the ICON_ equivalent) when no longer being

2006-04-25  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
This commit is contained in:
Elijah Newren 2006-05-05 01:10:20 +00:00 committed by Elijah Newren
parent e9c8fd8527
commit b62dd8d130
4 changed files with 50 additions and 13 deletions

View File

@ -1,3 +1,16 @@
2006-04-25 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-04-25 Elijah Newren <newren gmail com> 2006-04-25 Elijah Newren <newren gmail com>
* rationales.txt: add three new tracker bugs * rationales.txt: add three new tracker bugs

View File

@ -207,7 +207,11 @@ reload_net_wm_user_time (MetaWindow *window,
* Returns TRUE if a new title was set. * Returns TRUE if a new title was set.
*/ */
static gboolean 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]; char hostname[HOST_NAME_MAX + 1];
gboolean modified = FALSE; gboolean modified = FALSE;
@ -239,8 +243,14 @@ set_title_text (MetaWindow *window, const char *title, Atom atom, char **target)
if (modified && atom != None) if (modified && atom != None)
meta_prop_set_utf8_string_hint (window->display, meta_prop_set_utf8_string_hint (window->display,
window->xwindow, window->xwindow,
atom, *target); 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; return modified;
} }
@ -251,8 +261,13 @@ set_window_title (MetaWindow *window,
{ {
char *str; char *str;
set_title_text (window, title, window->display->atom_net_wm_visible_name, gboolean modified =
&window->title); 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 */ /* strndup is a hack since GNU libc has broken %.10s */
str = g_strndup (window->title, 10); str = g_strndup (window->title, 10);
@ -297,8 +312,8 @@ reload_net_wm_name (MetaWindow *window,
static void static void
init_wm_name (MetaDisplay *display, init_wm_name (MetaDisplay *display,
Atom property, Atom property,
MetaPropValue *value) MetaPropValue *value)
{ {
value->type = META_PROP_VALUE_TEXT_PROPERTY; value->type = META_PROP_VALUE_TEXT_PROPERTY;
value->atom = XA_WM_NAME; value->atom = XA_WM_NAME;
@ -332,8 +347,13 @@ static void
set_icon_title (MetaWindow *window, set_icon_title (MetaWindow *window,
const char *title) const char *title)
{ {
set_title_text (window, title, window->display->atom_net_wm_visible_icon_name, gboolean modified =
&window->icon_name); 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 static void

View File

@ -528,8 +528,10 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->struts = NULL; window->struts = NULL;
window->using_net_wm_name = FALSE; window->using_net_wm_name = FALSE;
window->using_net_wm_icon_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->need_reread_icon = TRUE;
window->update_icon_queued = FALSE; window->update_icon_queued = FALSE;

View File

@ -273,8 +273,10 @@ struct _MetaWindow
guint transient_parent_is_root_window : 1; guint transient_parent_is_root_window : 1;
/* Info on which props we got our attributes from */ /* Info on which props we got our attributes from */
guint using_net_wm_name : 1; /* vs. plain wm_name */ 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_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 */ /* has a shape mask */
guint has_shape : 1; guint has_shape : 1;