summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/frame-private.h7
-rw-r--r--src/core/frame.c13
-rw-r--r--src/include/ui.h8
-rw-r--r--src/ui/frames.c34
-rw-r--r--src/ui/frames.h8
-rw-r--r--src/ui/ui.c13
6 files changed, 83 insertions, 0 deletions
diff --git a/src/core/frame-private.h b/src/core/frame-private.h
index d7183149..811ac624 100644
--- a/src/core/frame-private.h
+++ b/src/core/frame-private.h
@@ -59,10 +59,17 @@ void meta_frame_queue_draw (MetaFrame *frame);
MetaFrameFlags meta_frame_get_flags (MetaFrame *frame);
+void meta_frame_get_corner_radiuses (MetaFrame *frame,
+ float *top_left,
+ float *top_right,
+ float *bottom_left,
+ float *bottom_right);
+
gboolean meta_frame_sync_to_window (MetaFrame *frame,
int gravity,
gboolean need_move,
gboolean need_resize);
+
cairo_region_t *meta_frame_get_frame_bounds (MetaFrame *frame);
void meta_frame_set_screen_cursor (MetaFrame *frame,
diff --git a/src/core/frame.c b/src/core/frame.c
index b6ed741e..a2da9cb9 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -338,6 +338,19 @@ update_shape (MetaFrame *frame)
return FALSE;
}
+void
+meta_frame_get_corner_radiuses (MetaFrame *frame,
+ float *top_left,
+ float *top_right,
+ float *bottom_left,
+ float *bottom_right)
+{
+ meta_ui_get_corner_radiuses (frame->window->screen->ui,
+ frame->xwindow,
+ top_left, top_right,
+ bottom_left, bottom_right);
+}
+
gboolean
meta_frame_sync_to_window (MetaFrame *frame,
int resize_gravity,
diff --git a/src/include/ui.h b/src/include/ui.h
index 40ae03cf..26d0d462 100644
--- a/src/include/ui.h
+++ b/src/include/ui.h
@@ -102,6 +102,13 @@ cairo_region_t *meta_ui_get_frame_bounds (MetaUI *ui,
int window_width,
int window_height);
+void meta_ui_get_corner_radiuses (MetaUI *ui,
+ Window xwindow,
+ float *top_left,
+ float *top_right,
+ float *bottom_left,
+ float *bottom_right);
+
void meta_ui_queue_frame_draw (MetaUI *ui,
Window xwindow);
@@ -111,6 +118,7 @@ void meta_ui_set_frame_title (MetaUI *ui,
void meta_ui_update_frame_style (MetaUI *ui,
Window window);
+
void meta_ui_repaint_frame (MetaUI *ui,
Window xwindow);
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 9c3f3296..1af79765 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,
diff --git a/src/ui/frames.h b/src/ui/frames.h
index 0af5ed89..cde51e60 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -144,6 +144,14 @@ cairo_region_t *meta_frames_get_frame_bounds (MetaFrames *frames,
Window xwindow,
int window_width,
int window_height);
+
+void meta_frames_get_corner_radiuses (MetaFrames *frames,
+ Window xwindow,
+ float *top_left,
+ float *top_right,
+ float *bottom_left,
+ float *bottom_right);
+
void meta_frames_move_resize_frame (MetaFrames *frames,
Window xwindow,
int x,
diff --git a/src/ui/ui.c b/src/ui/ui.c
index a7058066..c805869f 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -302,6 +302,19 @@ meta_ui_get_frame_borders (MetaUI *ui,
meta_frames_get_borders (ui->frames, frame_xwindow, borders);
}
+void
+meta_ui_get_corner_radiuses (MetaUI *ui,
+ Window xwindow,
+ float *top_left,
+ float *top_right,
+ float *bottom_left,
+ float *bottom_right)
+{
+ meta_frames_get_corner_radiuses (ui->frames, xwindow,
+ top_left, top_right,
+ bottom_left, bottom_right);
+}
+
static void
set_background_none (Display *xdisplay,
Window xwindow)