Commit graph

504 commits

Author SHA1 Message Date
John Nunley bb9b629bc3
Implement X11 extensions using x11rb instead of Xlib
Removes Xlib code by replacing it with the x11rb equivalent,
the commit handles xrandr, xinput, xinput2, and xkb.

Signed-off-by: John Nunley <dev@notgull.net>
2023-08-30 01:01:25 +04:00
daxpedda 48abf52aac
Use setTimeout() trick instead of Window.requestIdleCallback() (#3044) 2023-08-25 21:40:21 +02:00
Kirill Chibisov 309e6aa85a
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.

This is a follow up to beta yanking
2023-08-16 16:34:36 +04:00
Kirill Chibisov 8b8556798e
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2023-08-16 13:21:09 +04:00
Kirill Chibisov 2d96480a89
Use beta versions of android crates 2023-08-16 12:31:23 +04:00
Kirill Chibisov 6caff77abb
Bump MSRV to 1.65 2023-08-16 12:10:38 +04:00
Mads Marquart af6c343d0e
Improve macOS/iOS/Web thread safety
Co-authored-by: daxpedda <daxpedda@gmail.com>
2023-08-14 23:19:57 +04:00
Kirill Chibisov 119462795a
Pin android-activity git dependency 2023-08-14 23:10:32 +04:00
Robert Bragg bd2f1e8312
Android: Support unicode character mapping + dead keys
Up until now the Android backend has been directly mapping key codes
which essentially just represent the "physical" cap of the key (quoted
since this also related to virtual keyboards).

Since we didn't account for any meta keys either it meant the backend
only supported a 1:1 mapping from key codes, which only covers a tiny
subset of characters. For example you couldn't type a colon since
there's no keycode for that and we didn't try and map Shift+Semicolon
into a colon character.

This has been tricky to support because the `NativeActivity` class doesn't
have direct access to the Java `KeyEvent` object which exposes a more
convenient `getUnicodeChar` API.

It is now possible to query a `KeyCharcterMap` for the device associated
with a `KeyEvent` via the `AndroidApp::device_key_character_map` API
which provides a binding to the SDK `KeyCharacterMap` API in Java:

 https://developer.android.com/reference/android/view/KeyCharacterMap

This is effectively what `getUnicodeChar` is implemented based on and is
a bit more general purpose.

`KeyCharacterMap` lets us map a key_code + meta_state from a `KeyEvent`
into either a unicode character or dead key accent that can be combined
with the following key. This mapping is done based on the user's chosen
layout for the keyboard.

To enable support for key character maps the
`AndroidApp::input_events()` API was replaced by
`AndroidApp::input_events_iter()` which returns a (lending) iterator for
events. This was changed because the previous design made it difficult
to allow other AndroidApp APIs to be used while iterating events (mainly
because AndroidApp held a lock over the backend during iteration)
2023-08-08 02:56:42 +04:00
Mads Marquart b5aa96bea4
Update icrate to v0.0.4 (#2992) 2023-08-02 16:30:41 +02:00
Mads Marquart e33d2bee6c
Update objc2 version (#2936)
* Upgrade to objc2 v0.4.0 and icrate v0.0.3

* Fix `touchBar` method

* Use ClassType::alloc

* Use #[method_id(...)] functionality in declare_class!
2023-07-29 00:33:03 +02:00
John Nunley 43acf7f42f
Replace libc with rustix in some modules
Unfortunately this isn't a total removal, for two reasons:

- We still need "libc" for the Xlib XIM implementation, for locales.
- BSD requires libc to check for main-threadedness.

First one we can likely resolve in the near future, not so sure about
the second one without using some weird pthreads trick.
2023-07-22 09:32:27 +00:00
Kirill Chibisov f7a84a5b50
Add platform::startup_notify for Wayland/X11
The utils in this module should help the users to activate the windows
they create, as well as manage activation tokens environment variables.

The API is essential for Wayland in the first place, since some
compositors may decide initial focus of the window based on whether
the activation token was during the window creation.

Fixes #2279.

Co-authored-by: John Nunley <jtnunley01@gmail.com>
2023-07-20 13:16:51 +00:00
John Nunley d7ec899d69
Replace parts of the Xlib backend with x11-rb 2023-07-12 07:59:12 +00:00
daxpedda 5e0e1e96bc
On Web, implement WindowEvent::Occluded (#2940) 2023-07-10 02:02:38 +02:00
Kirill Chibisov 6178acede8
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2023-07-01 00:10:02 +04:00
Fredrik Fornwall 924f3323b5 On Web, map bfcache load/unload to suspend/resume 2023-06-28 15:38:49 +02:00
Kirill Chibisov 0defd747c8 Update xkbcommon-dl to 0.4.0
Most things were simply renamed due to migration to xkeysym.
2023-06-28 14:48:35 +04:00
John Nunley b2a46d0439
Fill the windows in the examples with a solid color
Fixes #776.
2023-06-19 18:46:38 +00:00
daxpedda 9a9c9b15ba
Implement ResizeObserver (#2859)
Co-authored-by: Liam Murphy <43807659+Liamolucko@users.noreply.github.com>
2023-06-14 09:43:53 +02:00
daxpedda f0d88c52a3
Fix pointer deltas on Firefox and send coalesced events together (#2878) 2023-06-13 15:49:27 +02:00
dAxpeDDa ab4a4a89e6 Remove unused EventListenerOptions 2023-06-11 19:44:52 +02:00
dAxpeDDa ab46aa5b79 Replace beforeunload with pagehide 2023-06-05 16:40:53 +02:00
dAxpeDDa 12fb37d827 Make media queries more robust 2023-06-05 16:11:22 +02:00
daxpedda 8f7f3efc0d
On Web, implement Send and Sync where appropriate (#2834) 2023-06-05 02:44:54 +02:00
dAxpeDDa a134a59917 Remove MouseEvent fallback support 2023-06-05 02:04:37 +02:00
John Nunley 642ce2bfa7
Port to windows-sys v0.48.0 (#2842) 2023-06-04 00:02:37 +02:00
dAxpeDDa 5bbe87960e Replace instant with web-time 2023-06-03 16:05:44 +02:00
George Burton 31ebc5caf4
Update bitflags to 2.0
Co-authored-by: dAxpeDDa <daxpedda@gmail.com>
2023-06-02 17:44:36 +03:00
dAxpeDDa 2ade772ab0 Bump console_log to v1 2023-06-01 17:19:30 +02:00
John Nunley 4ac2006cbc
Replace mio with calloop in the X11 backend 2023-05-31 19:44:42 +03:00
dAxpeDDa ba5ad3be13 On Web, fix no-op for Window::set_fullscreen 2023-05-31 15:25:15 +02:00
Kirill Chibisov b5af6bb266
Use xkbcommon-dl 0.3.0 2023-05-29 00:55:54 +03:00
Markus Røyset 918430979f
Overhaul the Keyboard API
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.
2023-05-28 21:02:59 +03:00
Kirill Chibisov a7986b077f
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2023-05-14 20:36:23 +03:00
Kirill Chibisov bd9cc2a9da
Use cursor-icon crate for CursorIcon
This crate is aimed to simplify handling of cursor icon across
various crates and be used in the public API.
2023-05-09 20:19:35 +03:00
Kirill Chibisov 596c0edf0f
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2023-05-09 18:28:20 +03:00
Kirill Chibisov ad52c72e41
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2023-05-05 13:27:22 +03:00
Kirill Chibisov 2496098890
Update wayland-rs to 0.30.0
This update rewrites the winit's Wayland backend using new wayland-rs
0.30 API. This fixes long standing issue with the forward compatibility
of the wayland backend, meaning that future updates to the wayland
protocol won't break rust code anymore. like it was before when adding
new shm/enum variants into the protocol.

Fixes #2560.
Fixes #2164.
Fixes #2128.
Fixes #1760.
Fixes #725.
2023-04-19 00:56:29 +03:00
Kirill Chibisov d4c9535af9
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2023-03-16 23:05:17 +03:00
daxpedda f0fcb346b0
On Web, use target_family = "wasm" 2023-03-16 22:49:59 +03:00
Mads Marquart 77f8e511e9
Fix macos memory leaks (#2739)
* Use a weak reference from WinitView to WinitWindow

* Allow patched objc2 version

* Add changelog entry
2023-03-14 13:27:41 +03:00
Kirill Chibisov b18295a1ce
Bump MSRV to 1.64 2023-03-08 19:34:10 +03:00
Kirill Chibisov 08bdca19b1
Bump version on master
This commit does not represent a release and only
synchronizes CHANGELOG from the latest release.
2023-03-02 17:15:48 +03:00
Kirill Chibisov 69d6076310
Bump version on master
This commit does not represent a release and only
synchronizes CHANGELOG from the latest release.
2023-02-04 14:47:31 +03:00
Kirill Chibisov 1eb1a13a77
Bump version on master
This commit does not represent a release and only
synchronizes CHANGELOG from the latest release.
2023-02-02 10:55:59 +03:00
Markus Siglreithmaier e1b7fda409
Bump windows-sys version to 0.45 (#2639)
Bump windows-sys version to fix regression
2023-01-23 22:10:28 +01:00
Douglas Dwyer b711a11549
Properly remove window mouse event listeners (#2632)
* Properly remove window mouse event listeners

* Update CHANGELOG.md

* Fix formatting

Co-authored-by: Mads Marquart <mads@marquart.dk>
2023-01-21 16:58:05 +01:00
Kirill Chibisov de782504ab
On Wayland, add support for fractional scaling
This adds support for the fractional scaling on Wayland via the
wp-fractional-scale protocol.

Co-authored-by: Julian Orth <ju.orth@gmail.com>
2023-01-20 00:02:16 +03:00
John Nunley 08ce3af3e1
Ensure all free unixes can build
This fixes the `cfg` guards inside the `Cargo.toml`.
2023-01-10 12:00:28 +03:00