summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-05-30 08:19:15 -0400
committerVictor Kareh <[email protected]>2019-06-05 10:49:37 -0400
commitebd42d4c0d0e9ca96dd3bc14906c573c99128b35 (patch)
treea65957c1f0a6a3bb999294630a8e9634b310eb0c /src/ui
parentf194c1f102370081cdd35f7f873043fd27a4fb86 (diff)
downloadmarco-ebd42d4c0d0e9ca96dd3bc14906c573c99128b35.tar.bz2
marco-ebd42d4c0d0e9ca96dd3bc14906c573c99128b35.tar.xz
frames: again change meta_frames_applet_shapes
With compositing manager: 1. Apply only client shape. Without compositing manager: 1. Apply client shape. 2. Apply shape around visible frame. upstream commit: https://gitlab.gnome.org/GNOME/metacity/commit/3913dcf1
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/frames.c92
-rw-r--r--src/ui/frames.h1
2 files changed, 29 insertions, 64 deletions
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 3cd7b81c..38975b69 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -686,7 +686,6 @@ 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);
@@ -814,7 +813,7 @@ meta_ui_frame_get_borders (MetaFrames *frames,
void
meta_frames_get_borders (MetaFrames *frames,
- Window xwindow,
+ Window xwindow,
MetaFrameBorders *borders)
{
MetaUIFrame *frame;
@@ -830,10 +829,10 @@ meta_frames_get_borders (MetaFrames *frames,
static void
meta_ui_frame_get_corner_radiuses (MetaFrames *frames,
MetaUIFrame *frame,
- float *top_left,
- float *top_right,
- float *bottom_left,
- float *bottom_right)
+ float *top_left,
+ float *top_right,
+ float *bottom_left,
+ float *bottom_right)
{
MetaFrameGeometry fgeom;
@@ -879,7 +878,6 @@ static void
apply_cairo_region_to_window (Display *display,
Window xwindow,
cairo_region_t *region,
- int dest_kind,
int op)
{
int n_rects, i;
@@ -901,7 +899,7 @@ apply_cairo_region_to_window (Display *display,
}
XShapeCombineRectangles (display, xwindow,
- dest_kind, 0, 0, rects, n_rects,
+ ShapeBounding, 0, 0, rects, n_rects,
op, YXBanded);
g_free (rects);
@@ -1084,54 +1082,29 @@ meta_frames_apply_shapes (MetaFrames *frames,
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);
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
- meta_frames_calc_geometry (frames, frame, &fgeom);
-
- if (!(fgeom.top_left_corner_rounded_radius != 0 ||
- fgeom.top_right_corner_rounded_radius != 0 ||
- fgeom.bottom_left_corner_rounded_radius != 0 ||
- fgeom.bottom_right_corner_rounded_radius != 0 ||
- window_has_shape))
+ if (frame->shape_applied)
{
- if (frame->shape_applied)
- {
- meta_topic (META_DEBUG_SHAPES,
- "Unsetting shape mask on frame 0x%lx\n",
- frame->xwindow);
-
- XShapeCombineMask (display, frame->xwindow,
- ShapeBounding, 0, 0, None, ShapeSet);
- XShapeCombineMask (display, frame->xwindow,
- ShapeClip, 0, 0, None, ShapeSet);
- frame->shape_applied = FALSE;
- }
- else
- {
- meta_topic (META_DEBUG_SHAPES,
- "Frame 0x%lx still doesn't need a shape mask\n",
- frame->xwindow);
- }
+ meta_topic (META_DEBUG_SHAPES,
+ "Unsetting shape mask on frame 0x%lx\n",
+ frame->xwindow);
- return; /* nothing to do */
+ XShapeCombineMask (display, frame->xwindow,
+ ShapeBounding, 0, 0, None, ShapeSet);
+ frame->shape_applied = FALSE;
}
- compositing_manager = meta_prefs_get_compositing_manager ();
+ meta_frames_calc_geometry (frames, frame, &fgeom);
- dest_kind = ShapeClip;
- if (!compositing_manager)
- dest_kind = ShapeBounding;
+ compositing_manager = meta_prefs_get_compositing_manager ();
- if (frame->dest_kind != dest_kind)
- {
- XShapeCombineMask (display, frame->xwindow,
- frame->dest_kind, 0, 0, None, ShapeSet);
- }
+ if (!window_has_shape && compositing_manager)
+ return;
window_region = get_visible_region (frames,
frame,
@@ -1165,8 +1138,8 @@ meta_frames_apply_shapes (MetaFrames *frames,
attrs.override_redirect = True;
- shape_window = XCreateWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
- RootWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), screen_number),
+ shape_window = XCreateWindow (display,
+ RootWindow (display, screen_number),
-5000, -5000,
new_window_width,
new_window_height,
@@ -1178,11 +1151,11 @@ meta_frames_apply_shapes (MetaFrames *frames,
&attrs);
/* Copy the client's shape to the temporary shape_window */
- meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow,
+ meta_core_get (display, frame->xwindow,
META_CORE_GET_CLIENT_XWINDOW, &client_window,
META_CORE_GET_END);
- XShapeCombineShape (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), shape_window, ShapeBounding,
+ XShapeCombineShape (display, shape_window, ShapeBounding,
fgeom.borders.total.left,
fgeom.borders.total.top,
client_window,
@@ -1204,26 +1177,19 @@ meta_frames_apply_shapes (MetaFrames *frames,
cairo_region_destroy (client_region);
- apply_cairo_region_to_window (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), shape_window,
- tmp_region, ShapeBounding, ShapeUnion);
+ apply_cairo_region_to_window (display, shape_window,
+ tmp_region, 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,
+ XShapeCombineShape (display, frame->xwindow, ShapeBounding,
0, 0,
shape_window,
ShapeBounding,
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);
- }
+ XDestroyWindow (display, shape_window);
}
else
{
@@ -1233,12 +1199,12 @@ meta_frames_apply_shapes (MetaFrames *frames,
"Frame 0x%lx has shaped corners\n",
frame->xwindow);
- apply_cairo_region_to_window (display,
- frame->xwindow, window_region,
- dest_kind, ShapeSet);
+ if (!compositing_manager)
+ apply_cairo_region_to_window (display,
+ frame->xwindow, window_region,
+ 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 5019aaad..cde51e60 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -83,7 +83,6 @@ 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;