Bug 731610

Summary: ibus enables or disables itself when text input focus changes
Product: [Fedora] Fedora Reporter: David <redhat>
Component: ibusAssignee: fujiwara <tfujiwar>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 16CC: abetakehiko, i18n-bugs, kas, nomnex, robinlee.sysu, shawn.p.huang, tfujiwar
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: ibus-1.3.99.20110419-17.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-08 09:27:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David 2011-08-18 03:02:55 UTC
Description of problem:
Depending on the setting "Share the same input method among all applications," ibus will either always enable itself when text focus changes, or always disable itself.

Version-Release number of selected component (if applicable):
ibus-1.3.99.20110419-13.fc15.x86_64
ibus-anthy-1.2.6-3.fc15.x86_64
ibus-chewing-1.3.9.2-3.fc15.x86_64
ibus-gtk2-1.3.99.20110419-13.fc15.x86_64
ibus-gtk3-1.3.99.20110419-13.fc15.x86_64
ibus-hangul-1.3.1-6.fc15.x86_64
ibus-libs-1.3.99.20110419-13.fc15.x86_64
ibus-m17n-1.3.2-7.fc15.x86_64
ibus-pinyin-1.3.99.20110706-2.fc15.x86_64
ibus-pinyin-db-open-phrase-1.3.99.20110706-2.fc15.noarch
ibus-qt-1.3.1-4.fc15.x86_64
ibus-rawcode-1.3.1.20100707-4.fc15.x86_64

How reproducible: Always

Steps to Reproduce:

Install Firefox, KDE, ibus, and the ibus-pinyin input method. Bug is probably not limited to this setup.

1. Open Firefox and Konsole.
2. Right click on the ibus icon in the tray and click "Preferences."
3. In the "Advanced" tab, check the box named "Share the same input method among all applications"
4. Close the dialog
5. Restart ibus by right clicking its tray icon and choosing restart
6. Type something in Konsole. Notice ibus is disabled. I have a US keyboard so letters show up in Konsole.
7. Enable ibus by left clicking its tray icon and choosing "Chinese - Pinyin."
8. Type something in Konsole. ibus is enabled and produces Chinese output as expected.
9. Disable ibus by left clicking its tray icon and choosing "Turn off input method."
10. Move text input focus to a text box in Firefox e.g. by going to google.com.
You may have to switch text input focus a couple of times for the bug to appear, but it always does after just 1-2 more alt-tabs.

Actual results:
ibus is now enabled and keystrokes produce Chinese

Expected results:
ibus remains disabled and keystrokes produce letters

The opposite happens when the checkbox is unchecked:
1. Open Firefox and Konsole.
2. Right click on the ibus icon in the tray and click "Preferences."
3. In the "Advanced" tab, uncheck the box named "Share the same input method among all applications"
4. Close the dialog
5. Restart ibus by right clicking its tray icon and choosing restart
6. Type something in Konsole. Notice ibus is disabled. I have a US keyboard so letters show up in Konsole.
7. Enable ibus by left clicking its tray icon and choosing "Chinese - Pinyin."
8. Type something in Konsole. ibus is enabled and produces Chinese output as expected.
9. Move text input focus to a text box in Firefox e.g. by going to google.com. ibus is disabled and produces letters as expected.
10. Move text input focus back to Konsole.

Actual results:
ibus is now disabled and keystrokes produce letters

Expected results:
ibus remains enabled for Konsole and keystrokes produce Chinese


Additional info: This also occurs on my second machine which has a similar setup. I have fully updated F15 packages. This bug does not repro if I use two Konsole windows instead of Konsole and Firefox.

Comment 1 fujiwara 2011-08-19 02:57:57 UTC
*** Bug 731910 has been marked as a duplicate of this bug. ***

Comment 2 fujiwara 2011-08-19 04:37:23 UTC
Enabled "Share the same input method..." includes two problems.
The first problem is for ibus upstream:
https://github.com/fujiwarat/ibus/commit/cd1af7580346556d2ef493f514c61dfda3cde177
The second problem is for the bridge hotkey (this problem does not effect f15
but f16 or later.)

Disabled "Share the same input method..." is caused by my typo.


The following is the changelog:
https://github.com/fujiwarat/ibus/commits/gjs/
--- ibus-1.3.99.20110419/bus/ibusimpl.c.orig 2011-08-19 11:13:42.017416193
+0900
+++ ibus-1.3.99.20110419/bus/ibusimpl.c 2011-08-19 11:14:59.890356540 +0900
@@ -1730,12 +1730,14 @@ bus_ibus_impl_set_focused_context (BusIB
     }

     BusEngineProxy *engine = NULL;
+    gboolean is_enabled = FALSE;

     if (ibus->focused_context) {
         if (ibus->use_global_engine) {
             /* dettach engine from the focused context */
             engine = bus_input_context_get_engine (ibus->focused_context);
             if (engine) {
+                is_enabled = bus_input_context_is_enabled
(ibus->focused_context);
                 g_object_ref (engine);
                 bus_input_context_set_engine (ibus->focused_context, NULL);
             }
@@ -1757,7 +1759,9 @@ bus_ibus_impl_set_focused_context (BusIB
         /* attach engine to the focused context */
         if (engine != NULL) {
             bus_input_context_set_engine (context, engine);
-            bus_input_context_enable (context);
+            if (is_enabled) {
+                bus_input_context_enable (context);
+            }
             g_object_unref (engine);
         }

--- ibus-1.3.99.20110419/bus/ibusimpl.c.bak 2011-08-19 11:50:05.427725067 +0900
+++ ibus-1.3.99.20110419/bus/ibusimpl.c 2011-08-19 11:49:47.050735220 +0900
@@ -1731,6 +1731,7 @@ bus_ibus_impl_set_focused_context (BusIB

     BusEngineProxy *engine = NULL;
     gboolean is_enabled = FALSE;
+    IBusEngineDesc *desc = NULL;

     if (ibus->focused_context) {
         if (ibus->use_global_engine) {
@@ -1738,6 +1739,7 @@ bus_ibus_impl_set_focused_context (BusIB
             engine = bus_input_context_get_engine (ibus->focused_context);
             if (engine) {
                 is_enabled = bus_input_context_is_enabled
(ibus->focused_context);
+                desc = bus_input_context_get_prev_hotkey_engine
(ibus->focused_context);
                 g_object_ref (engine);
                 bus_input_context_set_engine (ibus->focused_context, NULL);
             }
@@ -1762,6 +1764,7 @@ bus_ibus_impl_set_focused_context (BusIB
             if (is_enabled) {
                 bus_input_context_enable (context);
             }
+            bus_input_context_set_prev_hotkey_engine (ibus->focused_context,
desc);
             g_object_unref (engine);
         }

--- ibus-1.3.99.20110419/ui/gtk/panel.py.orig 2011-08-19 11:20:00.842121629
+0900
+++ ibus-1.3.99.20110419/ui/gtk/panel.py 2011-08-19 11:20:15.568112668 +0900
@@ -355,8 +355,6 @@ class Panel(ibus.PanelBase):

     def focus_out(self, ic):
         self.reset()
-        if self.__focus_ic and self.__focus_ic.is_enabled():
-            self.__focus_ic.disable()
         self.__focus_ic = None
         self.__language_bar.set_enabled(False)
         self.__language_bar.focus_out()

Comment 3 nomnex 2011-08-19 05:07:45 UTC
(In reply to comment #2)
> The second problem is for the bridge hotkey (this problem does not effect f15
> but f16 or later.)

Hello, F15 lxde here, so it does.

Comment 4 Fedora Update System 2011-08-19 05:22:20 UTC
ibus-1.3.99.20110419-17.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/ibus-1.3.99.20110419-17.fc16

Comment 5 Fedora Update System 2011-08-19 05:26:58 UTC
ibus-1.3.99.20110419-17.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/ibus-1.3.99.20110419-17.fc15

Comment 6 fujiwara 2011-08-19 05:32:30 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > The second problem is for the bridge hotkey (this problem does not effect f15
> > but f16 or later.)
> 
> Hello, F15 lxde here, so it does.

I think your problem is the first one but not the second one.
It would be good to check ibus-1.3.99.20110419-17.fc15 .

Comment 7 David 2011-08-19 05:54:32 UTC
I did rpm -Uhv on these packages:
ibus-1.3.99.20110419-17.fc15.x86_64.rpm
ibus-gtk2-1.3.99.20110419-17.fc15.x86_64.rpm
ibus-gtk3-1.3.99.20110419-17.fc15.x86_64.rpm
ibus-libs-1.3.99.20110419-17.fc15.x86_64.rpm

It behaves better, but not totally fixed. When "Share the same input method
among all applications" is unchecked, the behavior I get (i.e. the keys I press vs the characters that appear on screen) is correct, but the tray icon does not update correctly sometimes. It seems if I turn on ibus in Firefox, then switch to Konsole and toggle ibus on and off, the tray icon will not change while I'm focused on Konsole. It does update correctly for Firefox.

When "Share the same input method among all applications" is checked, the behavior is better but still buggy.

1. Focus a Konsole window.
2. Enable ibus for pinyin input.
3. Type some characters. Chinese shows up as expected.
4. Switch to Firefox.
5. Type some characters. Chinese shows up as expected.
6. Switch back to Konsole. Notice the tray icon still correctly indicates pinyin mode.
7. Type some characters. Letters show up instead of Chinese.
8. Left click on the ibus tray icon and select "Chinese - Pinyin."
9. Continue typing in Konsole. Notice that keystrokes still produce letters instead of Chinese.

Comment 8 fujiwara 2011-08-19 06:44:47 UTC
(In reply to comment #7)
> I did rpm -Uhv on these packages:
> ibus-1.3.99.20110419-17.fc15.x86_64.rpm
> ibus-gtk2-1.3.99.20110419-17.fc15.x86_64.rpm
> ibus-gtk3-1.3.99.20110419-17.fc15.x86_64.rpm
> ibus-libs-1.3.99.20110419-17.fc15.x86_64.rpm
> 

I cannot reproduce your problem.
Are you able to reproduce your problem with a new user account instead of the current your account?

Comment 9 David 2011-08-19 07:04:54 UTC
I just created a new user named ibustest and logged in to a fresh KDE desktop. Then I performed these steps:

1. Open a Konsole and run im-chooser.
2. Select ibus and close im-chooser.
3. Log out and log in.
4. Right click on ibus tray icon, click preferences.
5. Add pinyin input method.
6. Check "Share the same input method among all applications" 
7. Close preferences.
8. Restart ibus by right clicking on tray icon and selecting restart.
9. Open Konsole and Firefox and do the steps in comment #7. I got the exact same results as described in comment #7.

When the checkbox is unchecked, if I enable ibus in Konsole, then switch to Firefox and back to Konsole, as described in comment #7, the tray icon is incorrect but keystrokes produce Chinese as expected. Interestingly, if I now left click on the ibus tray icon, I get "No input window" as the only menu item (and that item is disabled/not clickable).

Comment 10 fujiwara 2011-08-19 08:22:36 UTC
Currently I don't think your problem is a general problem.
I cannot reproduce your problem.

Did you install ibus-qt?

How about restarting ibus when right click on ibus status icon and choose 'Restart' after you log into your session?

Are you able to try GNOME desktop?

Which theme do you use with KDE?
I'm interested in the result of the following script on your desktop.

% cat a.py 
import gtk

print "theme_name", gtk.settings_get_default().props.gtk_theme_name
print "icon_theme_name", gtk.settings_get_default().props.gtk_icon_theme_name
print "fallback_icon_theme",gtk.settings_get_default().props.gtk_fallback_icon_theme

% python a.py
theme_name QtCurve
icon_theme_name oxygen
fallback_icon_theme gnome

Comment 11 nomnex 2011-08-19 15:11:36 UTC
(In reply to comment #6)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > The second problem is for the bridge hotkey (this problem does not effect f15
> > > but f16 or later.)
> > 
> > Hello, F15 lxde here, so it does.
> 
> I think your problem is the first one but not the second one.
> It would be good to check ibus-1.3.99.20110419-17.fc15 .

It's not pushed yet. I ll try tomorrow. Thank you.

Comment 12 David 2011-08-20 06:56:04 UTC
I do have ibus-qt. ibus was working previously and also in previous versions of Fedora. This bus appeared very recently for me. A complete list of ibus packages that I have installed follows.

ibus-1.3.99.20110419-17.fc15.x86_64
ibus-anthy-1.2.6-3.fc15.x86_64
ibus-chewing-1.3.9.2-3.fc15.x86_64
ibus-gtk2-1.3.99.20110419-17.fc15.x86_64
ibus-gtk3-1.3.99.20110419-17.fc15.x86_64
ibus-hangul-1.3.1-6.fc15.x86_64
ibus-libs-1.3.99.20110419-17.fc15.x86_64
ibus-m17n-1.3.2-7.fc15.x86_64
ibus-pinyin-1.3.99.20110706-2.fc15.x86_64
ibus-pinyin-db-open-phrase-1.3.99.20110706-2.fc15.noarch
ibus-qt-1.3.1-4.fc15.x86_64
ibus-rawcode-1.3.1.20100707-4.fc15.x86_64

$ python a.py 
theme_name QtCurve
icon_theme_name oxygen
fallback_icon_theme gnome

Comment 13 fujiwara 2011-11-07 07:16:36 UTC
Probably I think it's good to try Fedora 16 and update ibus.

# yum install --enablerepo=updates-testing ibus
% rpm -q ibus
ibus-1.4.0-10.fc16.x86_64

Comment 14 nomnex 2011-11-07 08:47:15 UTC
(In reply to comment #13)
> Probably I think it's good to try Fedora 16 and update ibus.
> 
> # yum install --enablerepo=updates-testing ibus
> % rpm -q ibus
> ibus-1.4.0-10.fc16.x86_64

FYI, I was affected by this bug, but it has been fixed a few ibus updates earlier for me, on Fedora 15.

[mt@nh28d ~]$ rpm -q ibus
ibus-1.4.0-9.fc15.i686

Comment 15 David 2011-11-11 04:08:08 UTC
This is more severe in F16 than it was in F15 for me. With "Share the same input method among all applications" enabled, I can type pinyin into Konsole, then switch to Firefox and type pinyin, but once I switch back to Konsole I cannot enable ibus at all, even if I restart ibus. Left clicking its icon shows "no input window" when Konsole is active. This occurs on both my machines.

I'm using dvorak keyboard layout if that's relevant.

ibus-1.4.0-10.fc16.x86_64
ibus-gtk2-1.4.0-10.fc16.x86_64
ibus-gtk3-1.4.0-10.fc16.x86_64
ibus-libs-1.4.0-10.fc16.x86_64
ibus-pinyin-1.3.99.20110706-2.fc16.x86_64
ibus-pinyin-db-android-1.3.99.20110706-2.fc16.noarch
ibus-qt-1.3.1-5.fc16.x86_64

Comment 16 Takehiko Abe 2011-11-18 08:34:04 UTC
The bug came back to me sometime ago in FC15.

I upgraded to FC16 since, and the symptom got worse. ibus interacts
especially badly with Firefox. When I switch to Firefox and move the
focus to 'web search' box, the ibus gets disabled and the shortcut key
to toggle ibus stops working. Also I think ibus is responsible for
the bug 736872:

"Awesomebar flickers on every keystroke"
https://bugzilla.redhat.com/show_bug.cgi?id=736872

ibus-1.4.0-10.fc16.x86_64

Comment 17 Takehiko Abe 2011-12-15 12:33:48 UTC
I can no longer reproduce the firefox awesomebar issue I reported
above. It is gone.

And this bug -- "ibus enables or disables itself" seems to be fixed in
the recent ibus. but I cannot use it because of the other problem. I'm
currently using the upstream ibus.

ibus-1.4.0-11.fc16.x86_64

Comment 18 fujiwara 2011-12-30 07:14:37 UTC
(In reply to comment #17)
> the recent ibus. but I cannot use it because of the other problem. I'm

Probably I think it's not related with this bug. I think it would be good to open a new bug.

Comment 19 fujiwara 2012-03-19 01:40:25 UTC
Probably I think this won't be happened in Fedora 17 while I cannot reproduce this bus in Fedora 15/16.