diff --git a/ChangeLog b/ChangeLog index e3fcb21dc..22c605d88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-25 Thomas Wood + + * src/ui/preview-widget.[ch] (meta_preview_get_clip_region): + allow users of the preview widget to get a mask for windows + in the correct shape for the current theme. + 2008-02-23 Thomas Thurman Refactor handling of boolean preferences. diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c index 08048e7b7..57bb8b313 100644 --- a/src/ui/preview-widget.c +++ b/src/ui/preview-widget.c @@ -460,3 +460,112 @@ meta_preview_get_mini_icon (void) return default_icon; } + +GdkRegion * +meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint new_window_height) +{ + GdkRectangle xrect; + GdkRegion *corners_xregion, *window_xregion; + gint flags; + MetaFrameLayout *fgeom; + MetaFrameStyle *frame_style; + + g_return_if_fail (META_IS_PREVIEW (preview)); + + flags = (META_PREVIEW (preview)->flags); + + frame_style = meta_theme_get_frame_style (preview->theme, + META_FRAME_TYPE_NORMAL, flags); + + fgeom = frame_style->layout; + + corners_xregion = gdk_region_new (); + + if (fgeom->top_left_corner_rounded_radius != 0) + { + const int corner = fgeom->top_left_corner_rounded_radius; + const float radius = sqrt(corner) + corner; + int i; + + for (i=0; itop_right_corner_rounded_radius != 0) + { + const int corner = fgeom->top_right_corner_rounded_radius; + const float radius = sqrt(corner) + corner; + int i; + + for (i=0; ibottom_left_corner_rounded_radius != 0) + { + const int corner = fgeom->bottom_left_corner_rounded_radius; + const float radius = sqrt(corner) + corner; + int i; + + for (i=0; ibottom_right_corner_rounded_radius != 0) + { + const int corner = fgeom->bottom_right_corner_rounded_radius; + const float radius = sqrt(corner) + corner; + int i; + + for (i=0; i