Add a `raw-window-handle-06` feature to the Rust API crates, which adds support for version 0.6 of rwh to slint::Window, by delegation adding a `window_handle()` function that returns a struct that implements the corresponding traits from rwh.
HasDisplayHandle could also be provided on the backend, but that can be
done separately if needed.
This is only implemented for the winit backend right now.
cc #877
Semi-random selection of clippy topics that were
uncontroversial before:-).
Leaves about 84 deduplicated issues in the code base
according to clippy from nightly.
Only the hand-picked sensible things, not all of it ;-)
Also fix a few typos that cspell complained about when I
tried to commit and some formatting changes that cargo fmt
insisted on when commiting.
Don't activate the canvas by default, as that causes winit to call focus() on the DOM element, which in turn will forcibly scroll the browser window.
That means any existing anchors are ignored and the user's scroll preference is disturbed.
Fixes#4431
The Skia OpenGL renderer is portable and sometimes esp. on Windows produces better results, so make it always available as an open if `renderer-skia` is enabled. `renderer-skia-opengl` continues to select the GL renderer as default.
Otherwise there will be a huge queue of request redraw command that
accumulate within winit.
This makes operation such as resizing a bit more soomth
Tested on X11
Commit 41bfe66447 bumped accesskit
dependencies, which introduced a version that uses threads.
That means the action handler as well as the initial tree update source
closure are destroyed in a thread that's not the ui thread. That means
we destruct a SenderWrapper<Weak<WinitWindowAdapter>> in a thread that
is not the same as the one the wrapper was created in, which causes
Drop for SendWrapper to panic.
Replace the use of SendWrapper here with safely copyable window ids.
We call set_fullscreen(None) on startup for windows that aren't fullscreen (normally), and winit compiled for the web unconditionally calls canvas.exitFullscreen(), which
may produces warnings about exitFullscreen()
being called when not in fullscreen mode.
Move the set_fullscreen function added to the WindowAdapter trait in 779aff0b39
to be a function in WindowProperties instead.
That way it'll be easier in the future to extend this with other window states without
having to modify or break the WindowAdapter trait API.
Move this back out of render() again and make it stateful in the renderer. Reduces the amount of book-keeping required and it's always the same callback anyway.
Calling request_request() during RedrawRequested would not work on
Windows and wasm. Commit 372e6b0ffc worked
around this, but that can be reverted now, as this is fixed in winit.
For windows that was https://github.com/rust-windowing/winit/pull/3165
and for wasm I couldn't find the change, but could verify that it still
works.
I checked that #1574 does not regress.
Besides the cleanup, this is also needed for #1695.
Try to fix the issue #3911.
In 1.3.0, the function "adjust_window_size_to_satisfy_constraints" is deleted.
I guess that, in Winit 0.29.x, the window will automatically resize, but, at least, it doesn't work on Windows.
So, I try to add this function back.
calling show() on a visible window or hide() on a hidden window
shouldn't do anything.
Especially currently it would resize to the preferred size.
So that makes the preview UI to alsways resize to the preferred size
because we always call show()
This way if for example the application quits the event loop while
pressed is true, and then resumes shortly afterwards, we maintain the
pressed state correctly.
Port to the latest accesskit and accesskit_winit:
- NodeId is now a u64 instead of u128, so trim the component/item encoding.
- Adjust to some enum renamings.
- TreeUpdate now always requires a focus node, which we set to the root.
- Fixed focus handling on macOS: Report FocusIn to the accesskit
adapter, so that it can update its internal host_is_focused state
correctly.
Not sure why, but it fixes that applying the constraints is otherwise
not working with winit on X11
This is not the first time we do this fix:
723f89d342 and 1891e4489a
Commit f24014a2dd made the insert function
private. Let's solve this differently by creating a private WASM
clipboard and invoking copy() and paste() on the Text item instead.
The first attempt was implementing a ClipboardProvider just for the wasm
build, just like with SilentClipboard, but unfortunately that doesn't
work because in the backend's set_clipboard_text()/clipboard_text()
functions, there's no currently running winit event loop that we could
access, becaused the call stack starts directly at the DOM event
handler, not in our winit event handler.
On wayland, we may not be getting a resize event, after issuing `request_inner_size()`.
Without that, we would fail to size the EGL surface correctly.
Centralize all request_inner_size() call sites
and dispatch a "local" resize event if the new size is returned by winit.
Fixes#1671
Both structure are bascially the same and only used internally, no need
to have the two.
The only difference was that one had the modifiers and the other one
not. But we can just set the modifier at the point we were converting
between the two.