draw leaf window decorations on ->frame instead of ->parent->frame

related to https://github.com/i3/i3/issues/3724
fixes https://github.com/i3/i3/issues/1966
This commit is contained in:
Michael Stapelberg
2022-11-03 23:11:32 +01:00
committed by Michael Stapelberg
parent 6e6af01b7a
commit d26ddcbfe5
14 changed files with 186 additions and 131 deletions

View File

@ -214,18 +214,30 @@ static void handle_motion_notify(xcb_motion_notify_event_t *event) {
return;
/* see over which rect the user is */
Con *current;
TAILQ_FOREACH_REVERSE (current, &(con->nodes_head), nodes_head, nodes) {
if (!rect_contains(current->deco_rect, event->event_x, event->event_y))
continue;
if (con->window != NULL) {
if (rect_contains(con->deco_rect, event->event_x, event->event_y)) {
/* We found the rect, lets see if this window is focused */
if (TAILQ_FIRST(&(con->parent->focus_head)) == con)
return;
/* We found the rect, lets see if this window is focused */
if (TAILQ_FIRST(&(con->focus_head)) == current)
con_focus(con);
x_push_changes(croot);
return;
}
} else {
Con *current;
TAILQ_FOREACH_REVERSE (current, &(con->nodes_head), nodes_head, nodes) {
if (!rect_contains(current->deco_rect, event->event_x, event->event_y))
continue;
con_focus(current);
x_push_changes(croot);
return;
/* We found the rect, lets see if this window is focused */
if (TAILQ_FIRST(&(con->focus_head)) == current)
return;
con_focus(current);
x_push_changes(croot);
return;
}
}
}
@ -318,15 +330,9 @@ static void handle_configure_request(xcb_configure_request_event_t *event) {
Con *fullscreen = con_get_fullscreen_covering_ws(workspace);
if (fullscreen != con && con_is_floating(con) && con_is_leaf(con)) {
/* find the height for the decorations */
int deco_height = con->deco_rect.height;
/* we actually need to apply the size/position changes to the *parent*
* container */
Rect bsr = con_border_style_rect(con);
if (con->border_style == BS_NORMAL) {
bsr.y += deco_height;
bsr.height -= deco_height;
}
Con *floatingcon = con->parent;
Rect newrect = floatingcon->rect;