Skip to content

Conversation

@swift-kim
Copy link
Member

Closes #221.

Please read this page for differences between the legacy RawKeyboard API and the new HardwareKeyboard API.

Since the legacy API has not been deprecated yet, a key event must be sent to the framework twice through the conventional platform channel and also the new embedder API (FlutterEngineSendKeyEvent) simultaneously. In our code, it's done by the SendChannelEvent and SendEmbedderEvent methods in the KeyEventChannel class respectively. As commented in the code, the KeyEventChannel class will be renamed and refactored once the old API is fully removed from the framework.

For the implementation, I referred to the desktop embedders (Windows and Linux) code. Since there's no numeric value that represents a "logical key code" on Tizen, I created a direct mapping (kSymbolToLogicalKeyCode) from key symbols (string) to Flutter's logical key codes.

There are also some other changes to code related to the legacy API:

  • Move the GTK key mapping to the key_mapping.cc file.
  • Remove symbol-to-scan code conversion (kSymbolToScanCode). This will affect existing apps that depend on physical key codes such as mediaPlayPause (the Play/Pause button on TV) and contextMenu (the Menu button on mobile).
  • Get a UTF32 code point from string instead of compose.
  • XF86SysMenu (TV remote control's Menu button which opens up the TV settings) has been removed from kBindableSystemKeys and now it's never handled by the app.

I'll do some more testing in this week. To test this change, you may create an app that contains Focus widgets such as KeyboardListener (new API) and RawKeyboardListener (legacy API) and implement onKey or onKeyEvent.

@bbrto21

This comment was marked as resolved.

@swift-kim swift-kim marked this pull request as draft June 15, 2022 02:06
@swift-kim swift-kim force-pushed the hardware-keyboard branch from 570be41 to dcd66c1 Compare June 23, 2022 09:32
@swift-kim swift-kim marked this pull request as ready for review June 23, 2022 09:33
@swift-kim
Copy link
Member Author

@bbrto21 The error seems to be fixed by dcd66c1. Could you please check again?

@bbrto21
Copy link

bbrto21 commented Jun 24, 2022

@swift-kim Thanks, problem solved!

Copy link
Member

@JSUYA JSUYA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@swift-kim swift-kim merged commit 748b4c7 into flutter-tizen:flutter-3.0.0-tizen Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Synchronous keyboard events

3 participants