Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the wait for the ibus daemon to start #3090

Merged
merged 2 commits into from
Jun 1, 2024

Conversation

matt335672
Copy link
Member

Fixes #3080 and tested by @seflerZ

The initial implementation of Uinicode input via IBus used a startup delay of 3 seconds to wait for the daemon to be ready before connecting to it.

This commit introduces a poll-wait loop which can remove the delay entirely if the daemon is up when chansrv starts the interface.

The initial implementation of Uinicode input via IBus used a startup delay
of 3 seconds to wait for the daemon to be ready before connecting to it.

This commit introduces a poll-wait loop which can remove the delay
entirely if the daemon is up when chansrv starts the interface.
unsigned int cnt = 0;
while (!addr && cnt < 10)
{
usleep(500 * 1000); // half a second
Copy link
Contributor

@seflerZ seflerZ May 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can increase the timeout a little longer, such as 3-5 seconds. Longer timeout has no side effects because it will end as soon as the iBus is ready. We can cover 99.99%+ computers for that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seflerZ - I think the timeout is 5 seconds with the above (10 * 0.5 secs). Is that enough?

@seflerZ
Copy link
Contributor

seflerZ commented May 30, 2024

Hi @matt335672 , according to @JulyIghor 's feedback. We have a duplicate registration in input_ibus.c. Would you apply this patch to fix it up? I've tested it works.

From 29c8bfbd6d7227956c6baa944aac4b2e5649d7ba Mon Sep 17 00:00:00 2001
From: seflerZ <sefler@126.com>
Date: Thu, 30 May 2024 14:42:22 +0800
Subject: [PATCH] remove duplicate enable&disable func registration

---
 sesman/chansrv/input_ibus.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sesman/chansrv/input_ibus.c b/sesman/chansrv/input_ibus.c
index 7b803e3a..b7ff2992 100644
--- a/sesman/chansrv/input_ibus.c
+++ b/sesman/chansrv/input_ibus.c
@@ -155,8 +155,6 @@ xrdp_input_main_loop(void *in_val)
     factory = ibus_factory_new(ibus_bus_get_connection(bus));
     g_object_ref_sink(factory);
     g_signal_connect(factory, "create-engine", G_CALLBACK(xrdp_input_ibus_create_engine), NULL);
-    g_signal_connect(factory, "enable", G_CALLBACK(xrdp_input_ibus_engine_enable), NULL);
-    g_signal_connect(factory, "disable", G_CALLBACK(xrdp_input_ibus_engine_disable), NULL);

     ibus_factory_add_engine(factory, "XrdpIme", IBUS_TYPE_ENGINE);

--
2.34.1

@matt335672 matt335672 merged commit 5c4278c into neutrinolabs:devel Jun 1, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to fix the delay, that is not needed if ibus is already started
2 participants