Git Product home page Git Product logo

Comments (22)

billy1380 avatar billy1380 commented on April 28, 2024 1

👍 Thank you so much for checking it out.

from flutter-desktop-embedding.

mrmcq2u avatar mrmcq2u commented on April 28, 2024

org.freedesktop.IBus.Portal

from flutter-desktop-embedding.

billy1380 avatar billy1380 commented on April 28, 2024

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.

stuartmorgan avatar stuartmorgan commented on April 28, 2024

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.

billy1380 avatar billy1380 commented on April 28, 2024

@stuartmorgan perfect, thank you.

from flutter-desktop-embedding.

awdavies avatar awdavies commented on April 28, 2024

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.

billy1380 avatar billy1380 commented on April 28, 2024

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.

krisgiesing avatar krisgiesing commented on April 28, 2024

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.

awdavies avatar awdavies commented on April 28, 2024

@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.

billy1380 avatar billy1380 commented on April 28, 2024

@awdavies

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.

billy1380 avatar billy1380 commented on April 28, 2024

flutter clicking

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.

billy1380 avatar billy1380 commented on April 28, 2024

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.

awdavies avatar awdavies commented on April 28, 2024

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.

awdavies avatar awdavies commented on April 28, 2024

Also that review is just for the file explorer

from flutter-desktop-embedding.

billy1380 avatar billy1380 commented on April 28, 2024

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.

billy1380 avatar billy1380 commented on April 28, 2024

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.

awdavies avatar awdavies commented on April 28, 2024

Thanks for the commit! Takin a look

from flutter-desktop-embedding.

awdavies avatar awdavies commented on April 28, 2024

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.

krisgiesing avatar krisgiesing commented on April 28, 2024

What's expected behavior?

from flutter-desktop-embedding.

awdavies avatar awdavies commented on April 28, 2024

Switching between the text fields over and over causes the client ID to go up monotonically.

from flutter-desktop-embedding.

krisgiesing avatar krisgiesing commented on April 28, 2024

Right. Yeah, I think that's expected given how the Flutter framework code is written.

from flutter-desktop-embedding.

stuartmorgan avatar stuartmorgan commented on April 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.