Update UI from EventDispatcher::schedule? #916
-
Summary: updating UI from EventDispatcher doesn't seem to work (no UI is shown). Short version: I created an EventDispatcher, attach it to instance's event loop. I call EventDispatcher::schedule with a lambda from a different thread, where I update the UI. Result: UI is not shown, but the UI update code inside lambda is called. Longer version: I have two processes (A and B). A is an Fcitx engine, call it ImsEngine, it publishes key event to ZMQ and another process (B) listens. ImsEngine creates ImsServer and it receives candidates from another process B (via ZMQ). ImsServer has a pointer to the event dispatcher, and runs in another thread. Whenever ImsServer receives candidates from ZMQ, it uses the event dispatcher to schedule an UI update. However, while the UI update code runs, the UI isn't shown. Thank you for the help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
I am not sure if this is the right solution, but it does the work: Use EvenDispatcher::schedule with a nullptr argument to wake up the event loop (the one from Instance when ImsEngine is initialized), and then do the UI update. |
Beta Was this translation helpful? Give feedback.
-
What's the version for fcitx5 and what's your environment? Can you provide the output of fcitx5-diagnose In some older version, there's indeed some bug that the xcb/wayland ui is not flushing the connection so Ui didn't really update. |
Beta Was this translation helpful? Give feedback.
This branch has a very obvious bug, the cmd is a variable on stack and schedule lambda capture the pointer to it.