From cb519c852dfc7a652df1768c81974d750ef48f58 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Thu, 29 Sep 2011 12:24:53 +0900 Subject: [PATCH] Fix hiding button items in GTK panel. BUG=none TEST=manual Review URL: http://codereview.appspot.com/5148041 --- ui/gtk/toolitem.py | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/ui/gtk/toolitem.py b/ui/gtk/toolitem.py index 4bdffba..4f4f97d 100644 --- a/ui/gtk/toolitem.py +++ b/ui/gtk/toolitem.py @@ -73,11 +73,9 @@ class ToolButton(gtk.ToolButton, PropItem): self.set_icon_name(self._prop.icon) if self._prop.visible: - self.set_no_show_all(False) - self.show_all() + self.show() else: - self.set_no_show_all(True) - self.hide_all() + self.hide() def do_clicked(self): self.emit("property-activate", self._prop.key, self._prop.state) @@ -128,11 +126,9 @@ class ToggleToolButton(gtk.ToggleToolButton, PropItem): self.set_active(self._prop.state == ibus.PROP_STATE_CHECKED) self.set_sensitive(self._prop.sensitive) if self._prop.visible: - self.set_no_show_all(False) - self.show_all() + self.show() else: - self.set_no_show_all(True) - self.hide_all() + self.hide() def do_toggled(self): # Do not send property-activate to engine in case the event is -- 1.7.6.4 From d19018b8709847009d2e0836c942dd9f1385e7cb Mon Sep 17 00:00:00 2001 From: Yusuke Sato Date: Sun, 9 Oct 2011 13:52:42 +0900 Subject: [PATCH] Always consume a hotkey press BUG=1324 Review URL: http://codereview.appspot.com/5242044 --- bus/ibusimpl.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c index 1942504..1494f5f 100644 --- a/bus/ibusimpl.c +++ b/bus/ibusimpl.c @@ -2066,21 +2066,21 @@ bus_ibus_impl_filter_keyboard_shortcuts (BusIBusImpl *ibus, else { bus_input_context_enable (context); } - return (enabled != bus_input_context_is_enabled (context)); + return TRUE; } if (event == enable_unconditional) { gboolean enabled = bus_input_context_is_enabled (context); if (!enabled) { bus_input_context_enable (context); } - return bus_input_context_is_enabled (context); + return TRUE; } if (event == disable_unconditional) { gboolean enabled = bus_input_context_is_enabled (context); if (enabled) { bus_input_context_disable (context); } - return !bus_input_context_is_enabled (context); + return TRUE; } if (event == next) { if (bus_input_context_is_enabled (context)) { -- 1.7.6.4 From ee966e327cc3b1b4bba40379bc0fbb3d46c38239 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Tue, 25 Oct 2011 10:37:22 +0900 Subject: [PATCH] Add ibusutil.h in ibus.h BUG=http://code.google.com/p/ibus/issues/detail?id=1338 TEST=Linux desktop Review URL: http://codereview.appspot.com/5294054 --- src/ibus.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/ibus.h b/src/ibus.h index 0765799..addc531 100644 --- a/src/ibus.h +++ b/src/ibus.h @@ -52,6 +52,7 @@ #include #include #include +#include #undef __IBUS_H_INSIDE__ -- 1.7.6.4 From 910f8a64098d89b04c50056f621ec1a49dd3e7ea Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Tue, 25 Oct 2011 10:50:34 +0900 Subject: [PATCH] Fix previous_engine without global engine. BUG=http://code.google.com/p/ibus/issues/detail?id=1331 TEST=Linux desktop Review URL: http://codereview.appspot.com/5297047 --- bus/ibusimpl.c | 31 +++++++++++++++++++------------ 1 files changed, 19 insertions(+), 12 deletions(-) diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c index 1494f5f..0a4f3fb 100644 --- a/bus/ibusimpl.c +++ b/bus/ibusimpl.c @@ -1044,13 +1044,14 @@ bus_ibus_impl_get_engine_desc (BusIBusImpl *ibus, } /** - * bus_ibus_impl_context_request_next_engine_in_menu: + * bus_ibus_impl_context_request_rotate_engine_in_menu: * - * Process the "next_engine_in_menu" hotkey. + * Process the "next_engine_in_menu" or "previous_engine" hotkey. */ static void -bus_ibus_impl_context_request_next_engine_in_menu (BusIBusImpl *ibus, - BusInputContext *context) +bus_ibus_impl_context_request_rotate_engine_in_menu (BusIBusImpl *ibus, + BusInputContext *context, + gboolean is_next) { BusEngineProxy *engine; IBusEngineDesc *desc; @@ -1071,12 +1072,20 @@ bus_ibus_impl_context_request_next_engine_in_menu (BusIBusImpl *ibus, p = g_list_find (ibus->register_engine_list, desc); if (p != NULL) { - p = p->next; + if (is_next) { + p = p->next; + } else if (p->prev) { + p = p->prev; + } } if (p == NULL) { p = g_list_find (ibus->engine_list, desc); if (p != NULL) { - p = p->next; + if (is_next) { + p = p->next; + } else if (p->prev) { + p = p->prev; + } } } @@ -1126,12 +1135,9 @@ bus_ibus_impl_context_request_previous_engine (BusIBusImpl *ibus, } } - /* - * If the previous engine name is not found, switch to the next engine - * in the menu. This behavior is better than doing nothing. - */ if (!engine_name) { - bus_ibus_impl_context_request_next_engine_in_menu (ibus, context); + bus_ibus_impl_context_request_rotate_engine_in_menu (ibus, context, + FALSE); return; } @@ -2084,7 +2090,8 @@ bus_ibus_impl_filter_keyboard_shortcuts (BusIBusImpl *ibus, } if (event == next) { if (bus_input_context_is_enabled (context)) { - bus_ibus_impl_context_request_next_engine_in_menu (ibus, context); + bus_ibus_impl_context_request_rotate_engine_in_menu (ibus, context, + TRUE); } else { bus_input_context_enable (context); -- 1.7.6.4 From cca4fd8993613a6993965c3120323e43c4647ef5 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Fri, 28 Oct 2011 15:42:08 +0900 Subject: [PATCH] Don't set focus on GTK password entry. For an old bug: https://bugzilla.redhat.com/show_bug.cgi?id=484643 Input method should be disabled on password entry for security reason. BUG=none TEST=manually with gtk-demo "Entry Buffer" example Review URL: http://codereview.appspot.com/5319053 --- client/gtk2/ibusimcontext.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c index 327a5d9..b6ca12e 100644 --- a/client/gtk2/ibusimcontext.c +++ b/client/gtk2/ibusimcontext.c @@ -734,6 +734,19 @@ ibus_im_context_focus_in (GtkIMContext *context) if (ibusimcontext->has_focus) return; + /* don't set focus on password entry */ + if (ibusimcontext->client_window != NULL) { + GtkWidget *widget; + + gdk_window_get_user_data (ibusimcontext->client_window, + (gpointer *)&widget); + + if (GTK_IS_ENTRY (widget) && + !gtk_entry_get_visibility (GTK_ENTRY (widget))) { + return; + } + } + if (_focus_im_context != NULL) { g_assert (_focus_im_context != context); gtk_im_context_focus_out (_focus_im_context); -- 1.7.6.4 From 05f9556278f791bacc0f1019427f8575fa39c9db Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Wed, 2 Nov 2011 10:47:55 +0900 Subject: [PATCH] Rerotate next/previous engines without global engine. --- bus/ibusimpl.c | 31 ++++++++++++++++++++++++++++--- 1 files changed, 28 insertions(+), 3 deletions(-) diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c index 0a4f3fb..059d660 100644 --- a/bus/ibusimpl.c +++ b/bus/ibusimpl.c @@ -1056,7 +1056,7 @@ bus_ibus_impl_context_request_rotate_engine_in_menu (BusIBusImpl *ibus, BusEngineProxy *engine; IBusEngineDesc *desc; IBusEngineDesc *next_desc = NULL; - GList *p; + GList *p = NULL; engine = bus_input_context_get_engine (context); if (engine == NULL) { @@ -1074,21 +1074,46 @@ bus_ibus_impl_context_request_rotate_engine_in_menu (BusIBusImpl *ibus, if (p != NULL) { if (is_next) { p = p->next; - } else if (p->prev) { + } else { p = p->prev; } } + + /* Rotate register_engine_list and engine_list. */ + if (p == NULL && g_list_find (ibus->register_engine_list, desc) != NULL) { + if (is_next) { + p = ibus->engine_list; + } else { + p = g_list_last (ibus->engine_list); + } + } + if (p == NULL) { p = g_list_find (ibus->engine_list, desc); if (p != NULL) { if (is_next) { p = p->next; - } else if (p->prev) { + } else { p = p->prev; } } } + /* Rerotate register_engine_list and engine_list. */ + if (p == NULL && g_list_find (ibus->engine_list, desc) != NULL) { + if (is_next) { + p = ibus->register_engine_list; + if (p == NULL) { + p = ibus->engine_list; + } + } else { + p = g_list_last (ibus->register_engine_list); + if (p == NULL) { + p = g_list_last (ibus->engine_list); + } + } + } + if (p != NULL) { next_desc = (IBusEngineDesc*) p->data; } -- 1.7.6.4 From a8c21dd867f4a9e1c37cae4f6509af1491c5fc96 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Thu, 17 Nov 2011 15:10:05 +0900 Subject: [PATCH] Use ibus_input_context_process_key_event_async in ibus-x11 --- client/x11/main.c | 115 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 96 insertions(+), 19 deletions(-) diff --git a/client/x11/main.c b/client/x11/main.c index 0ba826c..8611bfc 100644 --- a/client/x11/main.c +++ b/client/x11/main.c @@ -116,6 +116,8 @@ static gint g_debug_level = 0; static IBusBus *_bus = NULL; +static gboolean _use_sync_mode = FALSE; + static void _xim_preedit_start (XIMS xims, const X11IC *x11ic) { @@ -443,6 +445,31 @@ xim_unset_ic_focus (XIMS xims, IMChangeFocusStruct *call_data) } +static void +_process_key_event_done (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + IBusInputContext *context = (IBusInputContext *)object; + IMForwardEventStruct *pfe = (IMForwardEventStruct*) user_data; + + GError *error = NULL; + gboolean retval = ibus_input_context_process_key_event_async_finish ( + context, + res, + &error); + + if (error != NULL) { + g_warning ("Process Key Event failed: %s.", error->message); + g_error_free (error); + } + + if (retval == FALSE) { + IMForwardEvent (_xims, (XPointer) pfe); + } + g_free (pfe); +} + static int xim_forward_event (XIMS xims, IMForwardEventStruct *call_data) { @@ -469,32 +496,61 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data) if (event.type == GDK_KEY_RELEASE) { event.state |= IBUS_RELEASE_MASK; } - retval = ibus_input_context_process_key_event (x11ic->context, - event.keyval, - event.hardware_keycode - 8, - event.state); - if (retval) { - if (! x11ic->has_preedit_area) { - _xim_set_cursor_location (x11ic); + + if (_use_sync_mode) { + retval = ibus_input_context_process_key_event ( + x11ic->context, + event.keyval, + event.hardware_keycode - 8, + event.state); + if (retval) { + if (! x11ic->has_preedit_area) { + _xim_set_cursor_location (x11ic); + } + return 1; } - return 1; - } - IMForwardEventStruct fe; - memset (&fe, 0, sizeof (fe)); + IMForwardEventStruct fe; + memset (&fe, 0, sizeof (fe)); - fe.major_code = XIM_FORWARD_EVENT; - fe.icid = x11ic->icid; - fe.connect_id = x11ic->connect_id; - fe.sync_bit = 0; - fe.serial_number = 0L; - fe.event = call_data->event; + fe.major_code = XIM_FORWARD_EVENT; + fe.icid = x11ic->icid; + fe.connect_id = x11ic->connect_id; + fe.sync_bit = 0; + fe.serial_number = 0L; + fe.event = call_data->event; - IMForwardEvent (_xims, (XPointer) &fe); + IMForwardEvent (_xims, (XPointer) &fe); - return 1; + retval = 1; + } + else { + IMForwardEventStruct *pfe; + + pfe = g_new0 (IMForwardEventStruct, 1); + pfe->major_code = XIM_FORWARD_EVENT; + pfe->icid = x11ic->icid; + pfe->connect_id = x11ic->connect_id; + pfe->sync_bit = 0; + pfe->serial_number = 0L; + memcpy (&pfe->event, xevent, sizeof (XKeyEvent)); + + ibus_input_context_process_key_event_async ( + x11ic->context, + event.keyval, + event.hardware_keycode - 8, + event.state, + -1, + NULL, + _process_key_event_done, + pfe); + retval = 1; + } + return retval; } +#undef _XIM_COPY_XKEYEVENT + static int xim_open (XIMS xims, IMOpenStruct *call_data) @@ -897,6 +953,25 @@ _context_disabled_cb (IBusInputContext *context, _xim_preedit_end (_xims, x11ic); } +static gboolean +_get_boolean_env(const gchar *name, + gboolean defval) +{ + const gchar *value = g_getenv (name); + + if (value == NULL) + return defval; + + if (g_strcmp0 (value, "") == 0 || + g_strcmp0 (value, "0") == 0 || + g_strcmp0 (value, "false") == 0 || + g_strcmp0 (value, "False") == 0 || + g_strcmp0 (value, "FALSE") == 0) + return FALSE; + + return TRUE; +} + static void _init_ibus (void) { @@ -909,6 +984,8 @@ _init_ibus (void) g_signal_connect (_bus, "disconnected", G_CALLBACK (_bus_disconnected_cb), NULL); + + _use_sync_mode = _get_boolean_env ("IBUS_ENABLE_SYNC_MODE", FALSE); } static void -- 1.7.6.4