From 8d6f571e735951cf12b05e0a8e6e098a028fadb0 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Thu, 2 Oct 2025 17:09:53 +0800 Subject: [PATCH] opt: allow use cursor to select ime popup item --- src/fetch/common.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/fetch/common.h b/src/fetch/common.h index d913d60..afa49f6 100644 --- a/src/fetch/common.h +++ b/src/fetch/common.h @@ -110,10 +110,6 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, for (layer = NUM_LAYERS - 1; !surface && layer >= 0; layer--) { - // ignore text-input layer - if (layer == LyrIMPopup) - continue; - if (layer == LyrFadeOut) continue; @@ -124,12 +120,20 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, surface = wlr_scene_surface_try_from_buffer( wlr_scene_buffer_from_node(node)) ->surface; - /* Walk the tree to find a node that knows the client */ - for (pnode = node; pnode && !c; pnode = &pnode->parent->node) - c = pnode->data; - if (c && c->type == LayerShell) { + + /* start from the topmost layer, + find a sureface that can be focused by pointer, + impopup neither a client nor a layer surface.*/ + if (layer == LyrIMPopup) { c = NULL; - l = pnode->data; + l = NULL; + } else { + for (pnode = node; pnode && !c; pnode = &pnode->parent->node) + c = pnode->data; + if (c && c->type == LayerShell) { + c = NULL; + l = pnode->data; + } } }