summaryrefslogtreecommitdiff
path: root/src/ui/frames.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-05-22 11:12:24 -0400
committerraveit65 <[email protected]>2019-06-16 18:12:44 +0200
commit1949834b11b508af71332ca92ddcce7a9733d1fd (patch)
treed5d84b1877e06b8daec8777fd2b36eeea4575ebd /src/ui/frames.c
parent5bef622c7857b7736e706a72619a03fdbe7fa7bb (diff)
downloadmarco-1949834b11b508af71332ca92ddcce7a9733d1fd.tar.bz2
marco-1949834b11b508af71332ca92ddcce7a9733d1fd.tar.xz
frame: Add "get_corner_radiuses" chain
https://bugzilla.gnome.org/show_bug.cgi?id=628195 upstream commit: https://gitlab.gnome.org/GNOME/metacity/commit/3994d7a0
Diffstat (limited to 'src/ui/frames.c')
-rw-r--r--src/ui/frames.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 18539e19..37bf6cc0 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -806,6 +806,40 @@ meta_frames_get_borders (MetaFrames *frames,
borders->visible.right *= scale;
}
+void
+meta_frames_get_corner_radiuses (MetaFrames *frames,
+ Window xwindow,
+ 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
+ * a mysterious sqrt() added to the corner radiuses:
+ *
+ * const float radius = sqrt(corner) + corner;
+ *
+ * It's unclear why the radius is calculated like this, but we
+ * need to be consistent with it.
+ */
+
+ if (top_left)
+ *top_left = fgeom.top_left_corner_rounded_radius + sqrt(fgeom.top_left_corner_rounded_radius);
+ if (top_right)
+ *top_right = fgeom.top_right_corner_rounded_radius + sqrt(fgeom.top_right_corner_rounded_radius);
+ if (bottom_left)
+ *bottom_left = fgeom.bottom_left_corner_rounded_radius + sqrt(fgeom.bottom_left_corner_rounded_radius);
+ if (bottom_right)
+ *bottom_right = fgeom.bottom_right_corner_rounded_radius + sqrt(fgeom.bottom_right_corner_rounded_radius);
+}
+
#ifdef HAVE_SHAPE
static void
apply_cairo_region_to_window (Display *display,