[mutter] window-props: Use the standard property type system for _NET_WM_WINDOW_TYPE
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window-props: Use the standard property type system for _NET_WM_WINDOW_TYPE
- Date: Thu, 10 Jul 2014 19:07:08 +0000 (UTC)
commit a7b7213017441ecc9e44872e2d67f783a4fdefa5
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jul 10 15:00:38 2014 -0400
window-props: Use the standard property type system for _NET_WM_WINDOW_TYPE
src/x11/window-props.c | 38 +++++++++++++++++++++++-
src/x11/window-x11.c | 73 ------------------------------------------------
src/x11/window-x11.h | 1 -
3 files changed, 36 insertions(+), 76 deletions(-)
---
diff --git a/src/x11/window-props.c b/src/x11/window-props.c
index 19e4cc4..b8b1061 100644
--- a/src/x11/window-props.c
+++ b/src/x11/window-props.c
@@ -231,7 +231,41 @@ reload_net_wm_window_type (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
- meta_window_x11_update_net_wm_type (window);
+ MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
+ MetaWindowX11Private *priv = window_x11->priv;
+
+ if (value->type != META_PROP_VALUE_INVALID)
+ {
+ int i;
+
+ for (i = 0; i < value->v.atom_list.n_atoms; i++)
+ {
+ Atom atom = value->v.atom_list.atoms[i];
+
+ /* We break as soon as we find one we recognize,
+ * supposed to prefer those near the front of the list
+ */
+ if (atom == window->display->atom__NET_WM_WINDOW_TYPE_DESKTOP ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_DOCK ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLBAR ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_MENU ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_UTILITY ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_SPLASH ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_DIALOG ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLTIP ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_COMBO ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_DND ||
+ atom == window->display->atom__NET_WM_WINDOW_TYPE_NORMAL)
+ {
+ priv->type_atom = atom;
+ meta_window_x11_recalc_window_type (window);
+ return;
+ }
+ }
+ }
}
static void
@@ -1701,7 +1735,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
{ display->atom_WM_CLIENT_LEADER, META_PROP_VALUE_INVALID, complain_about_broken_client, FALSE, FALSE },
{ display->atom_SM_CLIENT_ID, META_PROP_VALUE_INVALID, complain_about_broken_client, FALSE, FALSE },
{ display->atom_WM_WINDOW_ROLE, META_PROP_VALUE_STRING, reload_wm_window_role, TRUE, FALSE },
- { display->atom__NET_WM_WINDOW_TYPE, META_PROP_VALUE_INVALID, reload_net_wm_window_type, TRUE, TRUE },
+ { display->atom__NET_WM_WINDOW_TYPE, META_PROP_VALUE_ATOM_LIST, reload_net_wm_window_type, TRUE, TRUE },
{ display->atom__NET_WM_STRUT, META_PROP_VALUE_INVALID, reload_struts, FALSE, FALSE },
{ display->atom__NET_WM_STRUT_PARTIAL, META_PROP_VALUE_INVALID, reload_struts, FALSE, FALSE },
{ display->atom__NET_WM_BYPASS_COMPOSITOR, META_PROP_VALUE_CARDINAL, reload_bypass_compositor, FALSE,
FALSE },
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index a3019df..4b48342 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -518,8 +518,6 @@ meta_window_x11_manage (MetaWindow *window)
if (!window->override_redirect)
update_sm_hints (window); /* must come after transient_for */
- meta_window_x11_update_net_wm_type (window);
-
if (window->decorated)
meta_window_ensure_frame (window);
@@ -1587,77 +1585,6 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
}
}
-void
-meta_window_x11_update_net_wm_type (MetaWindow *window)
-{
- MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
- MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
- int n_atoms;
- Atom *atoms;
- int i;
-
- priv->type_atom = None;
- n_atoms = 0;
- atoms = NULL;
-
- meta_prop_get_atom_list (window->display, window->xwindow,
- window->display->atom__NET_WM_WINDOW_TYPE,
- &atoms, &n_atoms);
-
- i = 0;
- while (i < n_atoms)
- {
- /* We break as soon as we find one we recognize,
- * supposed to prefer those near the front of the list
- */
- if (atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_DESKTOP ||
- atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_DOCK ||
- atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_TOOLBAR ||
- atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_MENU ||
- atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_UTILITY ||
- atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_SPLASH ||
- atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_DIALOG ||
- atoms[i] ==
- window->display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU ||
- atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU ||
- atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_TOOLTIP ||
- atoms[i] ==
- window->display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION ||
- atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_COMBO ||
- atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_DND ||
- atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_NORMAL)
- {
- priv->type_atom = atoms[i];
- break;
- }
-
- ++i;
- }
-
- meta_XFree (atoms);
-
- if (meta_is_verbose ())
- {
- char *str;
-
- str = NULL;
- if (priv->type_atom != None)
- {
- meta_error_trap_push (window->display);
- str = XGetAtomName (window->display->xdisplay, priv->type_atom);
- meta_error_trap_pop (window->display);
- }
-
- meta_verbose ("Window %s type atom %s\n", window->desc,
- str ? str : "(none)");
-
- if (str)
- meta_XFree (str);
- }
-
- meta_window_x11_recalc_window_type (window);
-}
-
static void
meta_window_set_opaque_region (MetaWindow *window,
cairo_region_t *region)
diff --git a/src/x11/window-x11.h b/src/x11/window-x11.h
index 9f5ce5b..affd15e 100644
--- a/src/x11/window-x11.h
+++ b/src/x11/window-x11.h
@@ -55,7 +55,6 @@ void meta_window_x11_destroy_sync_request_alarm (MetaWindow *window);
void meta_window_x11_update_sync_request_counter (MetaWindow *window,
gint64 new_counter_value);
-void meta_window_x11_update_net_wm_type (MetaWindow *window);
void meta_window_x11_update_opaque_region (MetaWindow *window);
void meta_window_x11_update_input_region (MetaWindow *window);
void meta_window_x11_update_shape_region (MetaWindow *window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]