diff --git a/src/core/window-private.h b/src/core/window-private.h index 9b7987d06..ad8079b38 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -220,6 +220,9 @@ struct _MetaWindow /* whether net_wm_user_time has been set yet */ guint net_wm_user_time_set : 1; + + /* whether net_wm_icon_geometry has been set */ + guint icon_geometry_set : 1; /* These are the flags from WM_PROTOCOLS */ guint take_focus : 1; @@ -391,6 +394,9 @@ struct _MetaWindow */ MetaRectangle user_rect; + /* Cached net_wm_icon_geometry */ + MetaRectangle icon_geometry; + /* Requested geometry */ int border_width; /* x/y/w/h here get filled with ConfigureRequest values */ diff --git a/src/core/window-props.c b/src/core/window-props.c index 744209070..d055a39fe 100644 --- a/src/core/window-props.c +++ b/src/core/window-props.c @@ -245,6 +245,33 @@ reload_kwm_win_icon (MetaWindow *window, reload_icon (window, window->display->atom__KWM_WIN_ICON); } +static void +reload_icon_geometry (MetaWindow *window, + MetaPropValue *value, + gboolean initial) +{ + if (value->type != META_PROP_VALUE_INVALID) + { + if (value->v.cardinal_list.n_cardinals != 4) + { + meta_verbose ("_NET_WM_ICON_GEOMETRY on %s has %d values instead of 4\n", + window->desc, value->v.cardinal_list.n_cardinals); + } + else + { + window->icon_geometry.x = (int)value->v.cardinal_list.cardinals[0]; + window->icon_geometry.y = (int)value->v.cardinal_list.cardinals[1]; + window->icon_geometry.width = (int)value->v.cardinal_list.cardinals[2]; + window->icon_geometry.height = (int)value->v.cardinal_list.cardinals[3]; + window->icon_geometry_set = TRUE; + } + } + else + { + window->icon_geometry_set = FALSE; + } +} + static void reload_struts (MetaWindow *window, MetaPropValue *value, @@ -1728,7 +1755,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display) { display->atom_WM_STATE, META_PROP_VALUE_INVALID, NULL, FALSE, FALSE }, { display->atom__NET_WM_ICON, META_PROP_VALUE_INVALID, reload_net_wm_icon, FALSE, FALSE }, { display->atom__KWM_WIN_ICON, META_PROP_VALUE_INVALID, reload_kwm_win_icon, FALSE, FALSE }, - { display->atom__NET_WM_ICON_GEOMETRY, META_PROP_VALUE_INVALID, NULL, FALSE, FALSE }, + { 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, FALSE, FALSE }, diff --git a/src/core/window.c b/src/core/window.c index 253ce405d..660be66b9 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -7151,9 +7151,7 @@ send_configure_notify (MetaWindow *window) * * Gets the location of the icon corresponding to the window. The location * will be provided set by the task bar or other user interface element - * displaying the icon, and is relative to the root window. This currently - * retrieves the icon geometry from the X server as a round trip on every - * call. + * displaying the icon, and is relative to the root window. * * Return value: %TRUE if the icon geometry was succesfully retrieved. */ @@ -7161,33 +7159,12 @@ gboolean meta_window_get_icon_geometry (MetaWindow *window, MetaRectangle *rect) { - gulong *geometry = NULL; - int nitems; - g_return_val_if_fail (!window->override_redirect, FALSE); - if (meta_prop_get_cardinal_list (window->display, - window->xwindow, - window->display->atom__NET_WM_ICON_GEOMETRY, - &geometry, &nitems)) + if (window->icon_geometry_set) { - if (nitems != 4) - { - meta_verbose ("_NET_WM_ICON_GEOMETRY on %s has %d values instead of 4\n", - window->desc, nitems); - meta_XFree (geometry); - return FALSE; - } - if (rect) - { - rect->x = geometry[0]; - rect->y = geometry[1]; - rect->width = geometry[2]; - rect->height = geometry[3]; - } - - meta_XFree (geometry); + *rect = window->icon_geometry; return TRUE; }