From 0e849c06645d415563fca937823b492e3877da04 Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Wed, 14 Nov 2007 00:44:59 +0000 Subject: Fix a shaped window glitch svn path=/branches/iains-blingtastic-bucket-o-bling/; revision=3396 --- src/compositor.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/compositor.c b/src/compositor.c index 7a5764af..58b67cec 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1128,6 +1128,25 @@ determine_mode (MetaDisplay *display, } } +static gboolean +is_shaped (MetaDisplay *display, + Window xwindow) +{ + int xws, yws, xbs, ybs; + unsigned wws, hws, wbs, hbs; + int bounding_shaped, clip_shaped; + + if (META_DISPLAY_HAS_SHAPE (display)) + { + XShapeQueryExtents (display->xdisplay, xwindow, &bounding_shaped, + &xws, &yws, &wws, &hws, &clip_shaped, + &xbs, &ybs, &wbs, &hbs); + return (bounding_shaped != 0); + } + + return FALSE; +} + static void add_win (MetaScreen *screen, Window xwindow) @@ -1155,6 +1174,7 @@ add_win (MetaScreen *screen, #endif cw->damaged = FALSE; + cw->shaped = is_shaped (display, xwindow); if (cw->attrs.class == InputOnly) { cw->damage = None; @@ -1490,6 +1510,26 @@ static void process_shape (MetaCompositor *compositor, XShapeEvent *event) { + MetaCompWindow *cw = find_window_in_display (compositor->display, + event->window); + + if (cw == NULL) { + return; + } + + if (event->kind == ShapeBounding) { + if (!event->shaped && cw->shaped) { + cw->shaped = FALSE; + } + + resize_win (cw, cw->attrs.x, cw->attrs.y, + event->width + event->x, event->height + event->y, + cw->attrs.border_width, cw->attrs.override_redirect); + + if (event->shaped && !cw->shaped) { + cw->shaped = TRUE; + } + } } MetaCompositor * -- cgit v1.2.1