diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/frames.c | 53 |
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, |