ishcherb / rpms / ibus

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