summaryrefslogtreecommitdiff
path: root/src/ui/frames.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/frames.c')
-rw-r--r--src/ui/frames.c56
1 files changed, 52 insertions, 4 deletions
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 1ea60bbc..8fcdd9fa 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -686,6 +686,7 @@ meta_frames_manage_window (MetaFrames *frames,
frame->title = NULL;
frame->expose_delayed = FALSE;
frame->shape_applied = FALSE;
+ frame->dest_kind = ShapeBounding;
frame->prelit_control = META_FRAME_CONTROL_NONE;
meta_core_grab_buttons (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow);
@@ -1055,6 +1056,20 @@ get_client_region (MetaFrameGeometry *fgeom,
return cairo_region_create_rectangle (&rect);
}
+static cairo_region_t *
+get_frame_region (int window_width,
+ int window_height)
+{
+ cairo_rectangle_int_t rect;
+
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = window_width;
+ rect.height = window_height;
+
+ return cairo_region_create_rectangle (&rect);
+}
+
void
meta_frames_apply_shapes (MetaFrames *frames,
Window xwindow,
@@ -1068,6 +1083,8 @@ meta_frames_apply_shapes (MetaFrames *frames,
MetaFrameGeometry fgeom;
cairo_region_t *window_region;
Display *display;
+ gboolean compositing_manager;
+ int dest_kind;
frame = meta_frames_lookup_window (frames, xwindow);
g_return_if_fail (frame != NULL);
@@ -1090,6 +1107,8 @@ meta_frames_apply_shapes (MetaFrames *frames,
XShapeCombineMask (display, frame->xwindow,
ShapeBounding, 0, 0, None, ShapeSet);
+ XShapeCombineMask (display, frame->xwindow,
+ ShapeClip, 0, 0, None, ShapeSet);
frame->shape_applied = FALSE;
}
else
@@ -1102,6 +1121,18 @@ meta_frames_apply_shapes (MetaFrames *frames,
return; /* nothing to do */
}
+ compositing_manager = meta_prefs_get_compositing_manager ();
+
+ dest_kind = ShapeClip;
+ if (!compositing_manager)
+ dest_kind = ShapeBounding;
+
+ if (frame->dest_kind != dest_kind)
+ {
+ XShapeCombineMask (display, frame->xwindow,
+ frame->dest_kind, 0, 0, None, ShapeSet);
+ }
+
window_region = get_visible_region (frames,
frame,
&fgeom,
@@ -1119,7 +1150,9 @@ meta_frames_apply_shapes (MetaFrames *frames,
XSetWindowAttributes attrs;
Window shape_window;
Window client_window;
+ cairo_region_t *frame_region;
cairo_region_t *client_region;
+ cairo_region_t *tmp_region;
GdkScreen *screen;
int screen_number;
@@ -1159,16 +1192,22 @@ meta_frames_apply_shapes (MetaFrames *frames,
/* Punch the client area out of the normal frame shape,
* then union it with the shape_window's existing shape
*/
+ frame_region = get_frame_region (new_window_width,
+ new_window_height);
client_region = get_client_region (&fgeom,
new_window_width,
new_window_height);
- cairo_region_subtract (window_region, client_region);
+ tmp_region = compositing_manager ? frame_region : window_region;
+
+ cairo_region_subtract (tmp_region, client_region);
cairo_region_destroy (client_region);
apply_cairo_region_to_window (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), shape_window,
- window_region, ShapeBounding, ShapeUnion);
+ tmp_region, ShapeBounding, ShapeUnion);
+
+ cairo_region_destroy (frame_region);
/* Now copy shape_window shape to the real frame */
XShapeCombineShape (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, ShapeBounding,
@@ -1178,6 +1217,13 @@ meta_frames_apply_shapes (MetaFrames *frames,
ShapeSet);
XDestroyWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), shape_window);
+
+ if (compositing_manager)
+ {
+ apply_cairo_region_to_window (display,
+ frame->xwindow, window_region,
+ dest_kind, ShapeSet);
+ }
}
else
{
@@ -1187,10 +1233,12 @@ meta_frames_apply_shapes (MetaFrames *frames,
"Frame 0x%lx has shaped corners\n",
frame->xwindow);
- apply_cairo_region_to_window (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow,
- window_region, ShapeBounding, ShapeSet);
+ apply_cairo_region_to_window (display,
+ frame->xwindow, window_region,
+ dest_kind, ShapeSet);
}
+ frame->dest_kind = dest_kind;
frame->shape_applied = TRUE;
cairo_region_destroy (window_region);