Stop shaping the frame window

In preparation for switching to handling the output shape purely by what we
paint, stop applying a shape to the frame of the window. Even when we restore
handling the output shape, this will change the behavior with respect to input;
transparent areas between the frame and the contents will stop clicks rather
than passing them through, but that is arguably at least as expected
considering how that we decorate shaped windows with a frame all around.

https://bugzilla.gnome.org/show_bug.cgi?id=644930
This commit is contained in:
Jasper St. Pierre 2011-07-09 17:58:05 -04:00
parent f76372dd7d
commit 183bcd6fc7
7 changed files with 0 additions and 271 deletions

View File

@ -1696,13 +1696,6 @@ event_callback (XEvent *event,
"Window %s shape changed\n",
window->desc);
}
if (window->frame)
{
window->frame->need_reapply_frame_shape = TRUE;
meta_warning("from event callback\n");
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
}
}
}
else
@ -4100,8 +4093,6 @@ meta_display_queue_retheme_all_windows (MetaDisplay *display)
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
if (window->frame)
{
window->frame->need_reapply_frame_shape = TRUE;
meta_frame_queue_draw (window->frame);
}

View File

@ -67,7 +67,6 @@ meta_window_ensure_frame (MetaWindow *window)
frame->current_cursor = 0;
frame->mapped = FALSE;
frame->need_reapply_frame_shape = TRUE;
frame->is_flashing = FALSE;
meta_verbose ("Framing window %s: visual %s default, depth %d default depth %d\n",
@ -167,14 +166,6 @@ meta_window_ensure_frame (MetaWindow *window)
/* Move keybindings to frame instead of window */
meta_window_grab_keys (window);
/* Shape mask */
meta_ui_apply_frame_shape (frame->window->screen->ui,
frame->xwindow,
frame->rect.width,
frame->rect.height,
frame->window->has_shape);
frame->need_reapply_frame_shape = FALSE;
meta_display_ungrab (window->display);
}
@ -329,35 +320,12 @@ meta_frame_calc_geometry (MetaFrame *frame,
*geomp = geom;
}
static gboolean
update_shape (MetaFrame *frame)
{
if (frame->need_reapply_frame_shape)
{
meta_ui_apply_frame_shape (frame->window->screen->ui,
frame->xwindow,
frame->rect.width,
frame->rect.height,
frame->window->has_shape);
frame->need_reapply_frame_shape = FALSE;
return TRUE;
}
else
return FALSE;
}
gboolean
meta_frame_sync_to_window (MetaFrame *frame,
int resize_gravity,
gboolean need_move,
gboolean need_resize)
{
if (!(need_move || need_resize))
{
return update_shape (frame);
}
meta_topic (META_DEBUG_GEOMETRY,
"Syncing frame geometry %d,%d %dx%d (SE: %d,%d)\n",
frame->rect.x, frame->rect.y,
@ -372,19 +340,8 @@ meta_frame_sync_to_window (MetaFrame *frame,
frame->xwindow,
frame->rect.width,
frame->rect.height);
/* we need new shape if we're resized */
frame->need_reapply_frame_shape = TRUE;
}
/* Done before the window resize, because doing it before means
* part of the window being resized becomes unshaped, which may
* be sort of hard to see with bg = None. If we did it after
* window resize, part of the window being resized would become
* shaped, which might be more visible.
*/
update_shape (frame);
meta_ui_move_resize_frame (frame->window->screen->ui,
frame->xwindow,
frame->rect.x,

View File

@ -3334,14 +3334,6 @@ meta_window_maximize_internal (MetaWindow *window,
if (maximize_horizontally || maximize_vertically)
window->force_save_user_rect = FALSE;
/* Fix for #336850: If the frame shape isn't reapplied, it is
* possible that the frame will retains its rounded corners. That
* happens if the client's size when maximized equals the unmaximized
* size.
*/
if (window->frame)
window->frame->need_reapply_frame_shape = TRUE;
recalc_window_features (window);
set_net_wm_state (window);

View File

@ -862,39 +862,6 @@ meta_frames_unflicker_bg (MetaFrames *frames,
set_background_none (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow);
}
#ifdef HAVE_SHAPE
static void
apply_cairo_region_to_window (Display *display,
Window xwindow,
cairo_region_t *region,
int op)
{
int n_rects, i;
XRectangle *rects;
n_rects = cairo_region_num_rectangles (region);
rects = g_new (XRectangle, n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (region, i, &rect);
rects[i].x = rect.x;
rects[i].y = rect.y;
rects[i].width = rect.width;
rects[i].height = rect.height;
}
XShapeCombineRectangles (display, xwindow,
ShapeBounding, 0, 0, rects, n_rects,
op, YXBanded);
g_free (rects);
}
#endif
static cairo_region_t *
get_bounds_region (MetaFrames *frames,
MetaUIFrame *frame,
@ -996,161 +963,6 @@ get_bounds_region (MetaFrames *frames,
return bounds_region;
}
static cairo_region_t *
get_client_region (MetaFrameGeometry *fgeom,
int window_width,
int window_height)
{
cairo_rectangle_int_t rect;
rect.x = fgeom->left_width;
rect.y = fgeom->top_height;
rect.width = window_width - fgeom->right_width - rect.x;
rect.height = window_height - fgeom->bottom_height - rect.y;
return cairo_region_create_rectangle (&rect);
}
void
meta_frames_apply_shapes (MetaFrames *frames,
Window xwindow,
int new_window_width,
int new_window_height,
gboolean window_has_shape)
{
#ifdef HAVE_SHAPE
/* Apply shapes as if window had new_window_width, new_window_height */
MetaUIFrame *frame;
MetaFrameGeometry fgeom;
cairo_region_t *window_region;
Display *display;
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)
{
meta_topic (META_DEBUG_SHAPES,
"Unsetting shape mask on frame 0x%lx\n",
frame->xwindow);
XShapeCombineMask (display, frame->xwindow,
ShapeBounding, 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);
}
return; /* nothing to do */
}
window_region = get_bounds_region (frames, frame,
&fgeom,
new_window_width, new_window_height);
if (window_has_shape)
{
/* The client window is oclock or something and has a shape
* mask. To avoid a round trip to get its shape region, we
* create a fake window that's never mapped, build up our shape
* on that, then combine. Wasting the window is assumed cheaper
* than a round trip, but who really knows for sure.
*/
XSetWindowAttributes attrs;
Window shape_window;
Window client_window;
cairo_region_t *client_region;
GdkScreen *screen;
int screen_number;
meta_topic (META_DEBUG_SHAPES,
"Frame 0x%lx needs to incorporate client shape\n",
frame->xwindow);
screen = gtk_widget_get_screen (GTK_WIDGET (frames));
screen_number = gdk_x11_screen_get_screen_number (screen);
attrs.override_redirect = True;
shape_window = XCreateWindow (display,
RootWindow (display, screen_number),
-5000, -5000,
new_window_width,
new_window_height,
0,
CopyFromParent,
CopyFromParent,
(Visual *)CopyFromParent,
CWOverrideRedirect,
&attrs);
/* Copy the client's shape to the temporary shape_window */
meta_core_get (display, frame->xwindow,
META_CORE_GET_CLIENT_XWINDOW, &client_window,
META_CORE_GET_END);
XShapeCombineShape (display, shape_window, ShapeBounding,
fgeom.left_width,
fgeom.top_height,
client_window,
ShapeBounding,
ShapeSet);
/* Punch the client area out of the normal frame shape,
* then union it with the shape_window's existing shape
*/
client_region = get_client_region (&fgeom,
new_window_width,
new_window_height);
cairo_region_subtract (window_region, client_region);
cairo_region_destroy (client_region);
apply_cairo_region_to_window (display, shape_window,
window_region, ShapeUnion);
/* Now copy shape_window shape to the real frame */
XShapeCombineShape (display, frame->xwindow, ShapeBounding,
0, 0,
shape_window,
ShapeBounding,
ShapeSet);
XDestroyWindow (display, shape_window);
}
else
{
/* No shape on the client, so just do simple stuff */
meta_topic (META_DEBUG_SHAPES,
"Frame 0x%lx has shaped corners\n",
frame->xwindow);
apply_cairo_region_to_window (display, frame->xwindow,
window_region, ShapeSet);
}
frame->shape_applied = TRUE;
cairo_region_destroy (window_region);
#endif /* HAVE_SHAPE */
}
cairo_region_t *
meta_frames_get_frame_bounds (MetaFrames *frames,
Window xwindow,

View File

@ -145,11 +145,6 @@ void meta_frames_unflicker_bg (MetaFrames *frames,
int target_width,
int target_height);
void meta_frames_apply_shapes (MetaFrames *frames,
Window xwindow,
int new_window_width,
int new_window_height,
gboolean window_has_shape);
cairo_region_t *meta_frames_get_frame_bounds (MetaFrames *frames,
Window xwindow,
int window_width,

View File

@ -465,18 +465,6 @@ meta_ui_reset_frame_bg (MetaUI *ui,
meta_frames_reset_bg (ui->frames, xwindow);
}
void
meta_ui_apply_frame_shape (MetaUI *ui,
Window xwindow,
int new_window_width,
int new_window_height,
gboolean window_has_shape)
{
meta_frames_apply_shapes (ui->frames, xwindow,
new_window_width, new_window_height,
window_has_shape);
}
cairo_region_t *
meta_ui_get_frame_bounds (MetaUI *ui,
Window xwindow,

View File

@ -99,12 +99,6 @@ void meta_ui_unflicker_frame_bg (MetaUI *ui,
void meta_ui_reset_frame_bg (MetaUI *ui,
Window xwindow);
void meta_ui_apply_frame_shape (MetaUI *ui,
Window xwindow,
int new_window_width,
int new_window_height,
gboolean window_has_shape);
cairo_region_t *meta_ui_get_frame_bounds (MetaUI *ui,
Window xwindow,
int window_width,