summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-05-22 11:17:09 -0400
committerVictor Kareh <[email protected]>2019-06-05 10:49:37 -0400
commitbfafcf554cda8b3f2c4e35aec3fbc033d63f8bba (patch)
tree66253a4704bfdc06d0f4911678c9aebc1133b752
parentb925581e37b2ac2ffdb97469fbfb284aac93feab (diff)
downloadmarco-bfafcf554cda8b3f2c4e35aec3fbc033d63f8bba.tar.bz2
marco-bfafcf554cda8b3f2c4e35aec3fbc033d63f8bba.tar.xz
MetaFrames: factor out MetaUIFrame accessors for borders, corner radiuses
This makes it a bit simpler for other functions on a MetaUIFrame to get this information. Bug: https://bugzilla.gnome.org/show_bug.cgi?id=697758 Reviewed-by: Jasper St. Pierre <[email protected]> Signed-off-by: Simon McVittie <[email protected]> upstream commit: https://gitlab.gnome.org/GNOME/metacity/commit/79384de0
-rw-r--r--src/ui/frames.c53
1 files changed, 38 insertions, 15 deletions
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 1af79765..fff3b684 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -763,22 +763,15 @@ meta_frames_lookup_window (MetaFrames *frames,
return frame;
}
-void
-meta_frames_get_borders (MetaFrames *frames,
- Window xwindow,
- MetaFrameBorders *borders)
+static void
+meta_ui_frame_get_borders (MetaFrames *frames,
+ MetaUIFrame *frame,
+ MetaFrameBorders *borders)
{
MetaFrameFlags flags;
- MetaUIFrame *frame;
MetaFrameType type;
gint scale;
- frame = meta_frames_lookup_window (frames, xwindow);
- scale = gdk_window_get_scale_factor (frame->window);
-
- if (frame == NULL)
- meta_bug ("No such frame 0x%lx\n", xwindow);
-
meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_FRAME_TYPE, &type,
@@ -786,6 +779,8 @@ meta_frames_get_borders (MetaFrames *frames,
g_return_if_fail (type < META_FRAME_TYPE_LAST);
+ scale = gdk_window_get_scale_factor (frame->window);
+
meta_frames_ensure_layout (frames, frame);
/* We can't get the full geometry, because that depends on
@@ -807,18 +802,30 @@ meta_frames_get_borders (MetaFrames *frames,
}
void
-meta_frames_get_corner_radiuses (MetaFrames *frames,
+meta_frames_get_borders (MetaFrames *frames,
Window xwindow,
+ MetaFrameBorders *borders)
+{
+ MetaUIFrame *frame;
+
+ frame = meta_frames_lookup_window (frames, xwindow);
+
+ if (frame == NULL)
+ g_error ("No such frame 0x%lx\n", xwindow);
+
+ meta_ui_frame_get_borders (frames, frame, borders);
+}
+
+static void
+meta_ui_frame_get_corner_radiuses (MetaFrames *frames,
+ MetaUIFrame *frame,
float *top_left,
float *top_right,
float *bottom_left,
float *bottom_right)
{
- MetaUIFrame *frame;
MetaFrameGeometry fgeom;
- frame = meta_frames_lookup_window (frames, xwindow);
-
meta_frames_calc_geometry (frames, frame, &fgeom);
/* For compatibility with the code in get_visible_rect(), there's
@@ -840,6 +847,22 @@ meta_frames_get_corner_radiuses (MetaFrames *frames,
*bottom_right = fgeom.bottom_right_corner_rounded_radius + sqrt(fgeom.bottom_right_corner_rounded_radius);
}
+void
+meta_frames_get_corner_radiuses (MetaFrames *frames,
+ Window xwindow,
+ float *top_left,
+ float *top_right,
+ float *bottom_left,
+ float *bottom_right)
+{
+ MetaUIFrame *frame;
+
+ frame = meta_frames_lookup_window (frames, xwindow);
+
+ meta_ui_frame_get_corner_radiuses (frames, frame, top_left, top_right,
+ bottom_left, bottom_right);
+}
+
#ifdef HAVE_SHAPE
static void
apply_cairo_region_to_window (Display *display,