wayland: recursive frame_buf_hit resolves WINGs views in dialogs
frame_buf_hit now walks children recursively (up to 4 levels) instead of only checking immediate children of top-level frames. This resolves WINGs views nested inside fake_leader frames (icon chooser, message dialogs), enabling event delivery to the correct WINGs widget.
This commit is contained in:
parent
5325a51b64
commit
c9f0fc8370
|
|
@ -301,23 +301,26 @@ frame_buf_hit(int px, int py)
|
||||||
if (!fb)
|
if (!fb)
|
||||||
fb = frame_buf_button_at(px, py);
|
fb = frame_buf_button_at(px, py);
|
||||||
|
|
||||||
/* If we landed on a top-level frame (parent_id==0), check whether a
|
/* Walk children (and grandchildren) to find the most specific
|
||||||
* child sub-window (resizebar, titlebar) actually contains (px,py).
|
* frame_buf enclosing the point. Handles titlebar/resizebar buttons
|
||||||
* Child frame_bufs may not have a committed scene_buf buffer so
|
* AND WINGs views nested inside fake_leader frames. */
|
||||||
* wlr_scene_node_at skips them; we find them by coordinate instead.
|
if (fb) {
|
||||||
* Return the smallest (most specific) child that encloses the point. */
|
int depth;
|
||||||
if (fb && fb->parent_id == 0) {
|
for (depth = 0; depth < 4; depth++) {
|
||||||
struct wl_frame_buf *child, *best_child = NULL;
|
struct wl_frame_buf *child, *best_child = NULL;
|
||||||
wl_list_for_each(child, &wl_state.frame_list, link) {
|
wl_list_for_each(child, &wl_state.frame_list, link) {
|
||||||
if (child->parent_id != fb->id) continue;
|
if (child->parent_id != fb->id) continue;
|
||||||
if (px < child->x || px >= child->x + child->width) continue;
|
if (px < child->x || px >= child->x + child->width) continue;
|
||||||
if (py < child->y || py >= child->y + child->height) continue;
|
if (py < child->y || py >= child->y + child->height) continue;
|
||||||
if (!best_child ||
|
if (!best_child ||
|
||||||
(child->width * child->height) < (best_child->width * best_child->height))
|
(child->width * child->height) < (best_child->width * best_child->height))
|
||||||
best_child = child;
|
best_child = child;
|
||||||
|
}
|
||||||
|
if (best_child)
|
||||||
|
fb = best_child;
|
||||||
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (best_child)
|
|
||||||
fb = best_child;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fb;
|
return fb;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue