Skip to content

Commit

Permalink
fix(windows): prevent ghost window from showing up on taskbar (#489)
Browse files Browse the repository at this point in the history
Co-authored-by: Osspial <osspial@gmail.com>
  • Loading branch information
amrbashir and Osspial committed Jul 21, 2022
1 parent ab2e57e commit feb2127
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/ghost-window.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": "patch"
---

On Windows, prevent ghost window from showing up in the taskbar after either several hours of use or restarting `explorer.exe`.
12 changes: 10 additions & 2 deletions src/platform_impl/windows/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,18 @@ lazy_static! {
fn create_event_target_window() -> HWND {
let window = unsafe {
CreateWindowExW(
WS_EX_NOACTIVATE | WS_EX_TRANSPARENT | WS_EX_LAYERED,
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(THREAD_EVENT_TARGET_WINDOW_CLASS.clone().as_ptr()),
PCWSTR::default(),
Default::default(),
WS_OVERLAPPED,
0,
0,
0,
Expand Down

0 comments on commit feb2127

Please sign in to comment.