From f33e19bec6ab7d1a6133894c86fdeb5a81ce11f1 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Wed, 1 Oct 2014 16:21:02 +0900 Subject: [PATCH] Fix to lose a focus when move the focus from the delayed focus-in/out. Some applications likes google-chrome URL entry could have the delayed focus-in and focus-out events and ibus fails to get the new focus. BUG=rhbz#919863, rhbz#1136623 Review URL: https://codereview.appspot.com/7725045 --- bus/inputcontext.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/bus/inputcontext.c b/bus/inputcontext.c index b7e1ff8..d9924a1 100644 --- a/bus/inputcontext.c +++ b/bus/inputcontext.c @@ -773,6 +773,34 @@ _ic_process_key_event (BusInputContext *context, } } + /* If I move the focus from the URL entry box of google-chrome + * to the text buffer of gnome-terminal, + * focus-in/focus-out of google-chrome is caused after + * focus-in of gonme-terminal and gnome-terminal loses the focus. + * The following focus events are received in ibusimcontext: + * 1) (gnome-terminal:445): IBUS-WARNING **: 15:32:36:717 focus_in + * 2) (google-chrome:495): IBUS-WARNING **: 15:32:36:866 focus_out + * 3) (google-chrome:495): IBUS-WARNING **: 15:32:36:875 focus_in + * 4) (google-chrome:495): IBUS-WARNING **: 15:32:36:890 focus_out + * In 2), Just return because focused_context is not google-chrome. + * In 3), focused_context is changed from gnome-terminal to google-chrome + * In 4), focused_context is changed from google-chrome to faked_context. + * + * It seems google-chrome has a popup window of the prediction of URL + * and async focus-in/focus-out. + */ + 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, -- 1.8.5.3 From bb818e438599f080a0cffb0b7573d9a646cf3b1a Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Tue, 28 Oct 2014 11:28:46 +0900 Subject: [PATCH] Fix not to SEGV ibus-ui-gtk3 with wrong 'preload-engines' value. Fedora internal patch could save engines from the result of 'setxkbmap -query' but they do not exist in simple.xml likes 'xkb:cn::chi' while now the current implementation converts those engines to 'xkb:us::eng'. BUG=https://code.google.com/p/ibus/issues/detail?id=1744 TEST=ui/gtk3 Review URL: https://codereview.appspot.com/158640043 --- ui/gtk3/panel.vala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala index 76cea23..7b99fdf 100644 --- a/ui/gtk3/panel.vala +++ b/ui/gtk3/panel.vala @@ -790,6 +790,15 @@ class Panel : IBus.PanelService { var engines = m_bus.get_engines_by_names(names); + /* Fedora internal patch could save engines not in simple.xml + * likes 'xkb:cn::chi'. + */ + if (engines.length == 0) { + names = {"xkb:us::eng"}; + m_settings_general.set_strv("preload-engines", names); + engines = m_bus.get_engines_by_names(names); + } + if (m_engines.length == 0) { m_engines = engines; switch_engine(0, true); -- 1.8.5.3