winit-sonoma-fix/src/platform_impl/windows
Björn Steinbrink dd32ace9ab
Restore the ability to have fully transparent windows on Windows (#1815)
* Restore the ability to have fully transparent windows on Windows

Besides its original purpose, commit 6343059b "Fix Windows transparency
behavior to support fully-opaque regions (#1621)" also included some
changes considered cleanups, one of them was:

* Remove the `CreateRectRgn` call, since we want the entire window's region to
  have blur behind it, and `DwnEnableBlurBehindWindow` does that by default.

But the original code actually disabled the blur effect for the whole
window by creating an empty region for it, because that allows for the
window to be truely fully transparent. With the blur effect in place,
the areas meant to be transparent either blur the things behind it
(until Windows 8) or are darkened (since Windows 8). This also means
that on Windows 8 and newer, the resulting colors are darker than
intended in translucent areas when the blur effect is enabled.

This restores the behaviour from winit <0.24 and fixes #1814.

Arguably, one might want to expose the ability to control the blur
region, but that is outside the scope of this commit.

* Remove useless WS_EX_LAYERED from transparent windows on Windows

`WS_EX_LAYERED` is not supposed to be used in combination with
`CS_OWNDC`. In winit, as it is currently used, `WS_EX_LAYERED` actually
has no effect at all. The only relevant call is to
`SetLayeredWindowAttributes`, which is required to make the window
visible at all with `WS_EX_LAYERED` set, but is called with full
opacity, i.e. there's no transparency involved at all.

The actual transparency is already achieved by using
`DwmEnableBlurBehindWindow`, so `WS_EX_LAYERED` and the call to
`SetLayeredWindowAttributes` can both be removed.
2021-02-17 13:50:24 +01:00
..
event_loop On Windows, fix bug where we'd try to emit MainEventsCleared events during nested win32 event loops (#1615) 2020-07-02 16:53:47 -04:00
dark_mode.rs Ability to force a theme on Windows (#1666) 2020-11-30 19:04:26 +01:00
dpi.rs On Windows, make AdjustRect calls DPI-aware when possible (#1015) 2020-01-05 14:15:11 -05:00
drop_handler.rs WIP - Make EL2 DPI changes and implement on Windows (#895) 2020-01-05 14:15:11 -05:00
event.rs Add prefix byte for extended scancodes on Windows (#1679) 2020-10-19 16:35:01 +02:00
event_loop.rs fix cursor blinking when clicking decorations bar on Windows (#1852) 2021-02-06 21:10:36 +01:00
icon.rs Add ability to create Icons from embedded resources on Windows (#1410) 2020-03-07 14:42:21 -05:00
mod.rs Add ability to assign a menu when creating a window on Windows (#1842) 2021-02-04 22:26:33 +01:00
monitor.rs Make 'primary_monitor' return 'Option<MonitorHandle>' 2020-09-07 20:20:47 +03:00
raw_input.rs Improve handling of file paths in the windows DnD handler (#980) 2019-06-28 18:07:36 -04:00
util.rs On Windows, fix request_redraw() related panics (#1461) 2020-03-07 14:04:24 -05:00
window.rs Restore the ability to have fully transparent windows on Windows (#1815) 2021-02-17 13:50:24 +01:00
window_state.rs Restore the ability to have fully transparent windows on Windows (#1815) 2021-02-17 13:50:24 +01:00