From 031154a4002d59907102f79d2637d10266691199 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 10 Jul 2014 14:55:24 -0400 Subject: [PATCH] window-props: Use the standard property type system for WM_WINDOW_ROLE There seems to be no reason we can't just use this. --- src/x11/window-props.c | 6 ++++-- src/x11/window-x11.c | 23 ----------------------- src/x11/window-x11.h | 1 - 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/x11/window-props.c b/src/x11/window-props.c index 10b2065ba..19e4cc466 100644 --- a/src/x11/window-props.c +++ b/src/x11/window-props.c @@ -334,7 +334,9 @@ reload_wm_window_role (MetaWindow *window, MetaPropValue *value, gboolean initial) { - meta_window_x11_update_role (window); + g_clear_pointer (&window->role, g_free); + if (value->type != META_PROP_VALUE_INVALID) + window->role = g_strdup (value->v.str); } static void @@ -1698,7 +1700,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display) { display->atom__NET_WM_ICON_GEOMETRY, META_PROP_VALUE_CARDINAL_LIST, reload_icon_geometry, FALSE, FALSE }, { 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_INVALID, reload_wm_window_role, TRUE, 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_STRUT, META_PROP_VALUE_INVALID, reload_struts, FALSE, FALSE }, { display->atom__NET_WM_STRUT_PARTIAL, META_PROP_VALUE_INVALID, reload_struts, FALSE, FALSE }, diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index 45b04d2c1..a3019df94 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -1658,29 +1658,6 @@ meta_window_x11_update_net_wm_type (MetaWindow *window) meta_window_x11_recalc_window_type (window); } -void -meta_window_x11_update_role (MetaWindow *window) -{ - char *str; - - g_return_if_fail (!window->override_redirect); - - if (window->role) - g_free (window->role); - window->role = NULL; - - if (meta_prop_get_latin1_string (window->display, window->xwindow, - window->display->atom_WM_WINDOW_ROLE, - &str)) - { - window->role = g_strdup (str); - meta_XFree (str); - } - - meta_verbose ("Updated role of %s to '%s'\n", - window->desc, window->role ? window->role : "null"); -} - 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 cceb56e30..9f5ce5bec 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_role (MetaWindow *window); 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);