summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2014-02-26 19:33:43 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2014-02-26 19:54:41 -0500
commitec2c3e1438592bdd5914c3c46dd138d7cab5e8df (patch)
tree815c732a6408ef5be328f4491165984d235cb80b
parentc5c3806a04cf2dd46e08355dd79cd3b0e8de934b (diff)
downloadmutter-ec2c3e1438592bdd5914c3c46dd138d7cab5e8df.tar.gz
window: Add meta_window_get_client_area_rect
-rw-r--r--src/compositor/meta-window-actor.c11
-rw-r--r--src/core/window-private.h3
-rw-r--r--src/core/window.c31
3 files changed, 35 insertions, 10 deletions
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 5513fb385..6fc5ef5df 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -1835,21 +1835,12 @@ static void
check_needs_reshape (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
- MetaFrameBorders borders;
cairo_rectangle_int_t client_area;
if (!priv->needs_reshape)
return;
- meta_frame_calc_borders (priv->window->frame, &borders);
-
- 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_get_client_area_rect (window, &client_area);
meta_window_actor_update_shape_region (self, &client_area);
diff --git a/src/core/window-private.h b/src/core/window-private.h
index d37c27d14..2d2f8ae2d 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -743,6 +743,9 @@ void meta_window_set_surface_mapped (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,
guint32 timestamp,
MetaClientType source_indication,
diff --git a/src/core/window.c b/src/core/window.c
index aa7f28493..8bbe5c411 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -5651,6 +5651,37 @@ meta_window_get_outer_rect (const MetaWindow *window,
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*
meta_window_get_startup_id (MetaWindow *window)
{