summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-05-23 11:40:28 -0400
committerraveit65 <[email protected]>2019-06-16 18:12:44 +0200
commitb6ec3af21d066d56ebf172b5720080bb79de651f (patch)
tree5bc2a9739526a99011c061298a3e9e1405893ae7 /src/core
parent79296f9d27cc4eb57a14dcf09bb93cc8571f93b4 (diff)
downloadmarco-b6ec3af21d066d56ebf172b5720080bb79de651f.tar.bz2
marco-b6ec3af21d066d56ebf172b5720080bb79de651f.tar.xz
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 upstream commit: https://gitlab.gnome.org/GNOME/metacity/commit/dfedc7df
Diffstat (limited to 'src/core')
-rw-r--r--src/core/window-private.h2
-rw-r--r--src/core/window.c58
2 files changed, 50 insertions, 10 deletions
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 50bc57be..ada9f8bb 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -542,6 +542,8 @@ void meta_window_get_geometry (MetaWindow *window,
int *y,
int *width,
int *height);
+void meta_window_get_input_rect (const MetaWindow *window,
+ MetaRectangle *rect);
void meta_window_get_outer_rect (const MetaWindow *window,
MetaRectangle *rect);
void meta_window_get_xor_rect (MetaWindow *window,
diff --git a/src/core/window.c b/src/core/window.c
index 2e202d4b..4422d797 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4161,24 +4161,62 @@ meta_window_get_geometry (MetaWindow *window,
window->size_hints.height_inc;
}
+/**
+ * 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_outer_rect (const MetaWindow *window,
+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 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)
+ {
+ 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;
+ *rect = window->rect;
- if (window->has_custom_frame_extents)
- {
- const GtkBorder *extents = &window->custom_frame_extents;
- rect->x += extents->left;
- rect->y += extents->top;
- rect->width -= extents->left + extents->right;
- rect->height -= extents->top + extents->bottom;
- }
+ if (window->has_custom_frame_extents)
+ {
+ const GtkBorder *extents = &window->custom_frame_extents;
+ rect->x += extents->left;
+ rect->y += extents->top;
+ rect->width -= extents->left + extents->right;
+ rect->height -= extents->top + extents->bottom;
+ }
}
}