Commit graph

2098 commits

Author SHA1 Message Date
baneyue
0960635895
On Wayland, fix MonitorHandle position 2023-10-11 00:44:52 +04:00
Kirill Chibisov
789a497980
Remove obsolete docs about wayland CSD env variable
The env variable was removed a while ago, yet it was still present in
the user docs.
2023-10-10 09:23:37 +04:00
daxpedda
fac6110cb6
Web: fix ControlFlow::WaitUntil to never wake up **before** the given time (#3133) 2023-10-09 12:31:02 +02:00
Dmitry Sharshakov
0363be4776
Add Window::set_blur
Allow clients to request blur behind their window, implemented on
Wayland for now.
2023-10-08 23:53:15 +04:00
daxpedda
f5dd1c008c
Web: remove unnecessary usage of once_cell::unsync::Lazy (#3134) 2023-10-08 02:00:51 +02:00
daxpedda
48a1e84906
Update Clippy to v1.73 (#3135) 2023-10-08 01:21:46 +02:00
epimeletes
ee0db52ac4
Rename run_ondemand to run_on_demand 2023-10-04 01:24:42 +04:00
Fredrik Fornwall
c7cf0cfd83
Make DeviceId contain device id's on Android 2023-10-04 01:23:18 +04:00
Mads Marquart
af247eac0f
X11: Add #[deny(unsafe_op_in_unsafe_fn)] (#3121)
* X11: Add #[deny(unsafe_op_in_unsafe_fn)]

* Enable #![deny(unsafe_op_in_unsafe_fn)] everywhere
2023-09-30 21:43:41 +02:00
Mads Marquart
b2b4564a5f
Windows: Add #[deny(unsafe_op_in_unsafe_fn)] (#3070) 2023-09-29 16:07:44 +02:00
Neil Macneale V
ffb46dd61f
Fix transparent windows on X11 2023-09-26 01:05:15 +04:00
Kirill Chibisov
8c8fb39fcd
Remove DeviceEvent::Text event
The event is never constructed inside the winit.
2023-09-23 18:40:23 +04:00
lucasmerlin
2422ea39d0
Pass force on touch events on android 2023-09-22 23:44:39 +04:00
daxpedda
878d832d24
Make ControlFlow::Wait the default (#3106) 2023-09-22 21:27:11 +02:00
Kirill Chibisov
e2e01e1fc6
Remove old docs about EventLoop::run 2023-09-22 13:46:52 +04:00
Pavel Strakhov
c8b685ddbc
On X11, fix WaitUntil and Poll behavior
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
2023-09-20 15:15:28 +04:00
StarStarJ
f10ae52385
Implement PartialOrd and Ord for MouseButton 2023-09-17 13:51:03 +04:00
Kirill Chibisov
e731041c15
Correct Wayland section in dpi docs
Fixes #3100.
2023-09-16 18:14:46 +04:00
daxpedda
0caba93b51
Rename PollType to PollStrategy (#3089) 2023-09-08 18:39:23 +02:00
daxpedda
83950acd5a
Add Window.requestIdleCallback() support (#3084) 2023-09-07 12:12:35 +02:00
John Nunley
4f0ce7201d
Revert select_xkb_events to its previous impl
The new implementation of select_xkb_events apparently misconfigures
the server. This commit does a temporary fix by just reverting it to its
previous implementation.

This is temporary until I can figure out what Xlib is doing behind the
scenes or until I read xkbproto.pdf.

Fixes: #3079
Signed-off-by: John Nunley <dev@notgull.net>
2023-09-07 10:25:52 +04:00
daxpedda
e648169861
Move ControlFlow to EventLoopWindowTarget
Fixes #3042.
2023-09-07 10:25:04 +04:00
John Nunley
8fdd81ecef
Allow the user to force X11 under Wayland
Use forced backend over the env variables. 

Signed-off-by: John Nunley <dev@notgull.net>
Fixes: #3057
2023-09-04 01:24:05 +04:00
daxpedda
7a2a2341c2
Remove T from EventLoopTargetWindow (#3081)
Co-authored-by: nerditation <12248559+nerditation@users.noreply.github.com>
2023-09-03 02:26:53 +02:00
Kirill Chibisov
d68d9eab38
Mark startup_notify unsafe functions as safe
They are safe, since they use the rust `std::env` stuff. Making them
safe lets downstream to determine that `std::env` is used and not the
`libc` env manipulation routines, which are unsafe.
2023-09-02 02:05:56 +04:00
Mads Marquart
a06ea45c0f
Slightly reduce number of cfgs (#3071)
* Make Linux platforms less dependent on the root monitor handle

* Add various functions to the Wayland platform to reduce cfgs

* Don't use a cfg in listen_device_events

* Don't use a cfg in set_content_protected

* Fix instance of a target_os cfg
2023-09-01 23:14:16 +02:00
Kirill Chibisov
67b041e231
On Wayland, fix TouchPhase::Canceled sent for Move
Fixes #3035.
2023-09-01 02:14:34 +04:00
Mads Marquart
6dfc78fb50
Make EventLoopWindowTarget independent of the user type on Orbital (#3055) 2023-08-30 16:43:28 +02:00
Mads Marquart
477619c0a7
Ensure that winit initializes NSApplication (#3069) 2023-08-30 15:19:30 +02:00
Mads Marquart
5f1a4b65ad
Fix missing quote (#3068) 2023-08-30 13:59:23 +02:00
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
0c8cf94a70
Web: Fullscreen Overhaul (#3063) 2023-08-29 09:28:30 +02:00
daxpedda
1dfca5a395
Enable event propagation (#3062) 2023-08-28 19:18:10 +02:00
Mads Marquart
7541220a41
Fix macOS deminiaturize (#3054) 2023-08-27 17:35:45 +02:00
Mads Marquart
86baa1c99a
Make iOS fully thread safe (#3045)
* macOS & iOS: Refactor EventWrapper

* macOS & iOS: Make EventLoopWindowTarget independent of the user event

* iOS: Use MainThreadMarker instead of marking functions unsafe

* Make iOS thread safe
2023-08-27 17:04:39 +02:00
daxpedda
67d3fd28f7
Move Event::RedrawRequested to WindowEvent (#3049) 2023-08-27 16:15:09 +02:00
daxpedda
a3cba838ea
On Web, never return a MonitorHandle (#3051) 2023-08-26 18:56:44 +02:00
daxpedda
48abf52aac
Use setTimeout() trick instead of Window.requestIdleCallback() (#3044) 2023-08-25 21:40:21 +02:00
Mads Marquart
68ef9f707e
Use frame instead of visibleRect (#3043) 2023-08-24 22:52:11 +02:00
Mads Marquart
9979441c82
Fix recent CI failures (#3041)
* Fix new clippy lints

* Fix nightly documentation warnings
2023-08-24 18:29:31 +02: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
f801c4a00b
Reexport raw-window-handle in window module
We use raw-window-handle extensive in the public API as well as we
force the users to use it to get some essential data for interop, thus
reexport it.

Fixes: #2913.
2023-08-14 11:24:45 +04:00
Kirill Chibisov
f9758528f6
Propagate error from EventLoop creation
Inner panics could make it hard to trouble shoot the issues and for some
users it's not desirable.

The inner panics were left only when they are used to `assert!` during
development.

This reverts commit 9f91bc413fe20618bd7090829832bb074aab15c3 which
reverted the original patch which was merged without a proper review.

Fixes: #500.
2023-08-13 23:20:09 +04:00
lucasmerlin
778d70c001
Fix touch force for Apple Pencil 2023-08-12 16:22:22 +04:00
John Nunley
dc973883c9
Add a way to embed the X11 window into another
Signed-off-by: John Nunley <dev@notgull.net>
Tested-by: Kirill Chibisov <contact@kchibisov.com>
2023-08-11 13:30:55 +04:00
Fredrik Fornwall
2233edb9a0
iOS: Use NSOperatingSystemVersion from icrate (#3019) 2023-08-09 15:57:20 +02: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
Kirill Chibisov
e9ebf1e5f4
Fix event loop not waking up due to repeat source
Force the wake up from the repeat source as well.

Fixes: cad327755 (On Wayland, reduce amount of spurious wakeups)
2023-08-07 09:35:59 +04:00
Kirill Chibisov
5f7955cb2b
On X11, set visual_id in raw-window-handle
Fixes #2681.
2023-08-06 06:07:19 +04:00
Kirill Chibisov
793c535b01
Revert "Propagate error from EventLoop creation" (#3010)
This reverts commit ed26dd58fd.
The patched was merged with a review by accident.
2023-08-06 06:07:01 +04:00