Comments (22)
👍 Thank you so much for checking it out.
from flutter-desktop-embedding.
org.freedesktop.IBus.Portal
from flutter-desktop-embedding.
I understand that the linux version based on glfw is to be scrapped at some point and rewritten as a view but I am interested in just using GLFWKeyCallback and FlutterEngineSendPlatformMessage to send text to the flutter engine. There seems to be an issue with receiving platform messages at the minute.
I am using
FlutterProjectArgs args = {
.struct_size = sizeof(FlutterProjectArgs),
.assets_path = assets_path.c_str(),
.main_path = main_path.c_str(),
.packages_path = packages_path.c_str(),
.icu_data_path = icu_data_path.c_str(),
.command_line_argc = argc,
.command_line_argv = argv,
.platform_message_callback = (FlutterPlatformMessageCallback)OnPlatformMessage
};
but when I focus a TextFormField the OnPlatformMessage method does not get called. When should I be expecting the method to get called? Is there a setting that I am missing?
Many thanks.
from flutter-desktop-embedding.
Currently you have to run the Flutter event loop on Linux manually in order for platform messages to go through. See:
https://github.com/flutter/engine/blob/master/shell/platform/embedder/embedder.h#L169
and the related code in the in-review #27
from flutter-desktop-embedding.
@stuartmorgan perfect, thank you.
from flutter-desktop-embedding.
Keep in mind this solution is going to be deprecated pretty soon! I'm also currently working on Text Input, but it's coming along slowly, as I'm hoping I can do it without having to manually implement something to track text state.
from flutter-desktop-embedding.
This method has proved a little unreliable for me, so I am very excited about the replacement.
I was hoping to register the client id and followed by the properties of the text on selection and then only having to ever track one client id and its properties. What I am seeing is events being skipped e.g. select the text field - nothing happens, move the mouse, the client event triggers (but only sometimes).
There is also another thing that is happening, probably because I am doing something wrong... but when the selected client changes (between two text fields on the screen) the client selected id just keeps growing.
For now I have settled for having simple text input with the cursor being placed at the end of the input text and no selection. Will be really interesting to see how you end up doing it.
from flutter-desktop-embedding.
The macOS text input support ended up needing to implement a text editing model. I'd favor eventually creating an editing model that all platforms could use (which came up in a separate discussion about implementation languages).
from flutter-desktop-embedding.
@billy1380 So the client ID keeps growing, AFAIK, because you're not sending a message back to the engine saying that you've closed the client when it tells you to hide it. Correct me if I'm misunderstanding, though.
I'm also not aware if it's possible to defocus a client explicitly by, say, clicking on an area outside of the text field (I think this works on Mac because it steals focus from the text client? I'm unsure as I didn't write it).
But as far as I'm aware, the platform channel opens a new client whenever changing text fields, but before it does this it requests that the previously selected text field (if there is any) be closed.
from flutter-desktop-embedding.
You are right about not sending a message back... I will sort that out and see if it fixes the issue with the increasing client ids.
I will post a short clip of the behaviour during selection and see if you can spot what is going on.
Thanks for all the help.
from flutter-desktop-embedding.
So this is the capture of the "weird" behaviour... I click on the username field, nothing happens, I move the mouse and you see client 1 in the log, then I change focus and an event triggers but it is not the set client event. It recovers later but by still only when the mouse is moved after the click.
The ids are still growing because I have not fixed that, it might be that all this goes away when I provide the callback method, I just thought I should document the behaviour more clearly.
from flutter-desktop-embedding.
it turns out that the behavior was caused by using glfwWaitEvents, when I switch to glfwPollEvents() it works out... the odd thing now is that even though I am calling the flutter engine back... the client ids are still growing and I am still missing some setClient events.
from flutter-desktop-embedding.
Do you have a fork that I could look at? Also have you looked at #27 ? The plugin framework doesn't look like it'd handle text support very well at the moment, but I haven't looked into it too much this week.
from flutter-desktop-embedding.
Also that review is just for the file explorer
from flutter-desktop-embedding.
I looked at #27 that is where I got the clue for the glfwPollEvents... the code is too messy and littered with couts at the minute but I will fork and create a branch for you to take a look... will ping you once its done. Thanks again.
from flutter-desktop-embedding.
Sorry this took so long, but can you take a look at master here https://github.com/billy1380/flutter-desktop-embedding. I am using rapidjson headers in the include folder because I figured it was being imported in the flutter engine build.
Thanks
from flutter-desktop-embedding.
Thanks for the commit! Takin a look
from flutter-desktop-embedding.
Oh man, what a bummer, I've been checking this out on the MacOS embedder, and it seems to me like this is expected behavior AFAICT
from flutter-desktop-embedding.
What's expected behavior?
from flutter-desktop-embedding.
Switching between the text fields over and over causes the client ID to go up monotonically.
from flutter-desktop-embedding.
Right. Yeah, I think that's expected given how the Flutter framework code is written.
from flutter-desktop-embedding.
Forgot to close this when #46 landed. (It's regressed since, but that's tracked in issue #65).
from flutter-desktop-embedding.
Related Issues (20)
- window_size null-safety HOT 1
- Flutter launch error HOT 7
- setInitialRoute for Windows flutter::FlutterViewController HOT 1
- Window size is not correct when i first lunch the app unless i drag it HOT 3
- can't set window size. HOT 4
- App crashes if first minimize the window and then call setWindowVisibility(visible: true) HOT 1
- Throws MissingPluginException during test HOT 2
- setWindowMinSize and setWindowMaxSize not working in Flutter 2.8.0 on Windows 11 HOT 2
- Could not find a file named "plugins/file_chooser/pubspec.yaml HOT 4
- File Description HOT 1
- Linux on ARM: window_size causes "pub get" to hang HOT 3
- [menubar] 'MenuItem' is imported from both 'package:flutter/src/widgets/platform_menu_bar.dart' and 'package:menubar/src/menu_item.dart' HOT 1
- [window_size] Window size cause GitHub timeout during flutter pub get HOT 1
- [menubar] Add "disabled" boolean on NativeMenuItem HOT 1
- Auto-Update flutter desktop app like Discord and Telegram desktop apps HOT 2
- DPI scale reactor needed HOT 1
- Git error. Command: `git clone --mirror git://github.com/google/flutter-desktop-embedding.git HOT 1
- [window_size] setWindowMinSize calculates window size without using DPI on some Windows version HOT 1
- is there in Flutter itself already ? HOT 1
- Run Flutter app in windows 32 bit HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter-desktop-embedding.