-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
In the embedder.h documentation, It is said the the proper way to send the engine / framework with keyboard events is via the FlutterEngineSendKeyEvent function.
When sending keyboard events via this function, I can see that it internally sends a platform message to the "flutter/keydata" channel containing the data.
On the framework side, I can see ui.KeyData is received by the KeyEventManager. however, it seems that the manager only trigger keyboard events if a RawKeyEvent is recieved also. Or at least this is what one would think. Anyway, It is not properly documented in the embedder.h api what is the proper way to trigger keyboard events on the framework side, or that simply FlutterEngineSendKeyEvent has a bug. as by itself it does not trigger keyboard event like its documentation implies.
So please, either clarify the documentation or make sure FlutterEngineSendKeyEvent does the right thing.
Expected results
FlutterEngineSendKeyEvent will trigger keyboard events on the framework side.
Actual results
On the Framework side, ui.KeyData objects are buffered, KeyEventManager never triggers keyboard events.
Code sample
FlutterKeyEvent keyEvent {
.struct_size = sizeof(FlutterKeyEvent),
.timestamp = static_cast<double>(CurrentTimeMicroseconds()),
.type = FlutterKeyEventType::kFlutterKeyEventTypeDown,
.physical = SDL_TO_PHYSICAL_MAP.at(scancode),
.logical = SDL_TO_LOGICAL_MAP.at(key),
.character = key_name,
};
FLUTTER_CHECK(_engine.SendKeyEvent(_flutterEngine, &keyEvent , KeyboardFlutter, nullptr));
Screenshots or Video
No response
Logs
No response
Flutter Doctor output
[!] Flutter (Channel [user-branch], 3.12.0-11.0.pre.11, on Microsoft Windows [Version 10.0.22621.2134], locale en-US)
! Flutter version 3.12.0-11.0.pre.11 on channel [user-branch] at C:\libs\flutter
Currently on an unknown channel. Run flutter channel to switch to an official channel.
If that doesn't fix the issue, reinstall Flutter by following instructions at
https://flutter.dev/docs/get-started/install.
! Upstream repository unknown source is not a standard remote.
Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
• Framework revision 176f7e6 (7 weeks ago), 2023-06-25 00:00:25 -0400
• Engine revision 100f6fc
• Dart version 3.1.0 (build 3.1.0-246.0.dev)
• DevTools version 2.24.0
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly
to perform update checks and upgrades.
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
flutter config --android-sdk to update to that location.
[✗] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.6.5)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.6.33829.357
• Windows 10 SDK version 10.0.22000.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[✓] VS Code (version 1.81.1)
• VS Code at C:\Users\mrmai\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.48.0
[✓] Connected device (2 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.2134]
• Edge (web) • edge • web-javascript • Microsoft Edge 115.0.1901.200
[✓] Network resources
• All expected network resources are available.