Commit graph

18 commits

Author SHA1 Message Date
Olivier Goffart
1891e4489a GL backend: update the resizable flag
I only tested on X11 plasma, and there this doesn't have any effect,
But this might be needed because i removed it a few commit ago in another
function.

I think the reason it is there is that it allow changing from a fixed size
to a custom size
2022-04-01 16:18:59 +02:00
Olivier Goffart
16a0f28449 Keep the existing size re-using a window
Eg, in the viewer or in the preview.

The preferred size is still set as the size when the window is first open
2022-04-01 16:18:59 +02:00
Olivier Goffart
575665994a GL backend: don't force every window to be redrawn in case of animation
When the animation tick occurs, the tracker will tell winit to repaint
the relevant window already.
2022-03-23 17:43:48 +01:00
Olivier Goffart
bd44afdbf4 Wasm: When getting native callback, make sure to call the winit event loop
Otherwise it won't be woken up if the window needs a redraw
2022-03-23 17:43:48 +01:00
Simon Hausmann
e9350403bc Fix animations not running in secondary windows with wasm
When a second canvas is visible, only animations in the first canvas
resulted in updates and visible animation.  An animation in the second
canvas wouldn't result in repaints.

When we start an animation, we request a redraw on all windows and
return with `ControlFlow::Poll` to winit.

Winit then schedules an animation frame request, and in the callback the
redraw request events are delivered. For the first window we call
`update_animations()`, a new tick is detected (different than the
previous one) and animated properties are dirty and yield new windows.

Then right away we get called again with a redraw request for the second
window. update_animations() determines that the instant::now() is the
same, and has_animations() returns false. So at the end of the event
handler we return fail to return `Poll` and therefore no animation frame
request is created, which means the animations just stop.

Fix this by calling update_animations() only once, when all input events
have been processed and the redraw events are up for delivery next.

This is visible in the preview canvases in the documentation, if a
canvas other than the first has animations.
2022-03-22 14:22:27 +01:00
Olivier Goffart
e017d5118b Wasm GL backend: use a <input> element so it show the keyboard on mobile
cc #215

Handle Input event from the input directly instead of going through winit
for the TextInput.

Note that this doesn't handle the composition event well, so the text is
only considered written when it is accepted
2022-03-22 13:33:31 +01:00
Simon Hausmann
fb20113f17 Fix manual application of the window constraints with the HTML canvas
The size returned by inner_size is a physical size, so we must convert it to
a logical one before comparing it with the logical constraint sizes.
2022-03-21 16:53:30 +01:00
Lukas Jung
8617e92d65 add close request handling the gl backend 2022-03-17 08:51:00 +01:00
Olivier Goffart
f7a0fda86c
Send a MouseExit event when the mouse leaves the window
Fixes #989
2022-03-01 11:23:39 +01:00
Tobias Hunger
a8756119eb Update internal/backends/gl/event_loop.rs
Co-authored-by: Olivier Goffart <olivier@woboq.com>
2022-02-16 12:09:03 +01:00
Tobias Hunger
d443481dee Send less key events from the GL backend
When "combining" information from winit's ReceiveCharacter and
KeyboardInput events, then do not create a second KeyPress event
when the KeyboardInput contained a control character.

This makes us not send duplicate events for `Tab`, but leaves the
handling for e.g. `Ctrl-C` unchanged.
2022-02-16 12:09:03 +01:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Tobias Hunger
de4e195280
Rename internal crates and add a README.md to them
The README.md contains the warning that used to be in lib.rs.

Add README.md files to all internal crates

... pointing to the official public crate to use instead.

Rename internal crates

fixup: README files

fixup rename
2022-02-07 13:12:48 +01:00
Tobias Hunger
2b55c488ca
Rename sixtyfps to slint in internal 2022-02-02 16:16:55 +01:00
Tobias Hunger
1a0a495bc5
Rename environment variables 2022-02-02 13:35:07 +01:00
Simon Hausmann
ad0c020aa4 Rename the sixtyfps-corelib crate 2022-02-01 18:04:30 +01:00
Simon Hausmann
0bd627cad6 Rename the common crate 2022-02-01 18:00:25 +01:00
Tobias Hunger
a3b86690ff [reorg]: Move the rendering backends into internal 2022-01-31 16:00:50 +01:00
Renamed from sixtyfps_runtime/rendering_backends/gl/event_loop.rs (Browse further)