From 4d9d66da65174905ae4fe4f573526934a5ad88fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 23 Jan 2013 01:11:23 +0100 Subject: [PATCH] window: Add set_icon_geometry() method Using a public method for setting the (cached) icon geometry rather than accessing the struct members directly allows setting the icon geometry from extensions. https://bugzilla.gnome.org/show_bug.cgi?id=692997 --- src/core/window-props.c | 15 +++++++++------ src/core/window.c | 24 ++++++++++++++++++++++++ src/meta/window.h | 2 ++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/core/window-props.c b/src/core/window-props.c index d055a39fe..448704d5f 100644 --- a/src/core/window-props.c +++ b/src/core/window-props.c @@ -259,16 +259,19 @@ reload_icon_geometry (MetaWindow *window, } 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; + MetaRectangle geometry; + + geometry.x = (int)value->v.cardinal_list.cardinals[0]; + geometry.y = (int)value->v.cardinal_list.cardinals[1]; + geometry.width = (int)value->v.cardinal_list.cardinals[2]; + geometry.height = (int)value->v.cardinal_list.cardinals[3]; + + meta_window_set_icon_geometry (window, &geometry); } } else { - window->icon_geometry_set = FALSE; + meta_window_set_icon_geometry (window, NULL); } } diff --git a/src/core/window.c b/src/core/window.c index 660be66b9..9f131ea5a 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -7172,6 +7172,30 @@ meta_window_get_icon_geometry (MetaWindow *window, return FALSE; } +/** + * meta_window_set_icon_geometry: + * @window: a #MetaWindow + * @rect: (allow-none): rectangle with the desired geometry or %NULL. + * + * Sets or unsets the location of the icon corresponding to the window. If + * set, the location should correspond to a dock, task bar or other user + * interface element displaying the icon, and is relative to the root window. + */ +void +meta_window_set_icon_geometry (MetaWindow *window, + MetaRectangle *rect) +{ + if (rect) + { + window->icon_geometry = *rect; + window->icon_geometry_set = TRUE; + } + else + { + window->icon_geometry_set = FALSE; + } +} + static Window read_client_leader (MetaDisplay *display, Window xwindow) diff --git a/src/meta/window.h b/src/meta/window.h index 4d74bafe6..d968ecca6 100644 --- a/src/meta/window.h +++ b/src/meta/window.h @@ -149,6 +149,8 @@ gboolean meta_window_is_mapped (MetaWindow *window); gboolean meta_window_toplevel_is_mapped (MetaWindow *window); gboolean meta_window_get_icon_geometry (MetaWindow *window, MetaRectangle *rect); +void meta_window_set_icon_geometry (MetaWindow *window, + MetaRectangle *rect); void meta_window_maximize (MetaWindow *window, MetaMaximizeFlags directions); void meta_window_unmaximize (MetaWindow *window,