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

@ -6,6 +6,7 @@
- **Breaking:** On Web, remove the `stdweb` backend. - **Breaking:** On Web, remove the `stdweb` backend.
- Added `Window::focus_window`to bring the window to the front and set input focus. - Added `Window::focus_window`to bring the window to the front and set input focus.
- On Wayland and X11, implement `is_maximized` method on `Window`. - On Wayland and X11, implement `is_maximized` method on `Window`.
- On Windows, prevent ghost window from showing up in the taskbar after either several hours of use or restarting `explorer.exe`.
- On macOS, fix issue where `ReceivedCharacter` was not being emitted during some key repeat events. - On macOS, fix issue where `ReceivedCharacter` was not being emitted during some key repeat events.
- On Wayland, load cursor icons `hand2` and `hand1` for `CursorIcon::Hand`. - On Wayland, load cursor icons `hand2` and `hand1` for `CursorIcon::Hand`.

View file

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