fix: 标题栏拖拽区吞掉顶栏按钮的鼠标点击

gpui-component 把整条 TitleBar 标记为 WindowControlArea::Drag
(WM_NCHITTEST 返回 HTCAPTION),其上的「新建连接/钉子/主题/菜单」
按钮点击全部被系统当作拖拽标题栏处理。

给右侧按钮簇加 occlude()(HitboxBehavior::BlockMouse):hit_test
收集到 BlockMouse hitbox 即截断,父级 Drag 区不再进入命中列表。
WM_NCHITTEST 探针验证按钮区由 HTCAPTION 变为 HTCLIENT。
This commit is contained in:
2026-09-29 17:00:58 +08:00
parent 85a3bfcb1b
commit 4290ffdeeb
+5
View File
@@ -1043,6 +1043,11 @@ impl MqttXApp {
.gap_1()
.pr_2()
.items_center()
// 整条标题栏被 gpui-component 标记为 WindowControlArea::Drag
// (WM_NCHITTEST 返回 HTCAPTION),点击会变成拖动窗口。
// 按钮簇必须遮挡鼠标:hit_test 收集到 BlockMouse hitbox
// 即截断,父级 Drag 区不再命中,按钮才能收到点击。
.occlude()
.child(
Button::new("new-connection")
.icon(IconName::Plus)