Overhaul the keyboard API in winit to mimic the W3C specification
to achieve better crossplatform parity. The `KeyboardInput` event
is now uses `KeyEvent` which consists of:
- `physical_key` - a cross platform way to refer to scancodes;
- `logical_key` - keysym value, which shows your key respecting the
layout;
- `text` - the text produced by this keypress;
- `location` - the location of the key on the keyboard;
- `repeat` - whether the key was produced by the repeat.
And also a `platform_specific` field which encapsulates extra
information on desktop platforms, like key without modifiers
and text with all modifiers.
The `Modifiers` were also slightly reworked as in, the information
whether the left or right modifier is pressed is now also exposed
on platforms where it could be queried reliably. The support was
also added for the web and orbital platforms finishing the API
change.
This change made the `OptionAsAlt` API on macOS redundant thus it
was removed all together.
Co-authored-by: Artúr Kovács <kovacs.artur.barnabas@gmail.com>
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
Co-authored-by: daxpedda <daxpedda@gmail.com>
Fixes: #2631.
Fixes: #2055.
Fixes: #2032.
Fixes: #1904.
Fixes: #1810.
Fixes: #1700.
Fixes: #1443.
Fixes: #1343.
Fixes: #1208.
Fixes: #1151.
Fixes: #812.
Fixes: #600.
Fixes: #361.
Fixes: #343.
* Add Redox OS support
* Simplify control flow usage
* Apply more recommendations
* Update naming to indicate that Orbital is a platform
* Adjust import order
* feat: add pointer events to web
* feat: remove PointerType for touch events
* Remove duplicate
* Changelog and features
* Remove PointerType
* feat: renamed events, added touch type guard
* Rename
* Flip the y axis
* Fix physical position and add force
* Update comment
* Update features
* Use normalized force
* Remove unnecessary todos
* Update comment
* Refactor add touch_handler
* Rephrase by Liamolucko
* Update CHANGELOG.md
* Fix duplicate mouse and touch events
* Removed workaround for scale factor
* Flip the y axis
* Fix
* Fmt
* Replace `match` with a single pattern with `if let`
* Update documentation
* Have one callback per event
* Remove a comment
* Fix
* Remove y-axis flip
* Update src/event.rs
Co-authored-by: Mads Marquart <mads@marquart.dk>
* Fix platform specific comment
* Fix extra argument to `touch_position` function
Co-authored-by: Dany Sluijk <me@dany.dev>
Co-authored-by: Johan Klokkhammer Helsing <johanhelsing@gmail.com>
Co-authored-by: oscrim <oscar@widefind.se>
Co-authored-by: Mads Marquart <mads@marquart.dk>
This updates the Android backend to use the android-activity crate instead
of ndk-glue. This solves a few issues:
1. The backend is agnostic of the application's choice of Activity base
class
2. Winit is no longer responsible for handling any Java synchronization
details, since these are encapsulated by the design of
android_activity
3. The backend no longer depends on global / static getters for state
such as the native_window() which puts it in a better position to
support running multiple activities within a single Android process.
4. Redraw requests are flagged, not queued, in a way that avoids taking
priority over user events (resolves#2299)
To make it possible for application crates to avoid explicitly
depending on the `android-activity` crate (and avoid version conflicts)
this re-exports the android-activity crate under:
`winit::platform::android::activity::*`
This also adds `android-native-activity` and `android-game-activity`
features that set the corresponding android-activity features.
Addresses: PR https://github.com/rust-windowing/winit/pull/1892
Addresses: PR https://github.com/rust-windowing/winit/pull/2307
Addresses: PR https://github.com/rust-windowing/winit/pull/2343
Addresses: #2293Resolves: #2299
Co-authored-by: Markus Siglreithmaier <m.siglreith@gmail.com>
Co-authored-by: Markus Siglreithmaier <m.siglreith@gmail.com>
* MacOS: set value for `accepts_first_mouse`
* Update CHANGELOG and FEATURES
* Field doesn't need to be public
* Convert `bool` to `BOOL`
* Fix formatting
* Move flag from window state to view instance
* Feedback from PR
* Fix changelog location
This commit renames `Window::set_cursor_grab` to
`Window::set_cursor_grab_mode`. The new API now accepts enumeration
to control the way cursor grab is performed. The value could be: `lock`,
`confine`, or `none`.
This commit also implements `Window::set_cursor_position` for Wayland,
since it's tied to locked cursor.
Implements API from #1677.
While most compositors provide server side decorations, the GNOME
does not, and won't provide them. Also Wayland clients must render
client side decorations.
Winit was already drawing some decorations, however they were bad
looking and provided no text rendering, so the title was missing.
However this commit makes use of the SCTK external frame similar to
GTK's Adwaita theme supporting text rendering and looking similar to
other GTK applications.
Fixes#1967.
* Add cursor grab
* Update feature matrix, changelog and platform information
* Add proper error propagation
* Remove "expect" from fallible code
code would crash if handling pointer capture outside of winit on
every mouse click
we swallow the error since we could not think of a case where this
would fail in a way that would want to handle that it fails
* Remove unnecessary implementation comment
Co-authored-by: Will Crichton <wcrichto@cs.stanford.edu>
* Remove support for `stdweb`
* Expunge `stdweb`; make `web-sys` the default
* Mark this change as a breaking change
* Re-insert accidental removal of space
* Use the correct cargo feature syntax
* Re-add some `cfg` attributes
* Remove `web-sys` feature from CI
* Change web backend `event_handler` to without 'static lifetime
* Refactor web runner and fix ControlFlow::Exit not being sticky
* Impl. scaling change event for web-sys backend
* Improve `dpi` docs regarding the web backend
* Add changes to changelog
* Update features.md
* Add support for Windows Dark Mode
* Add is_dark_mode() getter to WindowExtWindows
* Add WindowEvent::DarkModeChanged
* Add support for dark mode in Windows 10 builds > 18362
* Change strategy for querying windows 10 build version
* Drop window state before sending event
Co-Authored-By: daxpedda <daxpedda@gmail.com>
* Change implementation of windows dark mode support
* Expand supported range of windows 10 versions with dark mode
* Use get_function! macro where possible
* Minor style fixes
* Improve documentation for ThemeChanged
* Use `as` conversion for `BOOL`
* Correct CHANGELOG entry for dark mode
Co-authored-by: daxpedda <daxpedda@gmail.com>
Co-authored-by: Osspial <osspial@gmail.com>
* Add touch pressure information for touch events on Windows
* Modified CHANGELOG.md and FEATURES.md to reflect changes
* Updated documentation of struct Touch to reflect changes
* Replaced mem::uninitalized() with mem::MaybeUninit
Fixed warnings in platform_impl/windows/dpi.rs
* iOS os version checking
* iOS, fix some incorrect msg_send return types
* address nits, and fix OS version check for unsupported os versions
* source for 60fps guarantee
* Add exclusive fullscreen mode
* Add `WindowExtMacOS::set_fullscreen_presentation_options`
* Capture display for exclusive fullscreen on macOS
* Fix applying video mode on macOS after a fullscreen cycle
* Fix compilation on iOS
* Set monitor appropriately for fullscreen on macOS
* Fix exclusive to borderless fullscreen transitions on macOS
* Fix borderless to exclusive fullscreen transition on macOS
* Sort video modes on Windows
* Fix fullscreen issues on Windows
* Fix video mode changes during exclusive fullscreen on Windows
* Add video mode sorting for macOS and iOS
* Fix monitor `ns_screen` returning `None` after video mode change
* Fix "multithreaded" example on macOS
* Restore video mode upon closing an exclusive fullscreen window
* Fix "multithreaded" example closing multiple windows at once
* Fix compilation on Linux
* Update FEATURES.md
* Don't care about logical monitor groups on X11
* Add exclusive fullscreen for X11
* Update FEATURES.md
* Fix transitions between exclusive and borderless fullscreen on X11
* Update CHANGELOG.md
* Document that Wayland doesn't support exclusive fullscreen
* Replace core-graphics display mode bindings on macOS
* Use `panic!()` instead of `unreachable!()` in "fullscreen" example
* Fix fullscreen "always on top" flag on Windows
* Track current monitor for fullscreen in "multithreaded" example
* Fix exclusive fullscreen sometimes not positioning window properly
* Format
* More formatting and fix CI issues
* Fix formatting
* Fix changelog formatting
* README: Use shields.io instead of Herokuapp (#859)
* README: Link to FEATURES.md and missing features wiki page (#860)
Closes#854
* Update URLs (#863)
* CHANGELOG.md: Add line from #861 (legacy) that is missing from equivalent #964 (EL 2)
* Support listing available video modes for a monitor
* Use derivative for Windows `MonitorHandle`
* Update FEATURES.md
* Fix multiline if statement
* Add documentation for `VideoMode` type
* Add initial draft of SCOPE document
* Rephrase/rename feature tiers
* Rename to FEATURES and add a few annotations
* Fix API Reworks table
* Add more annotations
* Some phrasing
* Split compat matrix into seperate section, to be moved into wiki
* Mention compatibility in CONTRIBUTING
* Remove some discuss annotations
* Apply review changes and rename child windows feature to popup windows
* Update based on discussion
* Add issue for Android HiDPI
* Update FEATURES.md
* Update FEATURES.md
* Update PULL_REQUEST_TEMPLATE.md
* Update PULL_REQUEST_TEMPLATE.md
* Reformat FEATURES.MD
* Remove comments
* Improve formatting and add guide for extending #Features