summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2015-02-09 23:42:25 +0200
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2015-02-19 00:20:40 +0200
commit3913dcf180c1067fece9330ae7eb4794b3ff3b50 (patch)
tree7fa58bb556acef21ef4876ce38478617cbdafc3f
parent42bdfedbc87225c3bb09a22e7b8eff04d35467f7 (diff)
downloadmetacity-3913dcf180c1067fece9330ae7eb4794b3ff3b50.tar.gz
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.
-rw-r--r--src/ui/frames.c82
-rw-r--r--src/ui/frames.h1
2 files changed, 24 insertions, 59 deletions
diff --git a/src/ui/frames.c b/src/ui/frames.c
index f3e1a1dc..134faf67 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -666,7 +666,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);
@@ -825,7 +824,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;
@@ -847,7 +845,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);
@@ -1020,54 +1018,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,
@@ -1101,8 +1074,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,
@@ -1114,11 +1087,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,
@@ -1140,26 +1113,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
{
@@ -1169,12 +1135,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 01d51a56..4f8705e5 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -81,7 +81,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;