Skip to content

Commit 326c156

Browse files
committed
Fix title bar buttons and Windows tray hide
- Remove ui.interact() drag overlay that was stealing click events from the close/minimize buttons. Revert to inner.response.drag_started() which only fires on the background area. - Use ViewportCommand::Visible(false/true) instead of Minimized on Windows so the window fully disappears from the taskbar when minimized to tray, and reappears on restore.
1 parent e158fb0 commit 326c156

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/gui.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,7 @@ impl AcceleratorApp {
578578
},
579579
);
580580

581-
// Enable drag on the title bar for window movement
582-
let title_bar_response =
583-
ui.interact(inner.response.rect, ui.id().with("title_bar_drag"), egui::Sense::drag());
584-
if title_bar_response.drag_started() {
581+
if inner.response.drag_started() {
585582
ctx.send_viewport_cmd(egui::ViewportCommand::StartDrag);
586583
}
587584

@@ -1298,7 +1295,7 @@ impl AcceleratorApp {
12981295
let _ = tray.tray_icon.set_visible(true);
12991296
self.hidden_to_tray = true;
13001297
self.last_minimized = true;
1301-
ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(true));
1298+
ctx.send_viewport_cmd(egui::ViewportCommand::Visible(false));
13021299
ctx.request_repaint();
13031300
} else {
13041301
self.feedback = "托盘不可用,已退回系统最小化".to_string();
@@ -1385,7 +1382,7 @@ impl AcceleratorApp {
13851382
if let Some(tray) = &self.tray {
13861383
let _ = tray.tray_icon.set_visible(false);
13871384
}
1388-
ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(false));
1385+
ctx.send_viewport_cmd(egui::ViewportCommand::Visible(true));
13891386
ctx.send_viewport_cmd(egui::ViewportCommand::Focus);
13901387
ctx.request_repaint();
13911388
}

0 commit comments

Comments
 (0)