From: Mikael Magnusson Date: Mon, 2 Jan 2023 18:29:32 +0000 (+0100) Subject: Detect input shapes X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=8a0fc05dbb5fa3c489e947edf1e5ea64127786d6;p=mikachu%2Fopenbox.git Detect input shapes --- diff --git a/openbox/client.c b/openbox/client.c index dbe93aea..bdf12587 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -1384,6 +1384,7 @@ static void client_get_state(ObClient *self) static void client_get_shaped(ObClient *self) { self->shaped = FALSE; + self->shaped_input = FALSE; #ifdef SHAPE if (obt_display_extension_shape) { gint foo; @@ -1396,6 +1397,23 @@ static void client_get_shaped(ObClient *self) &foo, &ufoo, &ufoo, &foo, &foo, &foo, &ufoo, &ufoo); self->shaped = !!s; +#ifdef ShapeInput + { /* when some smart people added ShapeInput they forgot to update XShapeQueryExtents or + add a new one for input shapes, so we get to do this instead, yay! */ + int nrects, ordering; + XRectangle *input_rect = XShapeGetRectangles(obt_display, self->window, + ShapeInput, &nrects, &ordering); + if (nrects == 1 && input_rect->width == self->area.width && + input_rect->height == self->area.height && + /* openbox sets the border width of client windows to 0 */ + input_rect->x == 0 && input_rect->y == 0) { + self->shaped_input = FALSE; + } else { + self->shaped_input = TRUE; + } + XFree(input_rect); + } +#endif } #endif }