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
This commit is contained in:
Florian Müllner 2013-01-23 01:11:23 +01:00
parent 30bdadb519
commit 4d9d66da65
3 changed files with 35 additions and 6 deletions

View File

@ -259,16 +259,19 @@ reload_icon_geometry (MetaWindow *window,
} }
else else
{ {
window->icon_geometry.x = (int)value->v.cardinal_list.cardinals[0]; MetaRectangle geometry;
window->icon_geometry.y = (int)value->v.cardinal_list.cardinals[1];
window->icon_geometry.width = (int)value->v.cardinal_list.cardinals[2]; geometry.x = (int)value->v.cardinal_list.cardinals[0];
window->icon_geometry.height = (int)value->v.cardinal_list.cardinals[3]; geometry.y = (int)value->v.cardinal_list.cardinals[1];
window->icon_geometry_set = TRUE; 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 else
{ {
window->icon_geometry_set = FALSE; meta_window_set_icon_geometry (window, NULL);
} }
} }

View File

@ -7172,6 +7172,30 @@ meta_window_get_icon_geometry (MetaWindow *window,
return FALSE; 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 static Window
read_client_leader (MetaDisplay *display, read_client_leader (MetaDisplay *display,
Window xwindow) Window xwindow)

View File

@ -149,6 +149,8 @@ gboolean meta_window_is_mapped (MetaWindow *window);
gboolean meta_window_toplevel_is_mapped (MetaWindow *window); gboolean meta_window_toplevel_is_mapped (MetaWindow *window);
gboolean meta_window_get_icon_geometry (MetaWindow *window, gboolean meta_window_get_icon_geometry (MetaWindow *window,
MetaRectangle *rect); MetaRectangle *rect);
void meta_window_set_icon_geometry (MetaWindow *window,
MetaRectangle *rect);
void meta_window_maximize (MetaWindow *window, void meta_window_maximize (MetaWindow *window,
MetaMaximizeFlags directions); MetaMaximizeFlags directions);
void meta_window_unmaximize (MetaWindow *window, void meta_window_unmaximize (MetaWindow *window,