wl_backend: fix frame button click dispatch (close/iconify)

frame_buf_at was preferring parent frame_bufs over smaller children
(buttons), so clicks on the close/iconify button area were dispatched
to the titlebar instead. Fix by preferring the smallest frame_buf
that contains the pointer position.
This commit is contained in:
lkn 2026-05-14 23:36:34 +02:00
parent 2148671fb6
commit 0e6f2f60e8
2 changed files with 3 additions and 3 deletions

View File

@ -81,7 +81,7 @@ Priority: HIGH — needed for daily-driver use.
| # | Task | Key Files | Complexity |
|---|------|-----------|------------|
| A1 | Stacking (raise/lower via scene graph) | stacking.c, wlr_scene_node_raise/lower | Low |
| A2 | Window maximize (full/half/vertical/horizontal) | actions.c, usable area calc | Low-Medium |
| A2 | ~~Window maximize~~ | actions.c, usable area calc | ✅ Done |
| A3 | ~~Window shade (titlebar collapse)~~ | actions.c, frame buffer resize | ✅ Done |
| A4 | Workspace switching (create/destroy/switch) | workspace.c, scene tree reparenting | Medium |
| A5 | Alt-Tab window cycling + switch panel | cycling.c, switchpanel.c, vtable switchpanel_enter | Medium |

View File

@ -3774,8 +3774,8 @@ frame_buf_at(int px, int py)
continue;
if (px >= fb->x && px < fb->x + fb->width &&
py >= fb->y && py < fb->y + fb->height) {
/* Prefer children (more specific) over parents */
if (!hit || fb->parent_id)
/* Prefer the smallest (most specific) frame_buf */
if (!hit || (fb->width * fb->height < hit->width * hit->height))
hit = fb;
}
}