Description of problem: 1. Open a gedit window and a thunderbird window 2. In the gedit window, type something with an IBus engine (tested with « Intelligent Pinyin » and « Cangjie »), you get e.g Chinese characters 3. Switch to the Thunderbird window with alt-tab, then back to the gedit window with alt-tab again 4. Type something => latin letters appear instead of the result of the input method engine If you get Chinese characters in 4, insist a bit: alt-tab to Thunderbird again, then alt-tab back to gedit, and type. It doesn't happen 100% of the time, but quite frequently, so ifyou repeat enough it's going to happen sooner or later. Also, I found that it happens with other apps too, but not all (I reproduced it with Firefox and Xchat at least). However, Thunderbird lets me reproduce the issue the most frequently. I added some debugging in the do_process_key_event method of ibus-cangjie when I discovered the bug. When the bug happens, the do_process_key_event method is not even called. So in these cases, IBus doesn't pass the key events to the engine any more. ----- Version-Release number of selected component (if applicable): ibus-1.5.1-3.fc19.x86_64
Also, switch between windows **with alt-tab**. I found that switching between windows just by clicking on them doesn't trigger the bug. In case this matters, I'm running GNOME Shell 3.7.90 on Rawhide.
Thanks for the report. I confirmed Alt+Tab could move the focus to another input context. The tentative suggested fix is here: --- ibus-1.5.1/bus/inputcontext.c.orig +++ ibus-1.5.1/bus/inputcontext.c @@ -688,6 +688,22 @@ _ic_process_key_event (BusInputContext } } + /* If focus is changed by Alt+Tab, focus could be moved to + * non input context. Change the focused context again + * and set an engine from focused_context here. + */ + if (context->has_focus && context->engine == NULL && + context->fake == FALSE) { + BusInputContext *focused_context = + bus_ibus_impl_get_focused_input_context (BUS_DEFAULT_IBUS); + + if (focused_context != NULL && context != focused_context && + (context->capabilities & IBUS_CAP_FOCUS) != 0) { + context->has_focus = FALSE; + bus_input_context_focus_in (context); + } + } + /* ignore key events, if it is a fake input context */ if (context->has_focus && context->engine && context->fake == FALSE) { bus_engine_proxy_process_key_event (context->engine,
Scratch build is available: http://koji.fedoraproject.org/koji/taskinfo?taskID=5111447
I'm running the package from this scratch build now, and so far I haven't been able to reproduce the bug any more. Looks like we've got a fix. :)
Thanks for the test. If I press Alt+Tab and move the focus from gedit to thunderbird, the following focus events are happened: 1) (gedit:445): IBUS-WARNING **: 15:32:36:717 focus_out 2) (thunderbird:495): IBUS-WARNING **: 15:32:36:866 focus_in 3) (gedit:445): IBUS-WARNING **: 15:32:36:875 focus_in 4) (gedit:445): IBUS-WARNING **: 15:32:36:890 focus_out I will try to investigate why the focus_in event is happened.
This didn't happen at all in gnome 3.6, am I right?
Right. I don't see the same problem in 3.6. Transferring to mutter for the furthermore investigation.
If I press Alt+Tab and move the focus from gedit to thunderbird, the following focus events are happened in ibusimcontext: 1) (gedit:445): IBUS-WARNING **: 15:32:36:717 focus_out 2) (thunderbird:495): IBUS-WARNING **: 15:32:36:866 focus_in 3) (gedit:445): IBUS-WARNING **: 15:32:36:875 focus_in 4) (gedit:445): IBUS-WARNING **: 15:32:36:890 focus_out Probably the focus_in event is caused by gnome-shell: #0 ibus_input_context_focus_in (context=0x22ad3c0) at ibusinputcontext.c:1177 #1 0x00007f7e2addd406 in ibus_im_context_focus_in (context=0x260a170) at ibusimcontext.c:825 #2 0x00007f7e3a03bc8d in gtk_im_context_focus_in (context=0x260a170) at gtkimcontext.c:539 #3 0x00007f7e3a0400dc in gtk_im_multicontext_focus_in (context=0x25ca990) at gtkimmulticontext.c:410 #4 0x00007f7e3a03bc8d in gtk_im_context_focus_in (context=0x25ca990) at gtkimcontext.c:539 #5 0x00007f7e3a176c2d in gtk_text_view_focus_in_event (widget=0x25e8020, event=0x20c62f0) at gtktextview.c:5018 #6 0x00007f7e3a0620e4 in _gtk_marshal_BOOLEAN__BOXED (closure=0x2026340, return_value=0x7fff10e8ba30, n_param_values=2, param_values=0x7fff10e8bae0, invocation_hint=0x7fff10e8ba80, marshal_data=0x7f7e3a176b1e <gtk_text_view_focus_in_event>) at gtkmarshalers.c:85 #7 0x0000003a78e0fa72 in g_closure_invoke () from /lib64/libgobject-2.0.so.0 #8 0x0000003a78e2119f in signal_emit_unlocked_R () from /lib64/libgobject-2.0.so.0 #9 0x0000003a78e28c34 in g_signal_emit_valist () from /lib64/libgobject-2.0.so.0 #10 0x0000003a78e29702 in g_signal_emit () from /lib64/libgobject-2.0.so.0 #11 0x00007f7e3a20f2f5 in gtk_widget_event_internal (widget=0x25e8020, event=0x20c62f0) at gtkwidget.c:6703 #12 0x00007f7e3a20e944 in gtk_widget_event (widget=0x25e8020, event=0x20c62f0) at gtkwidget.c:6360 #13 0x00007f7e3a21f1d3 in gtk_widget_send_focus_change (widget=0x25e8020, event=0x20c62f0) at gtkwidget.c:14451 #14 0x00007f7e3a22d8dd in do_focus_change (widget=0x25e8020, in=1) at gtkwindow.c:6154 #15 0x00007f7e3a232fed in window_update_has_focus (window=0x22400c0) at gtkwindow.c:9420 #16 0x00007f7e3a233127 in _gtk_window_set_is_active (window=0x22400c0, is_active=1) at gtkwindow.c:9456 #17 0x00007f7e3a22da77 in gtk_window_focus_in_event (widget=0x22400c0, event=0x20c6530) at gtkwindow.c:6208 #18 0x00007f7e3a0620e4 in _gtk_marshal_BOOLEAN__BOXED (closure=0x2026340, return_value=0x7fff10e8c060, n_param_values=2, param_values=0x7fff10e8c110, invocation_hint=0x7fff10e8c0b0, marshal_data=0x7f7e3a22da1a <gtk_window_focus_in_event>) at gtkmarshalers.c:85 #19 0x0000003a78e0faf8 in g_closure_invoke () from /lib64/libgobject-2.0.so.0 #20 0x0000003a78e2119f in signal_emit_unlocked_R () from /lib64/libgobject-2.0.so.0 #21 0x0000003a78e28c34 in g_signal_emit_valist () from /lib64/libgobject-2.0.so.0 #22 0x0000003a78e29702 in g_signal_emit () from /lib64/libgobject-2.0.so.0 #23 0x00007f7e3a20f2f5 in gtk_widget_event_internal (widget=0x22400c0, event=0x20c6530) at gtkwidget.c:6703 #24 0x00007f7e3a20e944 in gtk_widget_event (widget=0x22400c0, event=0x20c6530) at gtkwidget.c:6360 #25 0x00007f7e3a060776 in gtk_main_do_event (event=0x20c6530) at gtkmain.c:1649 #26 0x0000003a87c52102 in gdk_event_source_dispatch () from /lib64/libgdk-3.so.0 #27 0x0000003a78247e96 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0 #28 0x0000003a782481e8 in g_main_context_iterate.isra.22 () from /lib64/libglib-2.0.so.0 #29 0x0000003a7824828c in g_main_context_iteration () from /lib64/libglib-2.0.so.0 #30 0x0000003a7969bf34 in g_application_run () from /lib64/libgio-2.0.so.0 #31 0x0000000000422ab0 in main ()
I filed a bug for mutter about focus events: https://bugzilla.gnome.org/show_bug.cgi?id=696259 If there is no reply, I will integrate the patch in Comment #2 in ibus.
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle. Changing version to '19'. (As we did not run this process for some time, it could affect also pre-Fedora 19 development cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.) More information and reason for this action is here: https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19
Fixed in upstream.