Commit eeba2de
committed
fix: forward InputMethodQuery to searchEdit for correct IME candidate window positioning
Override inputMethodQuery() virtual function in InputEventItem to forward input method queries to searchEdit. When IME queries cursor position for candidate window placement, the function forwards the query to searchEdit and maps the returned cursor rectangle coordinates from searchEdit's local coordinate system to InputEventItem's coordinate system. This ensures the candidate window appears at the correct position near the search box while keeping focus on InputEventItem.
Changes:
- Add inputMethodSource property to InputEventItem for specifying the text control to forward queries to
- Override inputMethodQuery() to forward queries and map coordinates for ImCursorRectangle
- Set inputMethodSource to searchEdit and add focus property in FullscreenFrame and WindowedFrame
- Remove redundant ImEnabled override as SearchEdit already returns correct state
重写 InputEventItem 的 inputMethodQuery() 虚函数,将输入法查询转发给 searchEdit。当输入法查询光标位置以定位候选框时,该函数将查询转发给 searchEdit,并将返回的光标矩形坐标从 searchEdit 的局部坐标系映射到 InputEventItem 的坐标系。这确保候选框出现在搜索框附近的正确位置,同时焦点保持在 InputEventItem 上。
修改内容:
- 为 InputEventItem 添加 inputMethodSource 属性,用于指定转发查询的文本控件
- 重写 inputMethodQuery() 以转发查询并映射 ImCursorRectangle 的坐标
- 在 FullscreenFrame 和 WindowedFrame 中设置 inputMethodSource 为 searchEdit 并添加 focus 属性
- 移除冗余的 ImEnabled 覆盖,因为 SearchEdit 已经返回正确状态
PMS: BUG-3017431 parent 3cc4074 commit eeba2de
4 files changed
Lines changed: 42 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
15 | 42 | | |
16 | 43 | | |
17 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
23 | 33 | | |
24 | 34 | | |
25 | 35 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
0 commit comments