Commit graph

624 commits

Author SHA1 Message Date
Kirill Chibisov
3a84da6951
Move winit itself to crate
That way we use top-level Cargo.toml only for the workspace management
purposes.
2025-06-07 13:07:12 +09:00
Kirill Chibisov
969237f422
Bump rustix to 1.0.0 2025-05-27 16:31:11 +09:00
Mads Marquart
e542a78deb Move Web backend to winit-web 2025-05-26 14:56:00 +09:00
Mads Marquart
5f2c7350e9
Move AppKit (macOS) backend to winit-appkit (#4248) 2025-05-25 17:37:40 +02:00
Mads Marquart
256bbe949e
Move X11 backend to winit-x11 (#4253) 2025-05-25 17:24:00 +02:00
Mads Marquart
1126e9ea2f
Move Wayland backend to winit-wayland (#4252) 2025-05-25 16:48:07 +02:00
Mads Marquart
927af44aa4
Move UIKit backend to winit-uikit 2025-05-25 23:19:30 +09:00
Mads Marquart
0adc0898f0
Move shared code to a new crate winit-common 2025-05-25 20:41:28 +09:00
Mads Marquart
3b986f5583
Move Windows backend to winit-win32 2025-05-25 12:13:25 +09:00
Mads Marquart
b1f8d778a1
Move Android backend to winit-android (#4250) 2025-05-24 13:29:53 +02:00
Mads Marquart
47b938dbe7
Split Orbital backend out into winit-orbital (#4243) 2025-05-21 13:12:55 +02:00
Kirill Chibisov
e2b883d215
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2025-05-21 18:04:10 +09:00
Mads Marquart
5190472bee
chore: use workspace dependencies everywhere
To reduce the amount of duplication in 'Cargo.toml's when we split into
different crates.
2025-05-21 15:45:12 +09:00
Kirill Chibisov
3493a20173 winit-core: new crate + split out as_any 2025-05-14 21:18:44 +09:00
Kirill Chibisov
519947463f
Bump MSRV to 1.80 2025-05-05 21:55:12 +09:00
Kirill Chibisov
587ade844d DPI version 0.1.2 2025-05-02 16:18:37 +09:00
Kirill Chibisov
17666e3171
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2025-04-30 21:01:32 +09:00
Kirill Chibisov
f6ca06cd58
wayland: bump wayland-rs to avoid yanked release 2025-04-30 02:09:44 +09:00
Kirill Chibisov
c8579a1882
wayland: ensure external loop is notified with pump_events
Spawn a thread when pump_events is used, so the external thread will
get woken-up correctly. This only happens when timeout was given.

Fixes #4183.
2025-04-29 11:43:36 +09:00
Mads Marquart
24e2c6914a
macOS:ios: use next objc2 version
A lot of CoreFoundation methods have been marked safe, and converted
into methods. Note that the old functions are still available, just
deprecated.
2025-04-20 14:36:49 +09:00
valadaptive
23011c6b0a
Update to windows-sys 0.59 (#4098) 2025-02-24 04:40:11 +01:00
Kirill Chibisov
c09160d1a8
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.

This also includes 0.30.8 sync, since it was forgotten.
2025-02-06 13:26:30 +03:00
Mads Marquart
953d9b4268
Update to objc2 v0.6 (#4092)
* Use available! macro
* Use objc2-core-foundation and objc2-core-graphics
* Use MainThreadBound instead of StaticMainThreadBound hack
2025-01-28 21:31:14 +01:00
Kirill Chibisov
d736763216
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2024-12-22 23:13:25 +03:00
Kirill Chibisov
f0d8689039
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2024-12-21 09:39:09 +03:00
Exidex
4d5e68c6e2
Implement ability to make non-activating window on macOS (#4035)
Fixes #3894
2024-12-13 00:56:39 +01:00
Benjamin Brienen
171d53c042
Update smol_str (#3991) 2024-12-03 23:07:19 +01:00
Mads Marquart
dbcdb6f1b4
Add safe area and document coordinate systems (#3890)
Added `Window::safe_area`, which describes the area of the surface that
is unobstructed by notches, bezels etc. The drawing code in the examples
have been updated to draw a star inside the safe area, and the plain
background outside of it.

Also renamed `Window::inner_position` to `Window::surface_position`, and
changed it to from screen coordinates to window coordinates, to better
align how these coordinate systems work together.

Finally, added some SVG images and documentation to describe how all of
this works.

This is fully implemented on macOS and iOS, and partially on the web.

Co-authored-by: daxpedda <daxpedda@gmail.com>
2024-11-21 17:37:03 +01:00
Kirill Chibisov
b2896d7408
chore: always pull raw-window-handle
Winit is not useful without it and we don't provide older versions
anymore.
2024-11-03 00:39:01 +03:00
AngelicosPhosphoros
bb4aa22cf9 Improve waiting for messages on Windows
Previous version used [`SetTimer`] with `GetMessageW` for waiting.
The downside of UI timers like ones created by `SetTimer`,
is that they may be late by up to 15-16 ms.

To fix this behaviour, I added use of high resolution timers created by [`CreateWaitableTimerExW`] with the flag `CREATE_WAITABLE_TIMER_HIGH_RESOLUTION`.
In my previous experience, waiting on such timers have precision of roundly 0.5 ms which is the best available on Windows at the moment.
I use [`MsgWaitForMultipleObjectsEx`] to wait simultaneously for both timer and newly arriving events.

Unfortunately, high resolution timers are available only since Windows 10 1803. However:

1. Win 10 is already getting to the end of support, like all previous versions, so it is OK to rely on APIs introduced in it;
2. I use `dwMilliseconds` parameter of `MsgWaitForMultipleObjectsEx` as a fallback. It should perform not worse compared to waiting for events from `SetTimer`.

I also refactored code to remove event dispatching from function responsible for waiting for events. This provides more clear separations of concern and avoids unnecessary duplication of dispatching logic.

After [review] from @rib, I also moved the waiting itself from `wait_for_messages` method to separate function, so it is clearly seen that `wait_for_messages` do 3 things: notify app that we about to wait, wait, notify that we have new events.

I have tested behaviour using a egui app with Vulkan rendering with `VK_PRESENT_MODE_IMMEDIATE_KHR`, and older version consistently have twice less FPS than requested (e.g. 30 FPS when limit is 60 and 60 FPS when limit is 120) while newer version works more correctly (almost always 60 FPS when limit is 60, and only 5-10 frames missing when FPS is set to 120 or more).

Fixes https://github.com/rust-windowing/winit/issues/1610

[`CreateWaitableTimerExW`]: https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createwaitabletimerexw
[`MsgWaitForMultipleObjectsEx`]: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-msgwaitformultipleobjectsex
[`SetTimer`]: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-settimer
[review]: https://github.com/rust-windowing/winit/pull/3950#discussion_r1800184479
2024-10-28 16:38:17 -07:00
Valentine Briese
3e9b80d47a
macOS: add ability to make titlebar unified (#3960)
Adds `WindowExtMacOS::set_unified_titlebar` and
`WindowAttributesExtMacOS::with_unified_titlebar`,
which allow you to use a larger titlebar style on macOS.
2024-10-25 23:22:52 +02:00
Kirill Chibisov
fb6b1d487b
deps: bump redox-syscall to 0.5.7 2024-10-21 21:33:51 +00:00
Mads Marquart
dfea49f488
Support drawing on iOS in examples
Softbuffer v0.4.6 added support for iOS.
2024-09-10 17:36:04 +03:00
John Nunley
aee95114db m: Replace libxcursor with custom cursor code
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

Signed-off-by: John Nunley <dev@notgull.net>
2024-08-22 19:30:43 -07:00
lucasmerlin
1e1f0fd7e9
Basic iOS IME support (#3823)
This implements basic iOS IME support (typing, backspace, support for emojis
etc but no autocomplete or copy / paste menu).

Co-authored-by: Mads Marquart <mads@marquart.dk>
2024-08-19 22:04:29 +02:00
daxpedda
7fbc2118b6
Add support for MacOS ARM64 (#3862) 2024-08-13 23:01:17 +02:00
daxpedda
d96fd02f33
Update minimum version of wasm-bindgen (#3860) 2024-08-13 21:54:03 +02:00
Mads Marquart
92e9bfe0fc
Allow the user to register the application delegate on macOS and iOS (#3758)
This allows the user to override the application delegate themselves,
which opens several doors for customization that were previously closed.

To do this, we use notifications instead of top-level application delegate
methods.

One effect of not providing an application delegate on iOS is that we no
longer act as-if the application successfully open all URLs there.

This is a breaking change, although unlikely to matter in practice, since the
return value of `application:didFinishLaunchingWithOptions:` is seldom used by
the system (and is likely the preferred behaviour anyhow).
2024-08-11 23:14:18 +02:00
Kirill Chibisov
70c54ee0ff
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2024-08-08 21:40:08 +03:00
daxpedda
1168cd4113
Implement common Std traits on many types (#3796) 2024-08-08 00:46:28 +02:00
dependabot[bot]
42ba0a74e0
build(deps): bump EmbarkStudios/cargo-deny-action
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: daxpedda <daxpedda@gmail.com>
2024-08-04 15:14:12 +03:00
daxpedda
02a0a91a94
Remove raw-window-handle v0.4 and v0.5 support (#3831) 2024-08-04 00:18:39 +02:00
daxpedda
3398ebe467
Use Taplo for TOML formatting 2024-07-28 17:38:44 +02:00
daxpedda
a0bc3e5dc8
Web: Implement MonitorHandle (#3801)
Requires getting permission from the user to get "detailed" support.
Also enables users to go fullscreen on specific monitors.
Exposes platform-specific orientation API.

Most functionality depends on browser support, currently only Chromium.
2024-07-23 20:33:10 +02:00
Speykious
eef2848c98
feat: Implement smooth resizing on X11 with _NET_WM_SYNC_REQUEST
Without smooth resizing, the window will appear to jitter when it is being
resized. This is because X11 completes the resize before the client gets a
chance to draw a new frame.

This is fixed by using the "sync" extension to ensure that the resize of the
X11 window is synchronized with the server.

Closes #2153
2024-07-21 09:39:43 -07:00
daxpedda
73c01fff96
Run doc tests on Web as well (#3799) 2024-07-20 21:20:18 +02:00
Kirill Chibisov
944ab60eda
Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2024-07-16 22:04:12 +03:00
Kirill Chibisov
dc99920612
wayland: bump dependencies
Update SCTK as a follow-up to 1170554dbd (ignore events to dead
objects) fixing it for wl_output.
2024-07-16 12:58:03 +03:00
daxpedda
936da131c2
Web: fix MouseMotion coordinate space (#3770) 2024-07-05 16:07:01 +02:00
Mads Marquart
9d5412ffe1
Move iOS and macOS implementations into new apple module (#3756)
Move iOS and macOS implementations to a shared folder called `apple`, to allow
us to reduce the code-duplication between these platforms in the future.

The folder structure is now:
- `src/platform_impl/apple/`
  - `appkit/`
  - `uikit/`
  - `example_shared_file.rs`
  - `mod.rs`

* Add preliminary support for tvOS, watchOS and visionOS
* Reduce duplication in Cargo.toml when specifying dependencies
2024-06-24 13:26:49 +02:00