[Xfce4-commits] <xfwm4:master> Fix bug #6651 Shape Mask Changes not Immediately Recognized by Xfwm4
Olivier Fourdan
noreply at xfce.org
Mon Dec 6 21:02:01 CET 2010
Updating branch refs/heads/master
to 2b90f0ffa73d6e7a175e4525ef5f821fa93140b7 (commit)
from 2eb96726496a12afb24d19d0eed01acf8ee71de9 (commit)
commit 2b90f0ffa73d6e7a175e4525ef5f821fa93140b7
Author: Olivier Fourdan <fourdan at xfce.org>
Date: Mon Dec 6 11:03:11 2010 +0100
Fix bug #6651 Shape Mask Changes not Immediately Recognized by Xfwm4
Fix ShapeInput handling causing issues with audacity
(and possibly others).
src/display.c | 8 ++++++
src/display.h | 1 +
src/events.c | 15 +++++++---
src/frame.c | 76 +++++++++++++++++++++++++++++++++++++++-----------------
src/frame.h | 1 +
src/screen.c | 7 +++++
src/screen.h | 1 +
7 files changed, 81 insertions(+), 28 deletions(-)
diff --git a/src/display.c b/src/display.c
index 6ca9bca..27792ed 100644
--- a/src/display.c
+++ b/src/display.c
@@ -399,6 +399,14 @@ myDisplayHaveShape (DisplayInfo *display)
}
gboolean
+myDisplayHaveShapeInput (DisplayInfo *display)
+{
+ g_return_val_if_fail (display != NULL, FALSE);
+
+ return ((display->have_shape) && (display->shape_version >= 1001));
+}
+
+gboolean
myDisplayHaveRender (DisplayInfo *display)
{
g_return_val_if_fail (display != NULL, FALSE);
diff --git a/src/display.h b/src/display.h
index f305274..a2293d4 100644
--- a/src/display.h
+++ b/src/display.h
@@ -360,6 +360,7 @@ struct _DisplayInfo
DisplayInfo *myDisplayInit (GdkDisplay *);
DisplayInfo *myDisplayClose (DisplayInfo *);
gboolean myDisplayHaveShape (DisplayInfo *);
+gboolean myDisplayHaveShapeInput (DisplayInfo *);
gboolean myDisplayHaveRender (DisplayInfo *);
Cursor myDisplayGetCursorBusy (DisplayInfo *);
Cursor myDisplayGetCursorMove (DisplayInfo *);
diff --git a/src/events.c b/src/events.c
index 07658e4..167f7af 100644
--- a/src/events.c
+++ b/src/events.c
@@ -2134,19 +2134,24 @@ handleShape (DisplayInfo *display_info, XShapeEvent * ev)
if (c)
{
update = FALSE;
- if (ev->kind == ShapeBounding)
+ if (ev->kind == ShapeInput)
+ {
+ frameSetShapeInput (c);
+ update = TRUE;
+ }
+ else if (ev->kind == ShapeBounding)
{
if ((ev->shaped) && !FLAG_TEST (c->flags, CLIENT_FLAG_HAS_SHAPE))
{
- FLAG_SET (c->flags, CLIENT_FLAG_HAS_SHAPE);
- clientGetMWMHints (c, TRUE);
update = TRUE;
+ FLAG_SET (c->flags, CLIENT_FLAG_HAS_SHAPE);
+ clientGetMWMHints (c, update);
}
else if (!(ev->shaped) && FLAG_TEST (c->flags, CLIENT_FLAG_HAS_SHAPE))
{
- FLAG_UNSET (c->flags, CLIENT_FLAG_HAS_SHAPE);
- clientGetMWMHints (c, TRUE);
update = TRUE;
+ FLAG_UNSET (c->flags, CLIENT_FLAG_HAS_SHAPE);
+ clientGetMWMHints (c, update);
}
}
if (!update)
diff --git a/src/frame.c b/src/frame.c
index 3601029..4ef8545 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -595,7 +595,6 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
{
ScreenInfo *screen_info;
DisplayInfo *display_info;
- Window shape_win;
XRectangle rect;
xfwmPixmap *my_pixmap;
int i;
@@ -611,7 +610,14 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
return;
}
- shape_win = XCreateSimpleWindow (display_info->dpy, c->frame, 0, 0, frameWidth (c), frameHeight (c), 0, 0, 0);
+ if (screen_info->shape_win == None)
+ {
+ screen_info->shape_win = XCreateSimpleWindow (display_info->dpy, screen_info->xroot, 0, 0, frameWidth (c), frameHeight (c), 0, 0, 0);
+ }
+ else
+ {
+ XResizeWindow (display_info->dpy, screen_info->shape_win, frameWidth (c), frameHeight (c));
+ }
if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED))
{
@@ -619,7 +625,7 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
rect.y = 0;
rect.width = frameWidth (c);
rect.height = frameHeight (c);
- XShapeCombineRectangles (display_info->dpy, shape_win, ShapeBounding, 0, 0, &rect, 1, ShapeSubtract, Unsorted);
+ XShapeCombineRectangles (display_info->dpy, screen_info->shape_win, ShapeBounding, 0, 0, &rect, 1, ShapeSubtract, Unsorted);
}
else if (!FLAG_TEST (c->flags, CLIENT_FLAG_HAS_SHAPE))
{
@@ -627,11 +633,11 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
rect.y = frameTop (c);
rect.width = c->width;
rect.height = c->height;
- XShapeCombineRectangles (display_info->dpy, shape_win, ShapeBounding, 0, 0, &rect, 1, ShapeSet, Unsorted);
+ XShapeCombineRectangles (display_info->dpy, screen_info->shape_win, ShapeBounding, 0, 0, &rect, 1, ShapeSet, Unsorted);
}
else
{
- XShapeCombineShape (display_info->dpy, shape_win, ShapeBounding, frameLeft (c),
+ XShapeCombineShape (display_info->dpy, screen_info->shape_win, ShapeBounding, frameLeft (c),
frameTop (c), c->window, ShapeBounding, ShapeSet);
}
if (frame_pix)
@@ -751,20 +757,20 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
{
if (xfwmWindowVisible (&c->sides[SIDE_LEFT]))
{
- XShapeCombineShape (display_info->dpy, shape_win, ShapeBounding, 0, frameTop (c),
+ XShapeCombineShape (display_info->dpy, screen_info->shape_win, ShapeBounding, 0, frameTop (c),
MYWINDOW_XWINDOW (c->sides[SIDE_LEFT]), ShapeBounding, ShapeUnion);
}
if (xfwmWindowVisible (&c->sides[SIDE_RIGHT]))
{
- XShapeCombineShape (display_info->dpy, shape_win, ShapeBounding, frameWidth (c) - frameRight (c), frameTop (c),
+ XShapeCombineShape (display_info->dpy, screen_info->shape_win, ShapeBounding, frameWidth (c) - frameRight (c), frameTop (c),
MYWINDOW_XWINDOW (c->sides[SIDE_RIGHT]), ShapeBounding, ShapeUnion);
}
}
if (xfwmWindowVisible (&c->title))
{
- XShapeCombineShape (display_info->dpy, shape_win, ShapeBounding,
+ XShapeCombineShape (display_info->dpy, screen_info->shape_win, ShapeBounding,
frameTopLeftWidth (c, state), 0,
MYWINDOW_XWINDOW (c->title), ShapeBounding, ShapeUnion);
}
@@ -772,13 +778,13 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
if (xfwmWindowVisible (&c->corners[CORNER_TOP_LEFT]))
{
- XShapeCombineShape (display_info->dpy, shape_win, ShapeBounding, 0, 0,
+ XShapeCombineShape (display_info->dpy, screen_info->shape_win, ShapeBounding, 0, 0,
MYWINDOW_XWINDOW (c->corners[CORNER_TOP_LEFT]), ShapeBounding, ShapeUnion);
}
if (xfwmWindowVisible (&c->sides[SIDE_BOTTOM]))
{
- XShapeCombineShape (display_info->dpy, shape_win, ShapeBounding,
+ XShapeCombineShape (display_info->dpy, screen_info->shape_win, ShapeBounding,
screen_info->corners[CORNER_BOTTOM_LEFT][state].width,
frameHeight (c) - frameBottom (c),
MYWINDOW_XWINDOW (c->sides[SIDE_BOTTOM]), ShapeBounding, ShapeUnion);
@@ -786,7 +792,7 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
if (xfwmWindowVisible (&c->sides[SIDE_TOP]))
{
- XShapeCombineShape (display_info->dpy, shape_win, ShapeBounding,
+ XShapeCombineShape (display_info->dpy, screen_info->shape_win, ShapeBounding,
screen_info->corners[CORNER_BOTTOM_LEFT][state].width,
frameTop (c) - frameBottom (c),
MYWINDOW_XWINDOW (c->sides[SIDE_TOP]), ShapeBounding, ShapeUnion);
@@ -794,14 +800,14 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
if (xfwmWindowVisible (&c->corners[CORNER_BOTTOM_LEFT]))
{
- XShapeCombineShape (display_info->dpy, shape_win, ShapeBounding, 0,
+ XShapeCombineShape (display_info->dpy, screen_info->shape_win, ShapeBounding, 0,
frameHeight (c) - screen_info->corners[CORNER_BOTTOM_LEFT][state].height,
MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_LEFT]), ShapeBounding, ShapeUnion);
}
if (xfwmWindowVisible (&c->corners[CORNER_BOTTOM_RIGHT]))
{
- XShapeCombineShape (display_info->dpy, shape_win, ShapeBounding,
+ XShapeCombineShape (display_info->dpy, screen_info->shape_win, ShapeBounding,
frameWidth (c) - screen_info->corners[CORNER_BOTTOM_RIGHT][state].width,
frameHeight (c) - screen_info->corners[CORNER_BOTTOM_RIGHT][state].height,
MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_RIGHT]), ShapeBounding, ShapeUnion);
@@ -809,7 +815,7 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
if (xfwmWindowVisible (&c->corners[CORNER_TOP_RIGHT]))
{
- XShapeCombineShape (display_info->dpy, shape_win, ShapeBounding,
+ XShapeCombineShape (display_info->dpy, screen_info->shape_win, ShapeBounding,
frameWidth (c) - frameTopRightWidth (c, state),
0, MYWINDOW_XWINDOW (c->corners[CORNER_TOP_RIGHT]), ShapeBounding, ShapeUnion);
}
@@ -818,7 +824,7 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
{
if (xfwmWindowVisible (&c->buttons[i]))
{
- XShapeCombineShape (display_info->dpy, shape_win, ShapeBounding, button_x[i],
+ XShapeCombineShape (display_info->dpy, screen_info->shape_win, ShapeBounding, button_x[i],
(frameTop (c) - screen_info->buttons[i][state].height + 1) / 2,
MYWINDOW_XWINDOW (c->buttons[i]), ShapeBounding, ShapeUnion);
}
@@ -828,17 +834,41 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
rect.y = 0;
rect.width = frameWidth (c);
rect.height = frameHeight (c);
- XShapeCombineRectangles (display_info->dpy, shape_win, ShapeBounding, 0, 0, &rect, 1, ShapeIntersect, Unsorted);
- XShapeCombineShape (display_info->dpy, c->frame, ShapeBounding, 0, 0, shape_win, ShapeBounding, ShapeSet);
+ XShapeCombineRectangles (display_info->dpy, screen_info->shape_win, ShapeBounding, 0, 0, &rect, 1, ShapeIntersect, Unsorted);
+ XShapeCombineShape (display_info->dpy, c->frame, ShapeBounding, 0, 0, screen_info->shape_win, ShapeBounding, ShapeSet);
+}
- /* Set Input shape when using XShape extension 1.1 and later */
- if (display_info->shape_version >= 1001)
+void
+frameSetShapeInput (Client * c)
+{
+ ScreenInfo *screen_info;
+ DisplayInfo *display_info;
+
+ TRACE ("entering frameSetShapeInput");
+ TRACE ("setting shape input for client (0x%lx)", c->window);
+
+ screen_info = c->screen_info;
+ display_info = screen_info->display_info;
+
+ if (!myDisplayHaveShapeInput(display_info))
+ {
+ return;
+ }
+
+ if (screen_info->shape_win == None)
+ {
+ screen_info->shape_win = XCreateSimpleWindow (display_info->dpy, screen_info->xroot, 0, 0, frameWidth (c), frameHeight (c), 0, 0, 0);
+ }
+ else
{
- XShapeCombineShape (display_info->dpy, shape_win, ShapeInput, frameLeft (c), frameTop (c), c->window, ShapeBounding, ShapeSubtract);
- XShapeCombineShape (display_info->dpy, shape_win, ShapeInput, frameLeft (c), frameTop (c), c->window, ShapeInput, ShapeUnion);
- XShapeCombineShape (display_info->dpy, c->frame, ShapeInput, 0, 0, shape_win, ShapeInput, ShapeSet);
+ XResizeWindow (display_info->dpy, screen_info->shape_win, frameWidth (c), frameHeight (c));
}
- XDestroyWindow (display_info->dpy, shape_win);
+
+ /* Set Input shape when using XShape extension 1.1 and later */
+ XShapeCombineShape(display_info->dpy, screen_info->shape_win, ShapeInput, 0, 0, c->frame, ShapeBounding, ShapeSet);
+ XShapeCombineShape(display_info->dpy, screen_info->shape_win, ShapeInput, frameLeft (c), frameTop (c), c->window, ShapeBounding, ShapeSubtract);
+ XShapeCombineShape(display_info->dpy, screen_info->shape_win, ShapeInput, frameLeft (c), frameTop (c), c->window, ShapeInput, ShapeUnion);
+ XShapeCombineShape(display_info->dpy, c->frame, ShapeInput, 0, 0, screen_info->shape_win, ShapeInput, ShapeSet);
}
static void
diff --git a/src/frame.h b/src/frame.h
index 5fe63a8..90472e7 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -44,6 +44,7 @@ int frameX (Client *);
int frameY (Client *);
int frameWidth (Client *);
int frameHeight (Client *);
+void frameSetShapeInput (Client *);
void frameClearQueueDraw (Client *);
void frameQueueDraw (Client *,
gboolean);
diff --git a/src/screen.c b/src/screen.c
index 4570fc4..8b8bd1c 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -180,6 +180,7 @@ myScreenInit (DisplayInfo *display_info, GdkScreen *gscr, unsigned long event_ma
screen_info->width = WidthOfScreen (screen_info->xscreen);
screen_info->height = HeightOfScreen (screen_info->xscreen);
screen_info->visual = DefaultVisual (display_info->dpy, screen_info->screen);
+ screen_info->shape_win = (Window) None;
screen_info->xfwm4_win = GDK_WINDOW_XWINDOW (screen_info->gtk_win->window);
if (!myScreenSetWMAtom (screen_info, replace_wm))
@@ -338,6 +339,12 @@ myScreenClose (ScreenInfo *screen_info)
screen_info->workspace_names = NULL;
screen_info->workspace_names_items = 0;
+ if (screen_info->shape_win != None)
+ {
+ XDestroyWindow (display_info->dpy, screen_info->shape_win);
+ screen_info->shape_win = (Window) None;
+ }
+
xfwmWindowDelete (&screen_info->sidewalk[0]);
xfwmWindowDelete (&screen_info->sidewalk[1]);
xfwmWindowDelete (&screen_info->sidewalk[2]);
diff --git a/src/screen.h b/src/screen.h
index 894e96c..3f0348f 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -108,6 +108,7 @@ struct _ScreenInfo
xfwmWindow sidewalk[4];
Window xfwm4_win;
Window xroot;
+ Window shape_win;
gint gnome_margins[4];
gint margins[4];
More information about the Xfce4-commits
mailing list