Move more fields to MetaWindowX11

This commit is contained in:
Jasper St. Pierre 2014-03-18 13:07:50 -04:00
parent 8f151842fb
commit d6a27195d3
5 changed files with 48 additions and 33 deletions

View File

@ -262,9 +262,6 @@ struct _MetaWindow
guint has_move_func : 1; guint has_move_func : 1;
guint has_resize_func : 1; guint has_resize_func : 1;
guint has_fullscreen_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 */ /* Computed whether to skip taskbar or not */
guint skip_taskbar : 1; guint skip_taskbar : 1;
@ -318,12 +315,6 @@ struct _MetaWindow
/* Transient parent is a root window */ /* Transient parent is a root window */
guint transient_parent_is_root_window : 1; 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 */ /* if TRUE, window was maximized at start of current grab op */
guint shaken_loose : 1; guint shaken_loose : 1;

View File

@ -920,7 +920,6 @@ _meta_window_shared_new (MetaDisplay *display,
window->always_sticky = FALSE; window->always_sticky = FALSE;
window->wm_state_modal = FALSE;
window->skip_taskbar = FALSE; window->skip_taskbar = FALSE;
window->skip_pager = FALSE; window->skip_pager = FALSE;
window->wm_state_above = FALSE; window->wm_state_above = FALSE;
@ -946,11 +945,6 @@ _meta_window_shared_new (MetaDisplay *display,
window->struts = NULL; 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->layer = META_LAYER_LAST; /* invalid value */
window->stack_position = -1; window->stack_position = -1;
window->initial_workspace = 0; /* not used */ window->initial_workspace = 0; /* not used */

View File

@ -489,15 +489,18 @@ static void
set_window_title (MetaWindow *window, set_window_title (MetaWindow *window,
const char *title) const char *title)
{ {
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = window_x11->priv;
char *new_title = NULL; char *new_title = NULL;
gboolean modified = gboolean modified =
set_title_text (window, set_title_text (window,
window->using_net_wm_visible_name, priv->using_net_wm_visible_name,
title, title,
window->display->atom__NET_WM_VISIBLE_NAME, window->display->atom__NET_WM_VISIBLE_NAME,
&new_title); &new_title);
window->using_net_wm_visible_name = modified; priv->using_net_wm_visible_name = modified;
meta_window_set_title (window, new_title); meta_window_set_title (window, new_title);
@ -509,10 +512,13 @@ reload_net_wm_name (MetaWindow *window,
MetaPropValue *value, MetaPropValue *value,
gboolean initial) gboolean initial)
{ {
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = window_x11->priv;
if (value->type != META_PROP_VALUE_INVALID) if (value->type != META_PROP_VALUE_INVALID)
{ {
set_window_title (window, value->v.str); 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", meta_verbose ("Using _NET_WM_NAME for new title of %s: \"%s\"\n",
window->desc, window->title); window->desc, window->title);
@ -520,7 +526,7 @@ reload_net_wm_name (MetaWindow *window,
else else
{ {
set_window_title (window, NULL); set_window_title (window, NULL);
window->using_net_wm_name = FALSE; priv->using_net_wm_name = FALSE;
if (!initial) if (!initial)
meta_window_reload_property (window, XA_WM_NAME, FALSE); meta_window_reload_property (window, XA_WM_NAME, FALSE);
} }
@ -531,7 +537,10 @@ reload_wm_name (MetaWindow *window,
MetaPropValue *value, MetaPropValue *value,
gboolean initial) 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", meta_verbose ("Ignoring WM_NAME \"%s\" as _NET_WM_NAME is set\n",
value->v.str); value->v.str);
@ -606,13 +615,16 @@ static void
set_icon_title (MetaWindow *window, set_icon_title (MetaWindow *window,
const char *title) const char *title)
{ {
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = window_x11->priv;
gboolean modified = gboolean modified =
set_title_text (window, set_title_text (window,
window->using_net_wm_visible_icon_name, priv->using_net_wm_visible_icon_name,
title, title,
window->display->atom__NET_WM_VISIBLE_ICON_NAME, window->display->atom__NET_WM_VISIBLE_ICON_NAME,
&window->icon_name); &window->icon_name);
window->using_net_wm_visible_icon_name = modified; priv->using_net_wm_visible_icon_name = modified;
} }
static void static void
@ -620,10 +632,13 @@ reload_net_wm_icon_name (MetaWindow *window,
MetaPropValue *value, MetaPropValue *value,
gboolean initial) gboolean initial)
{ {
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = window_x11->priv;
if (value->type != META_PROP_VALUE_INVALID) if (value->type != META_PROP_VALUE_INVALID)
{ {
set_icon_title (window, value->v.str); 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", meta_verbose ("Using _NET_WM_ICON_NAME for new title of %s: \"%s\"\n",
window->desc, window->title); window->desc, window->title);
@ -631,7 +646,7 @@ reload_net_wm_icon_name (MetaWindow *window,
else else
{ {
set_icon_title (window, NULL); set_icon_title (window, NULL);
window->using_net_wm_icon_name = FALSE; priv->using_net_wm_icon_name = FALSE;
if (!initial) if (!initial)
meta_window_reload_property (window, XA_WM_ICON_NAME, FALSE); meta_window_reload_property (window, XA_WM_ICON_NAME, FALSE);
} }
@ -642,7 +657,10 @@ reload_wm_icon_name (MetaWindow *window,
MetaPropValue *value, MetaPropValue *value,
gboolean initial) 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", meta_verbose ("Ignoring WM_ICON_NAME \"%s\" as _NET_WM_ICON_NAME is set\n",
value->v.str); value->v.str);
@ -687,7 +705,7 @@ reload_net_wm_state (MetaWindow *window,
window->maximized_horizontally = FALSE; window->maximized_horizontally = FALSE;
window->maximized_vertically = FALSE; window->maximized_vertically = FALSE;
window->fullscreen = FALSE; window->fullscreen = FALSE;
window->wm_state_modal = FALSE; priv->wm_state_modal = FALSE;
priv->wm_state_skip_taskbar = FALSE; priv->wm_state_skip_taskbar = FALSE;
priv->wm_state_skip_pager = FALSE; priv->wm_state_skip_pager = FALSE;
window->wm_state_above = 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) else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_HIDDEN)
window->minimize_after_placement = TRUE; window->minimize_after_placement = TRUE;
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_MODAL) 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) else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SKIP_TASKBAR)
priv->wm_state_skip_taskbar = TRUE; priv->wm_state_skip_taskbar = TRUE;
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SKIP_PAGER) else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SKIP_PAGER)

View File

@ -41,6 +41,15 @@ struct _MetaWindowX11Private
/* TRUE if the client forced these on */ /* TRUE if the client forced these on */
guint wm_state_skip_taskbar : 1; guint wm_state_skip_taskbar : 1;
guint wm_state_skip_pager : 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 G_END_DECLS

View File

@ -81,6 +81,8 @@ meta_window_x11_class_init (MetaWindowX11Class *klass)
void void
meta_window_x11_set_net_wm_state (MetaWindow *window) 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; int i;
unsigned long data[13]; 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; data[i] = window->display->atom__NET_WM_STATE_SHADED;
++i; ++i;
} }
if (window->wm_state_modal) if (priv->wm_state_modal)
{ {
data[i] = window->display->atom__NET_WM_STATE_MODAL; data[i] = window->display->atom__NET_WM_STATE_MODAL;
++i; ++i;
@ -904,9 +906,9 @@ meta_window_x11_client_message (MetaWindow *window,
if (first == display->atom__NET_WM_STATE_MODAL || if (first == display->atom__NET_WM_STATE_MODAL ||
second == 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_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_x11_recalc_window_type (window);
meta_window_queue(window, META_QUEUE_MOVE_RESIZE); meta_window_queue(window, META_QUEUE_MOVE_RESIZE);
@ -1546,6 +1548,8 @@ error:
void void
meta_window_x11_recalc_window_type (MetaWindow *window) 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; MetaWindowType type;
if (window->type_atom != None) if (window->type_atom != None)
@ -1612,8 +1616,7 @@ meta_window_x11_recalc_window_type (MetaWindow *window)
type = META_WINDOW_NORMAL; type = META_WINDOW_NORMAL;
} }
if (type == META_WINDOW_DIALOG && if (type == META_WINDOW_DIALOG && priv->wm_state_modal)
window->wm_state_modal)
type = META_WINDOW_MODAL_DIALOG; type = META_WINDOW_MODAL_DIALOG;
/* We don't want to allow override-redirect windows to have decorated-window /* We don't want to allow override-redirect windows to have decorated-window