preedit commit on focus out - fujiwarat/ibus GitHub Wiki
Previous commits:
http://github.com/fujiwarat/ibus/commit/8ee38642d8e0b861cf03d60374a3462de201d16a
http://github.com/fujiwarat/ibus/commit/0211cdaa80721aac1aade8c76c90ace9c9ccce3d
http://github.com/fujiwarat/ibus/commit/e4d02bb966788291168e51225aaeab24f80ff424
http://github.com/fujiwarat/ibus/commit/ff8cdb6f36a6f1024c3295ca75be6c444209d407
Discussion Log:
8 03 17:20:50 <phuang_> ping fujiwarat 8 03 17:21:03 <fujiwarat> hi phuang_ 8 03 17:21:46 <phuang_> Do you remember the preedit_mode 8 03 17:22:16 <phuang_> I mean commit preedit text when focus_out, or switch to other IME 8 03 17:22:33 <fujiwarat> Yes, we implemented for ibus-hangul. 8 03 17:22:41 <phuang_> right 8 03 17:23:02 <phuang_> Do you think if gtk im module should know it? 8 03 17:24:01 <phuang_> Chrome has a problem 8 03 17:24:21 <fujiwarat> Sorry, I'm not sure. why do you think gtk im module? 8 03 17:24:28 <phuang_> In chrome, all input boxes share one ic 8 03 17:26:22 <fujiwarat> Is your problem related with preedit_mode? 8 03 17:26:25 <phuang_> when you click an input box, chrome will call focus_out for current input box, and focus_in the ic for the new input box 8 03 17:26:26 <phuang_> And the preedit text will be committed into the new input box 8 03 17:26:27 <phuang_> because the input box bind with IC has been changed 8 03 17:27:17 <phuang_> yeah 8 03 17:27:17 <phuang_> the daemon or IME will commit the preedit text, when the ic has been focused out 8 03 17:28:23 <phuang_> Maybe if gtk im module know the preedit mode, gtk im context could commit preedit text by self 8 03 17:29:26 <phuang_> What do you think? 8 03 17:30:33 <fujiwarat> OK, the current implementation is for each engine. If your immodule implementation can set the mode by each engine, probably I think it's no problem while I may not understand your problem. 8 03 17:35:09 <fujiwarat> Do you mean in chrome OS, every engine needs the preedit commit if the focus is changed? In other platforms, I think the condition is not needed. 8 03 17:36:29 <phuang_> no. 8 03 17:36:40 <phuang_> Only some ime needs it 8 03 17:37:05 <fujiwarat> ok 8 03 17:37:36 <phuang_> But when chrome changes the focus from input box A to B, the text will be committed into the B 8 03 17:37:43 <phuang_> But it should be into A 8 03 17:38:00 <phuang_> the reason is A and B share the same ibus IC 8 03 17:38:28 <fujiwarat> ok 8 03 17:39:03 <fujiwarat> Do you mean global input-method is enabled? 8 03 17:39:27 <phuang_> It is not related global input method 8 03 17:39:49 <fujiwarat> ok, it seems chrome specific. 8 03 17:39:53 <krisna> I recommend to solve this problem in client side. 8 03 17:39:55 <phuang_> Chrome browser and firebox share only one IC for all input boxes in web page] 8 03 17:40:38 <phuang_> So they will always switch IC from input box to another 8 03 17:40:50 <krisna> Client like chrome browser may call reset method before focus out. 8 03 17:41:30 <phuang_> yeah 8 03 17:41:48 <fujiwarat> ok 8 03 17:41:52 <phuang_> Does the reset cause committing preedit text? 8 03 17:42:03 <krisna> It depends on IME 8 03 17:42:13 <krisna> ibus-hangul will commit the last text. 8 03 17:42:14 <phuang_> yeah 8 03 17:42:18 <phuang_> right 8 03 17:42:47 <phuang_> if hangul commits it, the problem will happen 8 03 17:43:20 <phuang_> because reset and focus_out calls do not wait the reply from the IME 8 03 17:43:55 <phuang_> So chrome will receive the commit text, after switching to the new input box 8 03 17:44:18 <krisna> I don't know inside of ibus framework. Is there any method which is synchronous? 8 03 17:44:24 <fujiwarat> ok 8 03 17:44:42 <phuang_> most are async 8 03 17:45:02 <phuang_> But it could use sync mode by changing some code 8 03 17:45:20 <phuang_> but the sync method call will block the application 8 03 17:45:26 <krisna> Yes. 8 03 17:45:51 <phuang_> especially, some IME does not reply the call immediately (sometime, the ime crashed) 8 03 17:46:06 <krisna> reset method can be sync method? 8 03 17:46:43 <fujiwarat> I guess you might mean GtkIMContextClass->[focus_out|focus_in|reset] are called at first. 8 03 17:47:07 <phuang_> I want to avoid it. But if no other better solution, we have to do it 8 03 17:47:19 <phuang_> Sorry? 8 03 17:48:15 <phuang_> what do you mean? 8 03 17:48:31 <krisna> If we don't prefer sync method, implementing some code in client is unavoidable, I think. 8 03 17:49:14 <phuang_> yeah 8 03 17:51:03 <fujiwarat> If I could understand your problem correctly, gtk immodule's funcsions are called at first and committing preedit text in ibus-daemon is too late. 8 03 17:51:51 <fujiwarat> s/funcsions/functions/ 8 03 17:52:12 <phuang_> right 8 03 17:53:11 <phuang_> So if in im context reset function, ibus could emit commit signal, it could resolve this problem 8 03 17:53:23 <phuang_> but im context needs the preedit mode 8 03 17:53:51 <phuang_> to decide the if commit the preedit text 8 03 17:54:48 <fujiwarat> Probably it's ok to change the implementation. 8 03 17:55:25 <phuang_> yeah 8 03 17:55:36 <phuang_> Do you think if it will cause other problems 8 03 17:56:01 <phuang_> when user presses ctrl + space to switch ime 8 03 17:56:02 <phuang_> ? 8 03 17:56:55 <fujiwarat> Hmm.., I'm not sure. Probably I think we will need to test any changes. However myself will focus on xkb issues in this week. 8 03 17:57:39 <phuang_> OK 8 03 17:57:55 <phuang_> any progress about xkb 8 03 17:57:57 <phuang_> ? 8 03 17:59:38 <fujiwarat> I modified ibus-daemon to call libxklavier. Probably I'll contact you in this week. 8 03 18:01:06 <phuang_> ibus-daemon? 8 03 18:01:39 <phuang_> It is not good to make ibus-daemon dependence on X11 8 03 18:02:45 <fujiwarat> Currently ibus panel has no way to call X11 since it's python. 8 03 18:03:24 <phuang_> python has several lib to call c function 8 03 18:03:56 <phuang_> ctypes 8 03 18:03:59 <fujiwarat> OK, Another idea is ibus panel open lib directly without dbus. 8 03 18:04:18 <phuang_> I think 8 03 18:04:47 <phuang_> without dbus? 8 03 18:06:31 <fujiwarat> Yes, I mean python/site-packages/ibus/bus.py calls dbus if I try to use c libraries via ibus-daemon. 8 03 18:08:38 <phuang_> I don't know what is your mean 8 03 18:10:06 <fujiwarat> I mean currently if ibus panel uses c library, almost functions are called via dbus. 8 03 18:11:37 <phuang_> ibus panel could call libxklavier directly 8 03 18:12:27 <fujiwarat> OK, I will move the implementation to ibus panel. 8 03 18:13:02 <phuang_> thanks 8 03 18:13:42 <fujiwarat> thx