From c5d372ffd629eae89d28b37069c553049e5c7d20 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 29 Jan 2009 22:33:44 +0100 Subject: [PATCH] Handle InputShape type shaping too. Many composite apps use this to pass through clicks where they are transparent. --- openbox/client.h | 2 ++ openbox/event.c | 19 ++++++++++++++++--- openbox/frame.c | 23 ++++++++++++++++------- openbox/frame.h | 3 +++ 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/openbox/client.h b/openbox/client.h index a3d50b0e..f55c7ac6 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -246,6 +246,8 @@ struct _ObClient /*! The window uses shape extension to be non-rectangular? */ gboolean shaped; + /*! The window uses shape extension to have non-rectangular input? */ + gboolean shaped_input; /*! The window is modal, so it must be processed before any windows it is related to can be focused */ diff --git a/openbox/event.c b/openbox/event.c index 467af11c..8eb612a1 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1567,9 +1567,22 @@ static void event_handle_client(ObClient *client, XEvent *e) default: ; #ifdef SHAPE - if (extensions_shape && e->type == extensions_shape_event_basep) { - client->shaped = ((XShapeEvent*)e)->shaped; - frame_adjust_shape(client->frame); + { + int kind; + if (extensions_shape && e->type == extensions_shape_event_basep) { + switch (((XShapeEvent*)e)->kind) { + case ShapeBounding: + case ShapeClip: + client->shaped = ((XShapeEvent*)e)->shaped; + kind = ShapeBounding; + break; + case ShapeInput: + client->shaped_input = ((XShapeEvent*)e)->shaped; + kind = ShapeInput; + break; + } + frame_adjust_shape_kind(client->frame, kind); + } } #endif } diff --git a/openbox/frame.c b/openbox/frame.c index 704560bd..5e60d11c 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -267,25 +267,26 @@ void frame_adjust_theme(ObFrame *self) set_theme_statics(self); } -void frame_adjust_shape(ObFrame *self) -{ #ifdef SHAPE +void frame_adjust_shape_kind(ObFrame *self, int kind) +{ gint num; XRectangle xrect[2]; - if (!self->client->shaped) { + if (!((kind == ShapeBounding && self->client->shaped) || + (kind == ShapeInput && self->client->shaped_input))) { /* clear the shape on the frame window */ - XShapeCombineMask(ob_display, self->window, ShapeBounding, + XShapeCombineMask(ob_display, self->window, kind, self->size.left, self->size.top, None, ShapeSet); } else { /* make the frame's shape match the clients */ - XShapeCombineShape(ob_display, self->window, ShapeBounding, + XShapeCombineShape(ob_display, self->window, kind, self->size.left, self->size.top, self->client->window, - ShapeBounding, ShapeSet); + kind, ShapeSet); num = 0; if (self->decorations & OB_FRAME_DECOR_TITLEBAR) { @@ -308,9 +309,17 @@ void frame_adjust_shape(ObFrame *self) } XShapeCombineRectangles(ob_display, self->window, - ShapeBounding, 0, 0, xrect, num, + kind, 0, 0, xrect, num, ShapeUnion, Unsorted); } +} +#endif + +void frame_adjust_shape(ObFrame *self) +{ +#ifdef SHAPE + frame_adjust_shape_kind(self, ShapeBounding); + frame_adjust_shape_kind(self, ShapeInput); #endif } diff --git a/openbox/frame.h b/openbox/frame.h index fd5adf74..8687381d 100644 --- a/openbox/frame.h +++ b/openbox/frame.h @@ -205,6 +205,9 @@ void frame_free(ObFrame *self); void frame_show(ObFrame *self); void frame_hide(ObFrame *self); void frame_adjust_theme(ObFrame *self); +#ifdef SHAPE +void frame_adjust_shape_kind(ObFrame *self, int kind); +#endif void frame_adjust_shape(ObFrame *self); void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized, gboolean fake); -- 2.45.2