Use the reported axis source so wheel, wheel-tilt and continuous-source scroll events report
`TouchPhase::Moved` instead of starting a finger gesture that never ends; egui then follows modifier
release instead of keeping Ctrl zoom latched. Finger momentum is unchanged. The phase policy lives
in `seat/pointer/scroll.rs`. Taken from storytold/pdfcraft vendor/winit patch (13)
(storytold/pdfcraft#1569). No upstream winit PR yet.
Co-authored-by: Brandon Thomas <echelon@gmail.com>
With a transparent title bar over a full-size content view, AppKit asks the view under the pointer
whether a press can move the window, and NSView answers YES for a non-opaque view. winit's view did
not override it, so any drag starting in the title-bar band moved the window before the app saw it
(PdfCraft's tab reordering never got the drag). The view now answers with the window's
`movable_by_window_background` attribute (NO unless asked); apps still move the window through
`ViewportCommand::StartDrag`. Taken from storytold/pdfcraft vendor/winit patch (12)
(storytold/pdfcraft#2347). No upstream winit PR yet.
Hyprland (0.56.2) sends the selection and drags only to the first
wl_data_device a client binds for a seat (dataDeviceForClient in
src/protocols/core/DataDevice.cpp). Winit binds one for file drops, so a
toolkit clipboard such as smithay-clipboard, which binds a second device on the
same connection, never receives the selection and paste fails everywhere. A
client should keep one data device per seat, so winit now offers the clipboard
on its own device instead.
platform::wayland::Clipboard reads and writes text on the seat that last gave
the application input. It is found from the event loop with
ActiveEventLoopExtWayland::clipboard, or from a wl_display pointer with
Clipboard::for_display, for toolkits that only receive the display handle.
Keyboard enter, key and button events record the serial that setting the
selection needs. Reading another client's selection receives it through a pipe
without dispatching the event loop and gives up after two seconds of silence.
Our own selection carries a private marker type and is returned directly, so
pasting it never waits on the thread that would have to send it. The compositor
asks for our text through the data source, and a short-lived thread writes it.
Winit binds a wl_data_device for each seat and accepts drags that offer
text/uri-list with the copy action. The list is read without blocking as
soon as the drag enters a window, so the window receives HoveredFile for each
local file while the drag is over it, HoveredFileCancelled when it leaves, and
DroppedFile for each file once it is dropped.
The actions are set only on enter: setting them again on motion restarts the
negotiation and can turn a quick drop into a leave. Only file URIs naming this
machine become paths.
Add an opt-in macOS builder flag that cancels native termination and queues close requests on the ordinary event loop. Preserve default behavior and handle repeated requests, stale windows and completed exits.
Required by storytold/designcraft#544.
(cherry picked from commit 3d51077fd1)
Without Xft.dpi, use the X screen's configured DPI (its size in pixels and millimetres) before the RandR panel-physical fallback; WINIT_X11_SCALE_FACTOR still overrides. Taken from storytold/pdfcraft vendor/winit (storytold/pdfcraft#1150, replacing the launcher pin in #908); the same change is open as storytold/photocraft#3724, gridcraft#389, deckcraft#170 and wordcraft#721. No upstream winit PR yet.
Related to rust-windowing/winit#4478; PdfCraft patch, to be proposed upstream.
Originally "M15.1: suppress duplicate macOS Korean spaces" in storytold/wordcraft#787 (same change as storytold/pdfcraft vendor/winit).
Port of the emoji-picker part of rust-windowing/winit#4749 (0.30 backport of #4748).
Originally "M15.1: forward macOS emoji picker text" in storytold/wordcraft#787 (same change as storytold/pdfcraft vendor/winit).
Port of rust-windowing/winit#4650 (0.30 backport of #4651, merged on master).
Originally "M15.1: preserve macOS IME commits" in storytold/wordcraft#787 (same change as storytold/pdfcraft vendor/winit).
Port of rust-windowing/winit#4587 (focus-safe form of #4575).
Originally "M15.1: keep hidden maximized windows hidden" in storytold/wordcraft#787 (same change as storytold/pdfcraft vendor/winit).
The `text` field on `KeyEvent` was hardcoded to `None` on Android,
making it impossible for custom `NativeActivity` subclasses that
show the IME to receive functional text input using *for example* the
existing `winit-egui` crate which relies on this field being set.
Use `Key::to_text()` on press events to derive `text` from
`logical_key`, matching the convention used by the Windows and macOS
backends.
Supposedly that doesn't include all kinds of special virtual unicode
keys, but at least the basics work this way.
macOS native Pinyin IME can send a selected_range that exceeds the
marked text string length (e.g. index 8 for a 6-character string).
This caused an NSRangeException in substringToIndex:, crashing the
application with SIGABRT.
Clamp both location and end to the string's UTF-16 length before
calling substringToIndex.
The xfixes implementation is not that reliable and rather simple to
replace, so use x11rb to implement the same functionality.
Fixes#4120.
Co-authored-by: avitran0 <holyhades64@gmail.com>
In Windows versions < 17763, `GetProcAddress("#132")` from `uxtheme.dll`
also returns a non-null pointer. However, the function does not match
the expected `extern "system" fn() -> bool` prototype, which causes a
crash when it is called.
This fix ensures compatibility by adding proper checks to prevent such
crashes on older Windows versions.
The `text` is retrieved as UTF-8 while `attributes` are based on UTF-16,
thus the offset was getting out of sync on some unicode payloads
like surrogate pairs.
Fixes#3967.
iOS parts of #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 a top-level application
delegate.
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 this is likely the preferred behaviour
anyhow).
This is done to avoid order-dependent behavior that you'd otherwise
encounter where `EventLoop::new` had to be called at the beginning of
`fn main` to ensure that Winit's application was the one being
registered as the main application by calling `sharedApplication`.
Fixes https://github.com/rust-windowing/winit/issues/3772.
This should also make it (more) possible to use multiple versions of
Winit in the same application (though that's still untested).
Finally, it should allow the user to override `NSApplication` themselves
if they need to do that for some reason.
Only mark that the grab was applied when it actually got applied.
Previously there was an issue with grab being marked as applied without
a pointer over the window, when in reality it wasn't.
Fixes#4073.
Using `Duration::Zero` with `Wait` polling mode was still blocking until
the event was actually delivered. Thus when `pump_events` API is used,
ensure that it's not happening.
Fixes#4130.
* Prevent panic when calling set_simple_fullscreen(false) on macos
Calling `set_simple_fullscreen(false)` to restore the window after
a previous call to `set_simple_fullscreen(true)` panics with
`view must be installed in a window` in the call to `set_style_mask`
with the old style.
Moving the `set_style_mask` call after the frame has been resized
fixes the issue.
* Hide the doc and menubar on macos when using set_borderless_game
with set_simple_fullscreen
* Fix a pause in the event loop when clicking the title bar on windows
When clicking the title bar on Windows, to drag the window, there is
a noticible pause in continuous redraw requests. This was fixed
in #839 and then regressed in #1852. The cursor blinks in both
cases and is unrelated. The regression made the blink happen after
the pause instead of immediately.
* Update the event loop pause note on the WM_NCLBUTTONDOWN handler
The application example was also updated to optionally animate the fill color
in order to demonstrate continuous redraw without pauses in the event
loop.