From 0e6f2f60e86eca4c3fe072ad3726947aa8057889 Mon Sep 17 00:00:00 2001 From: lkn Date: Thu, 14 May 2026 23:36:34 +0200 Subject: [PATCH] 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. --- WAYLAND_ROADMAP.md | 2 +- src/backend/wayland/wl_backend.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WAYLAND_ROADMAP.md b/WAYLAND_ROADMAP.md index 9781199..3b0d6e6 100644 --- a/WAYLAND_ROADMAP.md +++ b/WAYLAND_ROADMAP.md @@ -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 | diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 002ec15..80920b6 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -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; } }