Fix hit-testing: prefer child frame_bufs over parents
frame_buf_at was returning the parent frame instead of child windows (titlebar, content area) because the parent was later in the list. Now prefers children (frame_bufs with parent_id set) over parents. This fixes menu titlebar click detection — clicking the titlebar now dispatches to titlebarMouseDown/menuTitleMouseDown instead of menuMouseDown, enabling menu pinning and drag-to-move.
This commit is contained in:
parent
08c0e07f6c
commit
147b9d0694
|
|
@ -3555,8 +3555,11 @@ frame_buf_at(int px, int py)
|
|||
if (!fb->scene_buf || !fb->scene_buf->node.enabled)
|
||||
continue;
|
||||
if (px >= fb->x && px < fb->x + fb->width &&
|
||||
py >= fb->y && py < fb->y + fb->height)
|
||||
hit = fb; /* last match = topmost in scene order */
|
||||
py >= fb->y && py < fb->y + fb->height) {
|
||||
/* Prefer children (more specific) over parents */
|
||||
if (!hit || fb->parent_id)
|
||||
hit = fb;
|
||||
}
|
||||
}
|
||||
return hit;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue