Commit 6140a4b
fix(linux): prevent startup panic from unrealized capsule GDK window | fix(linux): 修复胶囊窗口因 GDK 未实例化导致的启动崩溃 (#792)
* fix(linux): prevent startup panic from unrealized capsule GDK window | fix(linux): 修复胶囊窗口因 GDK 未实例化导致的启动崩溃
On Linux X11, when the capsule window is created with `visible: false` +
`transparent: true` in tauri.conf.json, its underlying GDK window is never
realized. The subsequent call to `capsule.set_ignore_cursor_events(true)`
triggers a panic inside tao's Linux event loop (event_loop.rs:457) because
`window.window().unwrap()` returns `None` for an unrealized GDK window.
The fix follows the same approach as voicebox PR#837 (PhamBit):
force GDK window realization before calling set_ignore_cursor_events, by
first moving the window off-screen and calling show(). The window is then
repositioned correctly by the existing position_capsule_bottom_center()
call and hidden as normal.
Refs:
- jamiepine/voicebox#837
- tauri-apps/tao#635
在 Linux X11 上,tauri.conf.json 中定义的 capsule 窗口设置了
visible: false + transparent: true,导致其底层 GDK 窗口从未被实例化。
随后调用 capsule.set_ignore_cursor_events(true) 时,tao 的 Linux 事件循环
(event_loop.rs:457) 因 window.window().unwrap() 返回 None 而 panic 崩溃。
修复方法参考 voicebox PR#837:在设置鼠标穿透前先将窗口移出屏幕并
调用 show() 强制 GDK 实例化,后续由原有的 position_capsule_bottom_center()
重新定位并隐藏。
* fix(linux): realize hidden capsule without showing it
---------
Co-authored-by: Chris233 <h-chris233@outlook.com>1 parent 6e79a0c commit 6140a4b
3 files changed
Lines changed: 26 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
| |||
520 | 523 | | |
521 | 524 | | |
522 | 525 | | |
523 | | - | |
524 | | - | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
525 | 547 | | |
526 | 548 | | |
527 | 549 | | |
| |||
0 commit comments