Add input and bounding shapes support (#2742)

Basic idea: if the window has a shape, set the parent container shape as
the union of the window shape and the shape of the frame borders.

Co-authored-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Albert Safin
2018-11-09 06:19:08 +07:00
parent 9273f67734
commit 1a85619498
12 changed files with 378 additions and 27 deletions

View File

@ -20,6 +20,7 @@
int randr_base = -1;
int xkb_base = -1;
int xkb_current_group;
int shape_base = -1;
/* After mapping/unmapping windows, a notify event is generated. However, we dont want it,
since itd trigger an infinite loop of switching between the different windows when
@ -1400,6 +1401,27 @@ void handle_event(int type, xcb_generic_event_t *event) {
return;
}
if (shape_supported && type == shape_base + XCB_SHAPE_NOTIFY) {
xcb_shape_notify_event_t *shape = (xcb_shape_notify_event_t *)event;
DLOG("shape_notify_event for window 0x%08x, shape_kind = %d, shaped = %d\n",
shape->affected_window, shape->shape_kind, shape->shaped);
Con *con = con_by_window_id(shape->affected_window);
if (con == NULL) {
LOG("Not a managed window 0x%08x, ignoring shape_notify_event\n",
shape->affected_window);
return;
}
if (shape->shape_kind == XCB_SHAPE_SK_BOUNDING ||
shape->shape_kind == XCB_SHAPE_SK_INPUT) {
x_set_shape(con, shape->shape_kind, shape->shaped);
}
return;
}
switch (type) {
case XCB_KEY_PRESS:
case XCB_KEY_RELEASE: