Skip to content

Commit

Permalink
fix(windows): fix tray event window showing up on click, closes #506 (#…
Browse files Browse the repository at this point in the history
…507)

* fix(windows): fix tray event window showing up on click, closes #506

* changefile

* change file

* changefile content
  • Loading branch information
amrbashir committed Aug 2, 2022
1 parent 3e360ff commit ad1f641
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changes/tray-ghost-window.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": "patch"
---

On Windows, fix a ghost window appearing occasionally when clicking the tray icon.
14 changes: 11 additions & 3 deletions src/platform_impl/windows/system_tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,18 @@ impl SystemTrayBuilder {
RegisterClassW(&wnd_class);

let hwnd = CreateWindowExW(
Default::default(),
WS_EX_NOACTIVATE | WS_EX_TRANSPARENT | WS_EX_LAYERED |
// WS_EX_TOOLWINDOW prevents this window from ever showing up in the taskbar, which
// we want to avoid. If you remove this style, this window won't show up in the
// taskbar *initially*, but it can show up at some later point. This can sometimes
// happen on its own after several hours have passed, although this has proven
// difficult to reproduce. Alternatively, it can be manually triggered by killing
// `explorer.exe` and then starting the process back up.
// It is unclear why the bug is triggered by waiting for several hours.
WS_EX_TOOLWINDOW,
PCWSTR(class_name.as_ptr()),
"tao_system_tray_window",
WS_OVERLAPPEDWINDOW,
PCWSTR::default(),
WS_OVERLAPPED,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
Expand Down

0 comments on commit ad1f641

Please sign in to comment.