Fixes#4500
When the WindowAdaptor is dropped, deleteLater is used on the C++ QWidget.
On wayland, we still recieve a mouse exit event when the widget is about
to be deleted. This calls a callback into the deleted Rust WindowAdaptor.
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.
They are not commonly used so no need to use semi-public api for that
and it's really easy to similate with ust two clicks anyway
The previous test function were added before there was public way to
send events
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.
The event loop roughly loops like this:
loop {
update_timers_and_animations();
render();
sleep_or_dispatch_events();
}
sleep_or_dispatch_events() will wake up when we receive a queued callback from invoke_from_event_loop, and we would
run the callback right away. If that callback sets animated properties, the start time for animations would be incorrect, as we haven't called update_timers_and_animations() yet.
So instead, let's keep track of any received callbacks per sleep cycle, update the animation tick, and then invoke the callbacks.
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.
We trigger update_timers_and_animations() every time the event loop wakes up.
If there's a real animation in the UI going on, that'll also trigger a
request_redraw() call and all will be well.
But when the only source of animation is set_has_active_animations() from
RenderingMetricsCollector, then we might end up in a situation where the event
loop is woken up before the rendered frame is on the screen, which means we
invoke update_timers_and_animations(), but we won't render because the
previous frame isn't shown yet. When it is shown and our presentation callback
is invoked, has_active_animations() is false again.
So instead, remember if we need to re-render once after rendering()
and use that to decide if we need to re-render in the presentation callback.
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.
This is the initial implementation based on DRM dumb buffers,
which cleans up various things at the same time:
- DRM output is separate from GBM and DRM dumb buffer displays.
The latter two re-use the former.
- The timer refresh for the Vulkan KHR Display rendering lives
now with the KHR display code, in hope to be replaced with a
better mechanism in the future.
What's missing still is support for partial updates as well as
rendering with our own software renderer.
Remove the hack of calling present() from our swap_buffers() forwarder (and let it really only forward),
and instead call it explicitly through the shared egl_display member.
The way we can pass along the callback instead of storing it separately.
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.