Commit graph

27 commits

Author SHA1 Message Date
Tobias Hunger
4c331f1ac2
janitor: More clippy fixes
None of these should be controversial: It is all similar to quick fixes
I pushed before.
2022-01-09 14:50:58 +01:00
Tobias Hunger
43e4b262c2
janitor: Remove some more unnecessary clone() calls 2022-01-09 14:34:03 +01:00
Tobias Hunger
d13067db04 Add key_code for BackTab 2022-01-08 20:37:18 +01:00
Tobias Hunger
e99c1afa4b
janitor: Turn !x.is_ok() into x.is_err() 2022-01-04 18:21:36 +01:00
Tobias Hunger
bfca0e3573 Mass update copyright messages to be more REUSE compliant 2021-12-22 10:06:12 +01:00
Simon Hausmann
d8988cae6c Prospective fix for making invoke_from_event_loop work better in WASM
When called from inside some winit event handler, we'd go straight to
`with_window_target` to get hold of the event proxy and send it. However
when called through some external event handler (DOM), the scoped
CURRENT_WINDOW_TARGET would not be set and MAYBE_LOOP_INSTANCE would
also be empty because `run` takes it. So instead we'd end up creating an
new event loop instance and the event would sit in there forever.

Instead, this change brings WASM in line with the other platforms by
using the dedicated event loop proxy (global_proxy). Because of the lack
of threading the dance of storage for that is a little different though.
2021-12-13 15:51:28 +01:00
Simon Hausmann
e0a942dc1c Avoid the use of symlinks for source files
On Windows 10, the creation of symlinks by normal users requires
enabling the developer mode, which may or may not be acceptable in
corporate environments with restricted IT setups.

We introduced the symlinks for the shared special key codes mapping,
which instead this patch places into a shared sixtyfps-common crate.
2021-12-13 15:51:10 +01:00
Olivier Goffart
733d4ed365 Handle more non printable key
Share the code that defines the key with a macro over all the backends using
a symlink.

This is a symlink rather than exposing the macro directly since we add this
module in every backend, and each backend re-declares the macro to handle
the part that it needs. This needs to be a symlink because it will also be shared
with the compiler that does not depends on sixtyfps-corelib
2021-12-10 11:28:09 +01:00
Olivier Goffart
181c8aced7 GL backend: allow to override scale factor with an env variable
SIXTYFPS_SCALE_FACTOR override the scale factor at runtime
2021-12-08 17:28:23 +01:00
Simon Hausmann
6ca63aac9c Make it possible to delegate the timer handling to the backend
When building with no_std, the backend can provide the global
instant.
2021-11-30 17:27:55 +01:00
Simon Hausmann
b29b2cfaea Make WinitWindow::apply_window_properties work outside the GL backend crate
Move the image loading related bit for the icon back into glwindow.

Amends commit
51469be56b.
2021-11-12 11:44:39 +01:00
Simon Hausmann
e3ee59fd13 Fix transitioning from fixed size to resizable window with the GL backend
PR #642 fixed making the window not resizable when it has initially a
fixed size. This change applies a different logic with the same
resulting effect when the window item changes later, for example when
transiting in the live-preview from a fixed size to a resizable window -
by looking at the min/max constraints.
2021-11-12 09:06:35 +01:00
Simon Hausmann
51469be56b Move more of the winit related code from PlatformWindow impl into WinitWindow
This will allow code sharing with the simulator in the future.
2021-11-12 09:02:52 +01:00
Simon Hausmann
68ec3ccf6f GL backend cleanup
Move the window constraint application handling into WinitWindow,
for future sharing.
2021-11-11 11:47:54 +01:00
Simon Hausmann
ad1b251966 Internal cleanup
Centralize the setting of the width/height on the window item in the core library.
2021-11-11 11:47:54 +01:00
Simon Hausmann
3c0607276c Make the GL backends' winit driven event loop a reusable module
Abstract away the dependency to the former GraphicsWindow by

(1) Renaming GraphicsWindow to GLWindow
(2) Introducing a WinitWindow trait
2021-11-11 11:45:56 +01:00
Philipp Gesang
cd3717af9a handle tab keycode in backend
Treating the Tab key as text disallows handling Shift-Tab because
the shift modifier will not be passed down. This makes the
handling of Tab analogous to Escape, Return and other non-text
keycodes.
2021-11-08 16:04:37 +01:00
Simon Hausmann
05b7d3e2ee Avoid over-eager animation ticks
Only update animations on input events and when the windowing system requests a redraw.
2021-10-05 12:43:11 +02:00
Simon Hausmann
e987a4aba3 Fix granularity of run-time borrows in GL backend window handling
When processing window specific events, or generally when accessing
the ALL_WINDOWS refcell, keep the time for borrow to an absolute
miniumum. That way any subsequent method calls may further acquire the
refcell.

This patch re-organizes the entire deeply nested window event handling
in a function with slightly less indentation.

Fixes a panic when calling hide on a Window from within a callback
handler.

Fixes #539
2021-10-05 12:43:11 +02:00
Olivier Goffart
2716e4b4dd TouchArea: add the pointer-event callback
... instead of `pressed-changed`

This allows to see what mouse button was pressed.

Closes #535
2021-10-04 14:39:49 +02:00
Olivier Goffart
465857c42e Handle the Keypad Enter as Return
Fixes #525 : LineEdit::accepted doesn't react on numpad Enter
2021-09-30 11:48:09 +02:00
Simon Hausmann
ed3d848d02 Fix native widget rendering when the window is inactive
Set QStyle::State_Active conditional to whether the window is active,
which maps to Qt's active window concept and winit's has-focus (until we
render popups differently).
2021-09-15 15:34:34 +02:00
Simon Hausmann
ce62cce266 Internal cleanup: Simplify some Option handling
Replace

   if let Some(Some(Foo)) = bar.map(|some_weak| weak.upgrade())

with

   if let Some(Foo) = bar.and_then(|some_weak| weak.upgrade())
2021-09-01 18:29:32 +02:00
Simon Hausmann
549fcb049b Internal cleanup: Move the scale factor property into the shared runtime Window 2021-09-01 18:20:23 +02:00
Simon Hausmann
60082b84b0 GL backend: remove unnecessary window scale factor refresh call
When the window is mapped, the scale factor is brought up-to-date. Only
after that we can receive a resize event or a window scale factor
changed event.
2021-09-01 18:20:23 +02:00
Simon Hausmann
6db89e3468 Fix key events the control modifier on Windows, X11 and Wayland
Under these windowing systems, we receive a QString text from Qt that
contains a terminal control character (like \u{3} for ctrl+c). We
decided to supply the character for the key (for example 'c' for Ctrl+C)
to the application, so activate the conversion from the key code when
control characters are present.

With winit, we receive first a key down input event with the virtual key
code (for example C for Ctrl+C), followed by a ReceivedCharacter event
with a terminal control character. We choose to ignore that and instead
take the previously received key code and try to use that instead.

Fixes #441
2021-08-30 19:07:32 +02:00
Simon Hausmann
3ec2274365 internal cleanup: rename the eventloop module to event_loop
That's consistent with graphics_window and silences cSpell
2021-08-05 13:46:42 +02:00
Renamed from sixtyfps_runtime/rendering_backends/gl/eventloop.rs (Browse further)