Prevent ghost window from showing up on taskbar (#1977)

Add WS_EX_TOOLWINDOW to event target window
This commit is contained in:
Osspial 2021-08-11 14:02:40 -04:00 committed by GitHub
parent 8afeb910bd
commit f92803d80e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -596,7 +596,17 @@ fn create_event_target_window<T: 'static>() -> HWND {
unsafe {
let window = winuser::CreateWindowExW(
winuser::WS_EX_NOACTIVATE | winuser::WS_EX_TRANSPARENT | winuser::WS_EX_LAYERED,
winuser::WS_EX_NOACTIVATE
| winuser::WS_EX_TRANSPARENT
| winuser::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.
| winuser::WS_EX_TOOLWINDOW,
THREAD_EVENT_TARGET_WINDOW_CLASS.as_ptr(),
ptr::null_mut(),
0,