We allow to have RunLoop running only on the main thread. Which means if
we call Window::request_redraw() from other the thread then we have to
wait until some other event arrives on the main thread. That situation
is even worse when we have ControlFlow set to the `Wait` mode then user
will not ever render anything.
* Fix for #1850
* Update changelog
* Fix for compilation warnings
* Apply suggestions from code review
Co-authored-by: Markus Røyset <maroider@protonmail.com>
* Improve code quality
* Change Arc<Mutex> to Rc<RefCell>
* Panicking in the user callback is now well defined
* Address feedback
* Fix nightly warning
* The panic info is now not a global.
* Apply suggestions from code review
Co-authored-by: Francesca Lovebloom <francesca@brainiumstudios.com>
* Address feedback
Co-authored-by: Markus Røyset <maroider@protonmail.com>
Co-authored-by: Francesca Lovebloom <francesca@brainiumstudios.com>
* 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.
* Add DeviceEvent::MouseMove on web platform to support pointer lock
* Update changelog
* Add support for stdweb too
* Add mouse_delta to stdweb
* Remove reference to pointer lock
* Link CGDisplayCreateUUIDFromDisplayID through ColorSync instead of CoreGraphics
* Conditionally link through ColorSync only if WINIT_LINK_COLORSYNC is set
to true
* Document new macos env var in README
Following the changes in [1] this bumps ndk and ndk-glue to 0.3 and uses
the new constants. The minor version has been bumped to prevent
applications from running an older winit (without #1826) with a newer
ndk/ndk-glue that does not pass this `ident` through the `data` pointer
anymore.
[1]: https://github.com/rust-windowing/android-ndk-rs/pull/112
The issue was caused by calling SetCapture on a window which already
had the capture. The WM_CAPTURECHANGED handler assumed that it would
only run if the capture was lost, but that wasn't the case. This made
the handler to try to lock the window state mutex while it was already
locked.
The issue was introduced in #1797 (932cbe4).
ndk-glue currently sets both the `ident` field and user-data pointer to
`0` or `1` for the event pipe and input queue respectively, to tell
these sources apart. While it works to reinterpret this `data` pointer
as integer identifier it shouldn't be abused for that, in particular
when one may wish to provide extra information with an event in the
future; then the `data` field is used as pointer (or abused as abstract
value) for that.
This commit forwards "unknown" Wayland mouse buttons downstream via
'MouseButton::Other'. Possible values for those could be found in
<linux/input-event-codes.h>.
Also, since Wayland just forwards buttons from the kernel, which are
'u16', we must adjust 'MouseButton::Other' to take 'u16' instead of
'u8'.
This commit introduces a cross platform way to request a user attention
to the window via a 'request_user_attention' method on a Window struct.
This method is inspired by macOS's 'request_user_attention' method and
thus reuses its signature and semantics to some extent.
* Fix WindowEvent::ReceivedCharacter on web
The event was never sent to the application because of the unconditional
preventDefault() call on keydown.
Fixes#1741
* Don't scroll when pressing space on a focused canvas
After reaching keypress, we should prevent further propagation.
Relates to #1741
Aborting compilation by using 'compile_error!' macro in build.rs was resulting in failing cross
compilation, thus this commit removes build.rs. The compilation will now be aborted on existing 'compile_error!' macros in corresponding platform sources.
Building window with 'set_min_inner_size' was setting 'max_inner_size'
under the hood, thus completely disabling window resize, since
the window isn't resizeable on Wayland when its minimum size
is equal to its maximum size.