summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-05-23 13:06:25 -0400
committerVictor Kareh <[email protected]>2019-06-05 10:49:37 -0400
commitb52aff0da9140a03159bf8da83e45da3baad7fc1 (patch)
tree6eeae4af6b7ef83f55c121eba85829865710f0d7 /src/ui
parent9b3afacfed0689ed36c7c10d00ca7873da3d0bb8 (diff)
downloadmarco-b52aff0da9140a03159bf8da83e45da3baad7fc1.tar.bz2
marco-b52aff0da9140a03159bf8da83e45da3baad7fc1.tar.xz
frames: apply shapes in different way
upstream commit: https://gitlab.gnome.org/GNOME/metacity/commit/cd383e72
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/frames.c56
-rw-r--r--src/ui/frames.h1
2 files changed, 53 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);
diff --git a/src/ui/frames.h b/src/ui/frames.h
index cde51e60..5019aaad 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -83,6 +83,7 @@ struct _MetaUIFrame
char *title; /* NULL once we have a layout */
guint expose_delayed : 1;
guint shape_applied : 1;
+ int dest_kind;
/* FIXME get rid of this, it can just be in the MetaFrames struct */
MetaFrameControl prelit_control;