Closed erickzanardo closed 5 years ago
Some documentation about keyboard events:
hover run -b "@feature/key-events"
(You might need to upgrade hover
).Any feedback is greatly appreciated!!
That is some awesome news! I will be testing this tomorrow and report here.
Thanks a lot
I will review the PR soon:tm:!
@erickzanardo make sure to also checkout: #144 ;)
@Drakirus I tested and it worked great! I have already added an example on Flame's repository if you want to check out: https://github.com/luanpotter/flame/pull/92
Just a couple of comments, I tested on MacOs, and I have received instances of RawKeyEventDataLinux
instead of RawKeyEventDataMacOs
, it did not caused any issues though.
Also, I noticed a lot of these messages on the console while I kept the key pressed: go-flutter: Unknown key event type: 2
, this also did not caused any issues despite the console been spammed with those messages.
About #144 I took a lot on the PR but did not figured it out how to activate de fullscreen.
Thanks a lot for implementing this, and great work on this library.
@erickzanardo
Using go-flutter, you will receive RawKeyEventDataLinux
on each platform (mac, windows, linux). This is because go-flutter "proxies" GLFW key events, and those are only supported by RawKeyEventDataLinux
.
To start an app in fullscreen, add to the options list: flutter.WindowMode(flutter.WindowModeBorderlessFullscreen)
.
Make sure the app can close itself from full screen, or you'll be stuck in fullscreen ;)
Using the PopBehavior
option may also be interesting for Flame, it allows you to configure how go-flutter should handle the app asking for a "pop". It can be configured to minimize (aka iconify) or close the app. https://godoc.org/github.com/go-flutter-desktop/go-flutter#PopBehavior
@erickzanardo Tanks for your feedback!
The go-flutter: Unknown key event type: 2
error message occurs when go-flutter detects a gfw.Repeat
Action.
The flutter framework supports only keyDown
& keyUp
events, go-flutter matches the same configuration.
Awesome, thanks for the clarifications @Drakirus and @GeertJohan!
I just tested the fullscreen feature and it worked pretty well.
Awesome work!
Thanks @erickzanardo
@Drakirus Perhaps we can 'silence' the Unknown event type when it is glfw.Repeat? We know that glfw.Repeat exists, and we know we cannot send it to the Flutter Framework, so it can be ignored. Ofcourse it should still report for actions we do not know (perhaps are added in the future).
I was about to submit a PR on flutter/flutter that adds a new RawKeyRepeatEvent
event to RawKeyEvent
, but then I thought about the current implementation.
On Android, there is a [KeyEvent.getRepeatCount()
](https://developer.android.com/reference/android/view/KeyEvent.html#getRepeatCount()) that retrieve the repeat count of the event.
From what I can tell the above getter isn't used by the android shell meaning the keyDown event is sent even if the return value of getRepeatCount()
is superior to 0 (event occurred multiples times, glfw.Repeat
on GLFW).
On MacOS, there is a NsEvent.isARepeat()
that indicates whether the key event is a repeat.
On the current MacOS shell (From FDE) the NsEvent.isARepeat()
getter isn't used meaning keyDown even is sent event if the key is held down.
On iOS, there is no support for keyPress events flutter/engine#8606
Linux/Windows, (from FDE) are only supporting glfw.Press
and glfw.Release
events.
But I'll like to point out that the Linux/Windows (from FDE) impl was always behind MacOS impl.
Adding support for RawKeyRepeatEvent
in flutter/flutter involves changes on multiples shells.
For now, what I think we should do is to match the Android and MacOS implementation where multiples successive RawKeyDownEvent
event of the same key can be sent (translating glfw.Repeat
to a glfw.Press
action).
@GeertJohan do you have any objections? (we'll keep the comment saying RawKeyRepeatEvent
may be ported to the Flutter Framework, and that we are synthesizing a glfw.Press
event)
Sounds good @drakirus
Hello,
This may be a little out of scope of the project, but would be cool if there were support to RawKeyboard Events on this project.
I am a collaborator at a flutter game engine (https://github.com/luanpotter/flame), and with this kind of support, we could bring flutter games to desktop.
Thanks