[mutter] window: Add meta_window_get_client_area_rect
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window: Add meta_window_get_client_area_rect
- Date: Thu, 27 Feb 2014 00:47:31 +0000 (UTC)
commit ad43cbd70b465af824a9181ee29b84807f8036be
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Feb 26 19:33:43 2014 -0500
window: Add meta_window_get_client_area_rect
src/compositor/meta-window-actor.c | 11 +----------
src/core/window-private.h | 3 +++
src/core/window.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 35 insertions(+), 10 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index cbd4df4..6eeeaa7 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -2084,21 +2084,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);
meta_window_actor_update_input_region (self, &client_area);
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 74e568f..93e3e2d 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -698,4 +698,7 @@ void meta_window_set_opacity (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);
+
#endif
diff --git a/src/core/window.c b/src/core/window.c
index 6405b23..115a93d 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -5832,6 +5832,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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]