window: Add meta_window_get_client_area_rect

This commit is contained in:
Jasper St. Pierre 2014-02-26 19:33:43 -05:00
parent c5c3806a04
commit ec2c3e1438
3 changed files with 35 additions and 10 deletions

View File

@ -1835,21 +1835,12 @@ static void
check_needs_reshape (MetaWindowActor *self) check_needs_reshape (MetaWindowActor *self)
{ {
MetaWindowActorPrivate *priv = self->priv; MetaWindowActorPrivate *priv = self->priv;
MetaFrameBorders borders;
cairo_rectangle_int_t client_area; cairo_rectangle_int_t client_area;
if (!priv->needs_reshape) if (!priv->needs_reshape)
return; return;
meta_frame_calc_borders (priv->window->frame, &borders); meta_window_get_client_area_rect (window, &client_area);
client_area.x = borders.total.left;
client_area.y = borders.total.top;
client_area.width = priv->window->rect.width;
if (priv->window->shaded)
client_area.height = 0;
else
client_area.height = priv->window->rect.height;
meta_window_actor_update_shape_region (self, &client_area); meta_window_actor_update_shape_region (self, &client_area);

View File

@ -743,6 +743,9 @@ void meta_window_set_surface_mapped (MetaWindow *window,
Window meta_window_get_toplevel_xwindow (MetaWindow *window); Window meta_window_get_toplevel_xwindow (MetaWindow *window);
void meta_window_get_client_area_rect (const MetaWindow *window,
cairo_rectangle_int_t *rect);
void meta_window_activate_full (MetaWindow *window, void meta_window_activate_full (MetaWindow *window,
guint32 timestamp, guint32 timestamp,
MetaClientType source_indication, MetaClientType source_indication,

View File

@ -5651,6 +5651,37 @@ meta_window_get_outer_rect (const MetaWindow *window,
meta_window_get_frame_rect (window, rect); meta_window_get_frame_rect (window, rect);
} }
/**
* meta_window_get_client_area_rect:
* @window: a #MetaWindow
* @rect: (out): pointer to a cairo rectangle
*
* Gets the rectangle for the boundaries of the client area, relative
* to the frame. If the window is shaded, the height of the rectangle
* is 0.
*/
void
meta_window_get_client_area_rect (const MetaWindow *window,
cairo_rectangle_int_t *rect)
{
if (window->frame)
{
rect->x = window->frame->child_x;
rect->y = window->frame->child_y;
}
else
{
rect->x = 0;
rect->y = 0;
}
rect->width = window->rect.width;
if (window->shaded)
rect->height = window->rect.height;
else
rect->height = 0;
}
const char* const char*
meta_window_get_startup_id (MetaWindow *window) meta_window_get_startup_id (MetaWindow *window)
{ {