diff --git a/src/core/window-private.h b/src/core/window-private.h index 4ef970779..e7c0d4dc2 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -262,9 +262,6 @@ struct _MetaWindow guint has_move_func : 1; guint has_resize_func : 1; guint has_fullscreen_func : 1; - - /* Weird "_NET_WM_STATE_MODAL" flag */ - guint wm_state_modal : 1; /* Computed whether to skip taskbar or not */ guint skip_taskbar : 1; @@ -318,12 +315,6 @@ struct _MetaWindow /* Transient parent is a root window */ 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_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 */ /* if TRUE, window was maximized at start of current grab op */ guint shaken_loose : 1; diff --git a/src/core/window.c b/src/core/window.c index 8b452b42f..7f507f1cd 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -920,7 +920,6 @@ _meta_window_shared_new (MetaDisplay *display, window->always_sticky = FALSE; - window->wm_state_modal = FALSE; window->skip_taskbar = FALSE; window->skip_pager = FALSE; window->wm_state_above = FALSE; @@ -946,11 +945,6 @@ _meta_window_shared_new (MetaDisplay *display, window->struts = NULL; - 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->layer = META_LAYER_LAST; /* invalid value */ window->stack_position = -1; window->initial_workspace = 0; /* not used */ diff --git a/src/x11/window-props.c b/src/x11/window-props.c index 35f056920..3d5476538 100644 --- a/src/x11/window-props.c +++ b/src/x11/window-props.c @@ -489,15 +489,18 @@ static void set_window_title (MetaWindow *window, const char *title) { + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = window_x11->priv; + char *new_title = NULL; - + gboolean modified = set_title_text (window, - window->using_net_wm_visible_name, + priv->using_net_wm_visible_name, title, window->display->atom__NET_WM_VISIBLE_NAME, &new_title); - window->using_net_wm_visible_name = modified; + priv->using_net_wm_visible_name = modified; meta_window_set_title (window, new_title); @@ -509,10 +512,13 @@ reload_net_wm_name (MetaWindow *window, MetaPropValue *value, gboolean initial) { + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = window_x11->priv; + if (value->type != META_PROP_VALUE_INVALID) { set_window_title (window, value->v.str); - window->using_net_wm_name = TRUE; + priv->using_net_wm_name = TRUE; meta_verbose ("Using _NET_WM_NAME for new title of %s: \"%s\"\n", window->desc, window->title); @@ -520,7 +526,7 @@ reload_net_wm_name (MetaWindow *window, else { set_window_title (window, NULL); - window->using_net_wm_name = FALSE; + priv->using_net_wm_name = FALSE; if (!initial) meta_window_reload_property (window, XA_WM_NAME, FALSE); } @@ -531,7 +537,10 @@ reload_wm_name (MetaWindow *window, MetaPropValue *value, gboolean initial) { - if (window->using_net_wm_name) + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = window_x11->priv; + + if (priv->using_net_wm_name) { meta_verbose ("Ignoring WM_NAME \"%s\" as _NET_WM_NAME is set\n", value->v.str); @@ -606,13 +615,16 @@ static void set_icon_title (MetaWindow *window, const char *title) { + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = window_x11->priv; + gboolean modified = set_title_text (window, - window->using_net_wm_visible_icon_name, + priv->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; + priv->using_net_wm_visible_icon_name = modified; } static void @@ -620,10 +632,13 @@ reload_net_wm_icon_name (MetaWindow *window, MetaPropValue *value, gboolean initial) { + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = window_x11->priv; + if (value->type != META_PROP_VALUE_INVALID) { set_icon_title (window, value->v.str); - window->using_net_wm_icon_name = TRUE; + priv->using_net_wm_icon_name = TRUE; meta_verbose ("Using _NET_WM_ICON_NAME for new title of %s: \"%s\"\n", window->desc, window->title); @@ -631,7 +646,7 @@ reload_net_wm_icon_name (MetaWindow *window, else { set_icon_title (window, NULL); - window->using_net_wm_icon_name = FALSE; + priv->using_net_wm_icon_name = FALSE; if (!initial) meta_window_reload_property (window, XA_WM_ICON_NAME, FALSE); } @@ -642,7 +657,10 @@ reload_wm_icon_name (MetaWindow *window, MetaPropValue *value, gboolean initial) { - if (window->using_net_wm_icon_name) + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = window_x11->priv; + + if (priv->using_net_wm_icon_name) { meta_verbose ("Ignoring WM_ICON_NAME \"%s\" as _NET_WM_ICON_NAME is set\n", value->v.str); @@ -687,7 +705,7 @@ reload_net_wm_state (MetaWindow *window, window->maximized_horizontally = FALSE; window->maximized_vertically = FALSE; window->fullscreen = FALSE; - window->wm_state_modal = FALSE; + priv->wm_state_modal = FALSE; priv->wm_state_skip_taskbar = FALSE; priv->wm_state_skip_pager = FALSE; window->wm_state_above = FALSE; @@ -709,7 +727,7 @@ reload_net_wm_state (MetaWindow *window, else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_HIDDEN) window->minimize_after_placement = TRUE; else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_MODAL) - window->wm_state_modal = TRUE; + priv->wm_state_modal = TRUE; else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SKIP_TASKBAR) priv->wm_state_skip_taskbar = TRUE; else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SKIP_PAGER) diff --git a/src/x11/window-x11-private.h b/src/x11/window-x11-private.h index 25114daad..d3ceb3ba7 100644 --- a/src/x11/window-x11-private.h +++ b/src/x11/window-x11-private.h @@ -41,6 +41,15 @@ struct _MetaWindowX11Private /* TRUE if the client forced these on */ guint wm_state_skip_taskbar : 1; guint wm_state_skip_pager : 1; + + /* Weird "_NET_WM_STATE_MODAL" flag */ + guint wm_state_modal : 1; + + /* Info on which props we got our attributes from */ + 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 */ }; G_END_DECLS diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index cade6561c..c8db060e5 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -81,6 +81,8 @@ meta_window_x11_class_init (MetaWindowX11Class *klass) void meta_window_x11_set_net_wm_state (MetaWindow *window) { + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11); int i; unsigned long data[13]; @@ -90,7 +92,7 @@ meta_window_x11_set_net_wm_state (MetaWindow *window) data[i] = window->display->atom__NET_WM_STATE_SHADED; ++i; } - if (window->wm_state_modal) + if (priv->wm_state_modal) { data[i] = window->display->atom__NET_WM_STATE_MODAL; ++i; @@ -904,9 +906,9 @@ meta_window_x11_client_message (MetaWindow *window, if (first == display->atom__NET_WM_STATE_MODAL || second == display->atom__NET_WM_STATE_MODAL) { - window->wm_state_modal = + priv->wm_state_modal = (action == _NET_WM_STATE_ADD) || - (action == _NET_WM_STATE_TOGGLE && !window->wm_state_modal); + (action == _NET_WM_STATE_TOGGLE && !priv->wm_state_modal); meta_window_x11_recalc_window_type (window); meta_window_queue(window, META_QUEUE_MOVE_RESIZE); @@ -1546,6 +1548,8 @@ error: void meta_window_x11_recalc_window_type (MetaWindow *window) { + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11); MetaWindowType type; if (window->type_atom != None) @@ -1612,8 +1616,7 @@ meta_window_x11_recalc_window_type (MetaWindow *window) type = META_WINDOW_NORMAL; } - if (type == META_WINDOW_DIALOG && - window->wm_state_modal) + if (type == META_WINDOW_DIALOG && priv->wm_state_modal) type = META_WINDOW_MODAL_DIALOG; /* We don't want to allow override-redirect windows to have decorated-window