-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyboard support #9
Changes from all commits
aad3c0a
3b96e14
161f7aa
adfa1af
2844856
b14b4da
2c96148
6b4d813
a8668d4
52deb80
3381910
c4b4bf1
9c64170
6db884f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ build | |
build-clang | ||
.cache | ||
subprojects/wlroots | ||
.vscode |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,30 @@ class _SurfaceViewState extends State<SurfaceView> { | |
return Listener( | ||
onPointerSignal: controller.dispatchPointerEvent, | ||
child: Focus( | ||
onKeyEvent: (node, event) { | ||
final KeyStatus status; | ||
|
||
if (event is KeyDownEvent) { | ||
status = KeyStatus.pressed; | ||
} else { | ||
status = KeyStatus.released; | ||
} | ||
Comment on lines
+84
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this necessarily It would at least be nice to do an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wlroots doesn't have a concept for repeat, instead it decides to "repeat" once it gets enough down events for the same key (at least by observing how it behaves + no enum entry for repeat) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does seem like wlroots has the concept of repeats, as evident by So wlroots uses subsequent There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pardon, i corrected myself in a comment later on. As i stated there, as long as a key is signaled as being pressed then it will be "repeated". Once the key is signaled as up then it will stop being repeated There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Basically what @HrX03 said. wlroots will send up events which will work as repeat. |
||
|
||
int? keycode = physicalToXkbMap[event.physicalKey.usbHidUsage]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the function for this in the compositor |
||
|
||
if (keycode != null) { | ||
compositor.platform.surfaceSendKey( | ||
widget.surface, | ||
keycode, | ||
status, | ||
event.timeStamp, | ||
); | ||
|
||
return KeyEventResult.handled; | ||
} | ||
|
||
return KeyEventResult.ignored; | ||
}, | ||
child: _MeasureSize( | ||
onChange: (size) { | ||
if (size != null) { | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this mapping from? Is there any reason not to do this on the C side where the other parts of the mapping live?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is taken from the gtk embedding iirc and it's just a reversed version of the xkb to physical map. Imo it should be in dart as it's easier to handle there as in c, but I'm open to anything really
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What @HrX03 said. This mapping is take from Linux embedder https://github.com/flutter/engine/blob/master/shell/platform/linux/key_mapping.cc#L20
it's documented here https://github.com/flutter/flutter/blob/master/dev/tools/gen_keycodes/README.md