Commit graph

15 commits

Author SHA1 Message Date
Simon Hausmann
4df0334ed2 Fix regular key press event handling with winit
With commit

    9ca87ab312

and

    c62b0e5316

the winit event loop sends our KeyPress for
winit::event::WindowEvent::KeyboardInput only when the virtual key code
matches our specially encoded keys. For regular keys we rely on
winit::event::WindowEvent::ReceivedCharacter, for which we sent only
KeyRelease (which TextInput listens for), but not KeyPressed. With
this patch we simulate press & release.
2021-01-23 10:11:57 +01:00
Simon Hausmann
2d5f5fb821 Fix copy & paste shortcuts with Qt
* Rename logo to the more generic meta as keyboard modifier.
* Use control as the real modifier and map command key to it with
  winit and keep Qt semantics as-is.
2021-01-22 17:06:35 +01:00
Simon Hausmann
c62b0e5316 Fix copy & paste with the GL backend
We rely on ReceivedCharacter to send the event to the item for
combinations like Ctrl+C, instead of the single KeyEvent from winit. We
use the latter only for special key codes.
2021-01-22 15:18:38 +01:00
Simon Hausmann
d022dc1293 Make KeyEvent a struct
This way it's easier to expose to .60
2021-01-22 13:47:52 +01:00
Simon Hausmann
ae1178dd55 Make the modifiers simple booleans in the key event
This will give a nicer API to expose to .60. If the struct weren't
repr(C) then the booleans would be nicely packed, but alas that's not
happening. On the other hand we're not keeping many instances of them
around.
2021-01-22 13:47:52 +01:00
Simon Hausmann
886dd425fc Rename KeyEvent::KeyPress::string to text
It's the textual representation of the key
2021-01-22 13:47:52 +01:00
Simon Hausmann
44687bd219 Fix wasm build 2021-01-22 10:25:26 +01:00
Simon Hausmann
22749d4240 Remove the winit dependency from corelib
The last dependency were the keyboard modifiers, which we can map
manually.
2021-01-22 10:15:05 +01:00
Simon Hausmann
9ca87ab312 Simplify KeyEvent
Fold CharacterInput into KeyPressed/KeyReleased and store the "key" as a string.

Also, instead of exposing the KeyCode we're encoding special characters
into the string.
2021-01-22 10:15:05 +01:00
Simon Hausmann
2b7a1eebcd Prepare winit event loop for show()/hide() on PlatformWindow
Reduce the dependency of the GLRenderer to a new trait that exposes the
EventLoopTarget and EventLoopProxy. Those are provided by either an
winit::event_loop::EventLoop or, once the loop is started using the
self-consuming run(), by the event loop target provided to the run_fn.

This way renderers can be created from either within run or before.
The initial event loop instance is kept in TLS. When starting the loop,
it's taken out and instead the event loop target is placed into a scoped
tls variable.
2021-01-18 20:26:09 +01:00
Olivier Goffart
2d7817e049 Rename GenericWindow -> PlatformWindow 2021-01-15 18:32:55 +01:00
Olivier Goffart
cb0a21115f Remove set_width/height from GenericWindow trait 2021-01-15 15:12:12 +01:00
Olivier Goffart
dcb347fb7b Move more functions from the GenericWindow to the Window 2021-01-15 15:02:55 +01:00
Olivier Goffart
0ab60dff81 continue Window refactoring. Remove a few function from GenericWindow 2021-01-15 15:02:55 +01:00
Olivier Goffart
9ef1c36a52 Move the eventloop module to the backend 2021-01-14 08:53:13 +01:00
Renamed from sixtyfps_runtime/corelib/eventloop.rs (Browse further)