[mutter] MetaWindow: Repurpose get_outer_rect and add get_input_rect
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] MetaWindow: Repurpose get_outer_rect and add get_input_rect
- Date: Wed, 10 Aug 2011 12:42:39 +0000 (UTC)
commit a133d8b42e09ed4b633a832a632c615dc8ddf100
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Jun 29 13:37:04 2011 -0400
MetaWindow: Repurpose get_outer_rect and add get_input_rect
get_outer_rect now returns the visible region, and a new get_input_rect
method returns the boundaries of the full frame, including the possible
invisible regions. When undecorated, both do the samething.
https://bugzilla.gnome.org/show_bug.cgi?id=644930
src/core/window.c | 35 +++++++++++++++++++++++++++++++++--
src/meta/window.h | 1 +
2 files changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index d460a95..b9ba2b8 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -5158,18 +5158,49 @@ meta_window_get_geometry (MetaWindow *window,
}
/**
+ * meta_window_get_input_rect:
+ * @window: a #MetaWindow
+ * @rect: (out): pointer to an allocated #MetaRectangle
+ *
+ * Gets the rectangle that bounds @window that is responsive to mouse events.
+ * This includes decorations - the visible portion of its border - and (if
+ * present) any invisible area that we make make responsive to mouse clicks in
+ * order to allow convenient border dragging.
+ */
+void
+meta_window_get_input_rect (const MetaWindow *window,
+ MetaRectangle *rect)
+{
+ if (window->frame)
+ *rect = window->frame->rect;
+ else
+ *rect = window->rect;
+}
+
+/**
* meta_window_get_outer_rect:
* @window: a #MetaWindow
* @rect: (out): pointer to an allocated #MetaRectangle
*
- * Gets the rectangle that bounds @window and, if decorated, its decorations.
+ * Gets the rectangle that bounds @window that is responsive to mouse events.
+ * This includes only what is visible; it doesn't include any extra reactive
+ * area we add to the edges of windows.
*/
void
meta_window_get_outer_rect (const MetaWindow *window,
MetaRectangle *rect)
{
if (window->frame)
- *rect = window->frame->rect;
+ {
+ MetaFrameBorders borders;
+ *rect = window->frame->rect;
+ meta_frame_calc_borders (window->frame, &borders);
+
+ rect->x += borders.invisible.left;
+ rect->y += borders.invisible.top;
+ rect->width -= borders.invisible.left + borders.invisible.right;
+ rect->height -= borders.invisible.top + borders.invisible.bottom;
+ }
else
*rect = window->rect;
}
diff --git a/src/meta/window.h b/src/meta/window.h
index 985a146..1b4b004 100644
--- a/src/meta/window.h
+++ b/src/meta/window.h
@@ -75,6 +75,7 @@ gboolean meta_window_is_shaded (MetaWindow *window);
gboolean meta_window_is_override_redirect (MetaWindow *window);
gboolean meta_window_is_skip_taskbar (MetaWindow *window);
MetaRectangle *meta_window_get_rect (MetaWindow *window);
+void meta_window_get_input_rect (const MetaWindow *window, MetaRectangle *rect);
void meta_window_get_outer_rect (const MetaWindow *window, MetaRectangle *rect);
MetaScreen *meta_window_get_screen (MetaWindow *window);
MetaDisplay *meta_window_get_display (MetaWindow *window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]