You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Need a way to send synchronous keyboard events from embedder to Dart and get a response. #33521
Similar to #28310, we need to be able to synchronously take keyboard events from the platform embedder, pass them to Dart to be handled, and if they are not handled, then pass them back to the platform to give it a chance to handle them.
This is needed so that add2app has a hope of working in environments with keyboards (like desktops), and so that we can capture keys before they get to a soft keyboard, as requested way back in #5986 (and has come up repeatedly).
We need a way to determine whether key events have been handled, synchronously, so that embedders know whether to continue propagating them in the native view hierarchy.
It needs to be synchronous because key events need to be responded to synchronously on host platforms.
Relatedly, there have been general conversations several times in the past about the need for a formal keyboard API in embedding.h, rather than passing text input and key events via a platform channel.
I have a Wayland Embedder client working with the exception of Keyboard. I send key events, and they're dropped by the engine. It looks like I need to modify the Engine to register a "flutter/keyevent" handler. Will this change enable a default channel in the embedder for keyevents?
I have a Wayland Embedder client working with the exception of Keyboard. I send key events, and they're dropped by the engine. It looks like I need to modify the Engine to register a "flutter/keyevent" handler. Will this change enable a default channel in the embedder for keyevents?
Sorry to bump an old issue, but I'm having the same problem with this comment and I'm not sure where to ask.
I have successfully embedded Flutter in my OpenGL app using software renderer, using the official 2.0.1 build (using official artifacts from the wiki page. Rendering & mouse/pointer events works fine. However, I'm not able to send or receive any platform messages to/from the flutter engine:
The FlutterProjectArgs.platform_message_callback is never called, and
sending keyboard events via flutter/keyevent has no effect (I implement something similar to the glfw key handler)
Also if I use a native plugin, if I invoke MethodChannel from Flutter/Dart side, it never returns.
For the project args, I only filled assets_path, icu_data_path & platform_message_callback, and the rest I leave to the default values.
Are there other prerequisites for communication with flutter using platform messages?
@siavee That has nothing to do with this issue. Most likely you aren't servicing the engine tasks (either by providing a platform task runner, or regularly calling the deprecated __FlutterEngineFlushPendingTasksNow).
If that's not it, you should either file a new issue or use a resource like StackOverlfow or Discord, since this issue was about adding specific new functionality for key events.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
stuartmorgan-g commentedon May 29, 2019
Relatedly, there have been general conversations several times in the past about the need for a formal keyboard API in embedding.h, rather than passing text input and key events via a platform channel.
jkurtw commentedon Sep 10, 2019
b/140830852
jwinarske commentedon Apr 10, 2020
I have a Wayland Embedder client working with the exception of Keyboard. I send key events, and they're dropped by the engine. It looks like I need to modify the Engine to register a "flutter/keyevent" handler. Will this change enable a default channel in the embedder for keyevents?
stuartmorgan-g commentedon Apr 10, 2020
The listener is in the framework code, and is always present. You should not need to modify the engine.
No (per above), but it will provide an explicit API in embedder.h that embedders should use instead of the message channel.
Sunbreak commentedon Sep 24, 2020
IIRC, someone were experimenting on merging Platform Runner & UI Runner.
Would it be another option?
gspencergoog commentedon Jan 25, 2021
This was fixed by the various delayed key event changes. Closing.
nilsreichardt commentedon Feb 19, 2021
This can be moved to "Done" in project "Desktop Features", right?
gspencergoog commentedon Feb 19, 2021
@nilsux Yes, done. Thanks.
siavee commentedon Mar 18, 2021
Sorry to bump an old issue, but I'm having the same problem with this comment and I'm not sure where to ask.
I have successfully embedded Flutter in my OpenGL app using software renderer, using the official 2.0.1 build (using official artifacts from the wiki page. Rendering & mouse/pointer events works fine. However, I'm not able to send or receive any platform messages to/from the flutter engine:
FlutterProjectArgs.platform_message_callbackis never called, andflutter/keyeventhas no effect (I implement something similar to the glfw key handler)Also if I use a native plugin, if I invoke MethodChannel from Flutter/Dart side, it never returns.
For the project args, I only filled
assets_path,icu_data_path&platform_message_callback, and the rest I leave to the default values.Are there other prerequisites for communication with flutter using platform messages?
Thanks!
stuartmorgan-g commentedon Mar 18, 2021
@siavee That has nothing to do with this issue. Most likely you aren't servicing the engine tasks (either by providing a platform task runner, or regularly calling the deprecated
__FlutterEngineFlushPendingTasksNow).If that's not it, you should either file a new issue or use a resource like StackOverlfow or Discord, since this issue was about adding specific new functionality for key events.
siavee commentedon Mar 18, 2021
@stuartmorgan Thanks for the response! That's probably it, I'll try providing a task runner and I'm very sorry about the noise.
github-actions commentedon Aug 4, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.