From ecac051715f1bd592f47db0560256e099720b6ae Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Tue, 15 Jan 2013 19:02:41 +0900 Subject: [PATCH] Bumped to 1.5.1 --- .gitignore | 3 +- ibus-530711-preload-sys.patch | 40 +- ibus-541492-xkb.patch | 2049 ++--------------------------- ibus-HEAD.patch | 706 +++++----- ibus-xx-f17.patch | 91 ++ ibus-xx-g-s-disable-preedit.patch | 13 +- ibus-xx-no-use.diff | 484 ------- ibus-xx-setup-frequent-lang.patch | 28 +- ibus.spec | 47 +- sources | 5 +- 10 files changed, 669 insertions(+), 2797 deletions(-) create mode 100644 ibus-xx-f17.patch delete mode 100644 ibus-xx-no-use.diff diff --git a/.gitignore b/.gitignore index 91e9fed..297b080 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ ibus-1.3.6.tar.gz /ibus-1.3.9.tar.gz /ibus-1.4.0.tar.gz /ibus-1.4.1.tar.gz +/ibus-1.5.1.tar.gz /ibus-1.3.99.20101028.tar.gz /ibus-1.3.99.20101118.tar.gz /ibus-1.3.99.20101202.tar.gz @@ -49,4 +50,4 @@ ibus-1.3.6.tar.gz /ibus-gjs-3.4.1.20120428.tar.gz /ibus-gjs-3.4.1.20120518.tar.gz /ibus-gjs-3.4.1.20120815.tar.gz -/ibus-po-1.4.99.20121207.tar.gz +/ibus-gjs-3.4.1.20130115.tar.gz diff --git a/ibus-530711-preload-sys.patch b/ibus-530711-preload-sys.patch index 0870cc1..54b0eec 100644 --- a/ibus-530711-preload-sys.patch +++ b/ibus-530711-preload-sys.patch @@ -1,6 +1,6 @@ -From dfe858f7ba476aa878c5d60a7480a03def558463 Mon Sep 17 00:00:00 2001 +From f209d4c3430df3707c432ddfcfc184b791bb50fd Mon Sep 17 00:00:00 2001 From: fujiwarat -Date: Tue, 27 Nov 2012 15:53:27 +0900 +Date: Fri, 11 Jan 2013 23:03:19 +0900 Subject: [PATCH] Reload preload engines until users customize the list. The idea is, if users don't customize the preload_engines with ibus-setup, @@ -25,7 +25,7 @@ IBUS_PRELOAD_ENGINE_MODE_USER and users can customize the value 5 files changed, 246 insertions(+), 7 deletions(-) diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in -index 1a0e2d2..64f6f33 100644 +index 70bf9ca..7833959 100644 --- a/data/ibus.schemas.in +++ b/data/ibus.schemas.in @@ -2,6 +2,30 @@ @@ -60,10 +60,10 @@ index 1a0e2d2..64f6f33 100644 /desktop/ibus/general/preload_engines ibus diff --git a/setup/main.py b/setup/main.py -index c02229b..5da6340 100644 +index 707faa4..aae6bb9 100644 --- a/setup/main.py +++ b/setup/main.py -@@ -196,6 +196,20 @@ class Setup(object): +@@ -190,6 +190,20 @@ class Setup(object): self.__checkbutton_use_global_engine.connect("toggled", self.__checkbutton_use_global_engine_toggled_cb) @@ -83,8 +83,8 @@ index c02229b..5da6340 100644 + # init engine page self.__engines = self.__bus.list_engines() - value = self.__config.get_value("general", "load_xkb_layouts") -@@ -257,6 +271,7 @@ class Setup(object): + self.__combobox = self.__builder.get_object("combobox_engines") +@@ -243,6 +257,7 @@ class Setup(object): self.__checkbutton_auto_start_toggled_cb) self.__config = self.__bus.get_config() @@ -92,7 +92,7 @@ index c02229b..5da6340 100644 self.__init_hotkey() self.__init_panel() -@@ -271,8 +286,8 @@ class Setup(object): +@@ -251,8 +266,8 @@ class Setup(object): def __combobox_notify_active_engine_cb(self, combobox, property): engine = self.__combobox.get_active_engine() button = self.__builder.get_object("button_engine_add") @@ -103,7 +103,7 @@ index c02229b..5da6340 100644 def __get_engine_setup_exec_args(self, engine): args = [] -@@ -351,6 +366,34 @@ class Setup(object): +@@ -324,6 +339,34 @@ class Setup(object): del self.__engine_setup_exec_list[name] self.__engine_setup_exec_list[name] = os.spawnl(os.P_NOWAIT, *args) @@ -138,7 +138,7 @@ index c02229b..5da6340 100644 def __init_bus(self): self.__bus = IBus.Bus() if self.__bus.is_connected(): -@@ -562,8 +605,18 @@ class Setup(object): +@@ -538,8 +581,18 @@ class Setup(object): value = GLib.Variant.new_boolean(value) self.__config.set_value("general", "use_global_engine", value) @@ -148,7 +148,7 @@ index c02229b..5da6340 100644 + if section == 'general' and name == 'preload_engines': + value = [] + if variant != None: -+ value = self.__variant_dup_strv(variant) ++ value = variant.unpack() + engines = self.__get_engine_descs_from_names(value) + current_engines = self.__treeview.get_engines() + engines_csv = str.join(',', map(lambda e: e.get_name(), engines)) @@ -160,10 +160,10 @@ index c02229b..5da6340 100644 def __config_reloaded_cb(self, bus): pass diff --git a/setup/setup.ui b/setup/setup.ui -index 8121d62..2026172 100644 +index e56e917..b3165aa 100644 --- a/setup/setup.ui +++ b/setup/setup.ui -@@ -653,7 +653,23 @@ +@@ -669,7 +669,23 @@ True False @@ -188,7 +188,7 @@ index 8121d62..2026172 100644 True False -@@ -842,7 +858,7 @@ +@@ -858,7 +874,7 @@ True True @@ -197,7 +197,7 @@ index 8121d62..2026172 100644 -@@ -889,7 +905,7 @@ You may use up/down buttons to change it.</i></small> +@@ -905,7 +921,7 @@ You may use up/down buttons to change it.</i></small> False True @@ -228,10 +228,10 @@ index 737b3e2..8ce5a16 100644 * @x: x coordinate. * @y: y coordinate. diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala -index 63b0cde..c4c8f2c 100644 +index 55b63ce..4717431 100644 --- a/ui/gtk3/panel.vala +++ b/ui/gtk3/panel.vala -@@ -313,6 +313,8 @@ class Panel : IBus.PanelService { +@@ -291,6 +291,8 @@ class Panel : IBus.PanelService { if (m_config != null) { m_config.value_changed.connect(config_value_changed_cb); m_config.watch("general", "preload_engines"); @@ -239,8 +239,8 @@ index 63b0cde..c4c8f2c 100644 + m_config.watch("general", "preload_engine_mode"); m_config.watch("general", "engines_order"); m_config.watch("general", "switcher_delay_time"); - m_config.watch("general/hotkey", "trigger_accel"); -@@ -425,7 +427,136 @@ class Panel : IBus.PanelService { + m_config.watch("general/hotkey", "triggers"); +@@ -358,7 +360,136 @@ class Panel : IBus.PanelService { init_gkbd(); } @@ -377,7 +377,7 @@ index 63b0cde..c4c8f2c 100644 } private void update_xkb_engines() { -@@ -591,6 +722,11 @@ class Panel : IBus.PanelService { +@@ -573,6 +704,11 @@ class Panel : IBus.PanelService { string section, string name, Variant variant) { diff --git a/ibus-541492-xkb.patch b/ibus-541492-xkb.patch index e72ec44..52e90d0 100644 --- a/ibus-541492-xkb.patch +++ b/ibus-541492-xkb.patch @@ -1,40 +1,28 @@ -From 965f09a94744b6374656247ff091eb91b5bad0b2 Mon Sep 17 00:00:00 2001 +From 6772bc0fc82074cd00d56c0e9795d163b489281e Mon Sep 17 00:00:00 2001 From: fujiwarat -Date: Mon, 10 Dec 2012 16:24:34 +0900 +Date: Fri, 11 Jan 2013 22:55:17 +0900 Subject: [PATCH] Add ibus-xkb and libgnomekbd. --- bindings/vala/Gkbd-3.0.metadata | 1 + - bindings/vala/Makefile.am | 23 ++ + bindings/vala/Makefile.am | 15 ++ bindings/vala/Xkl-1.0.metadata | 3 + - configure.ac | 68 +++++ - data/ibus.schemas.in | 94 +++++++ - engine/Makefile.am | 6 + - engine/ibus-xkb/Makefile.am | 61 ++++ - engine/ibus-xkb/ibus-xkb-main.c | 173 ++++++++++++ - engine/ibus-xkb/xkblib.c | 327 ++++++++++++++++++++++ - engine/ibus-xkb/xkblib.h | 41 +++ - engine/main.vala | 86 ++++++ - engine/simple.xml.in.in | 605 +--------------------------------------- - ibus-1.0.pc.in | 4 + - ibus.spec.in | 12 + - setup/main.py | 38 ++- - src/Makefile.am | 5 + + configure.ac | 40 ++++ + data/ibus.schemas.in | 59 +++++ + ibus-1.0.pc.in | 1 + + ibus.spec.in | 12 ++ + src/Makefile.am | 3 + src/ibus.h | 1 + - src/ibusxkbxml.c | 466 +++++++++++++++++++++++++++++++ - src/ibusxkbxml.h | 187 +++++++++++++ - ui/gtk3/Makefile.am | 37 +++ - ui/gtk3/gkbdlayout.vala.false | 63 +++++ - ui/gtk3/gkbdlayout.vala.true | 108 +++++++ - ui/gtk3/panel.vala | 362 ++++++++++++++++++++++-- - ui/gtk3/xkblayout.vala | 465 ++++++++++++++++++++++++++++++ - 24 files changed, 2597 insertions(+), 639 deletions(-) + src/ibusxkbxml.c | 466 ++++++++++++++++++++++++++++++++++++++++ + src/ibusxkbxml.h | 187 ++++++++++++++++ + ui/gtk3/Makefile.am | 36 ++++ + ui/gtk3/gkbdlayout.vala.false | 63 ++++++ + ui/gtk3/gkbdlayout.vala.true | 108 ++++++++++ + ui/gtk3/panel.vala | 216 ++++++++++++++++++- + ui/gtk3/xkblayout.vala | 431 +++++++++++++++++++++++++++++++++++++ + 16 files changed, 1641 insertions(+), 1 deletion(-) create mode 100644 bindings/vala/Gkbd-3.0.metadata create mode 100644 bindings/vala/Xkl-1.0.metadata - create mode 100644 engine/ibus-xkb/Makefile.am - create mode 100644 engine/ibus-xkb/ibus-xkb-main.c - create mode 100644 engine/ibus-xkb/xkblib.c - create mode 100644 engine/ibus-xkb/xkblib.h create mode 100644 src/ibusxkbxml.c create mode 100644 src/ibusxkbxml.h create mode 100644 ui/gtk3/gkbdlayout.vala.false @@ -49,37 +37,16 @@ index 0000000..661e6fd @@ -0,0 +1 @@ +Configuration cheader_filename="libgnomekbd/gkbd-configuration.h" diff --git a/bindings/vala/Makefile.am b/bindings/vala/Makefile.am -index abcc543..307a161 100644 +index aba3454..bf3074a 100644 --- a/bindings/vala/Makefile.am +++ b/bindings/vala/Makefile.am -@@ -27,12 +27,22 @@ dist_vapi_DATA = \ +@@ -28,6 +28,17 @@ vapi_deps = \ + $(top_builddir)/src/IBus-1.0.gir \ $(NULL) - # Don't rebuild vapi every time gir is updated. -+if ENABLE_LIBGNOMEKBD - vapi_deps = \ - $(srcdir)/IBus-1.0.metadata \ - $(srcdir)/IBus-1.0-custom.vala \ - | \ -+ $(builddir)/gkbd.vapi \ - $(top_srcdir)/src/IBus-@IBUS_API_VERSION@.gir \ - $(NULL) -+else -+vapi_deps = \ -+ $(srcdir)/IBus-1.0.metadata \ -+ $(srcdir)/IBus-1.0-custom.vala \ -+ | \ -+ $(top_srcdir)/src/IBus-@IBUS_API_VERSION@.gir \ -+ $(NULL) -+endif - - ibus-@IBUS_API_VERSION@.vapi: $(vapi_deps) - $(AM_V_GEN) $(VAPIGEN) --library ibus-@IBUS_API_VERSION@ \ -@@ -41,13 +51,26 @@ ibus-@IBUS_API_VERSION@.vapi: $(vapi_deps) - $(top_srcdir)/src/IBus-@IBUS_API_VERSION@.gir \ - $(srcdir)/IBus-1.0-custom.vala - +if ENABLE_LIBGNOMEKBD ++vapi_deps += $(builddir)/gkbd.vapi ++ +$(builddir)/gkbd.vapi: + $(AM_V_GEN) $(VAPIGEN) --library gkbd \ + --metadatadir $(srcdir) \ @@ -88,10 +55,17 @@ index abcc543..307a161 100644 + $(NULL) +endif + + ibus-1.0.vapi: $(vapi_deps) + + VAPIGEN_VAPIS = ibus-1.0.vapi +@@ -43,11 +54,15 @@ vapidir = $(datadir)/vala/vapi + vapi_DATA = $(VAPIGEN_VAPIS) $(VAPIGEN_VAPIS:.vapi=.deps) + EXTRA_DIST = \ + Gkbd-3.0.metadata \ IBus-1.0.metadata \ IBus-1.0-custom.vala \ + ibus-1.0.deps \ config.vapi \ xi.vapi \ + Xkl-1.0.metadata \ @@ -99,8 +73,6 @@ index abcc543..307a161 100644 +CLEANFILES = gkbd.vapi + - MAINTAINERCLEANFILES = ibus-@IBUS_API_VERSION@.vapi - -include $(top_srcdir)/git.mk diff --git a/bindings/vala/Xkl-1.0.metadata b/bindings/vala/Xkl-1.0.metadata new file mode 100644 @@ -112,44 +84,18 @@ index 0000000..4961d0c +Engine + .filter_events.evt ref type="X.Event" diff --git a/configure.ac b/configure.ac -index cc7d0e0..246b3fc 100644 +index b328073..61d1464 100644 --- a/configure.ac +++ b/configure.ac -@@ -252,6 +252,71 @@ else +@@ -237,6 +237,45 @@ else enable_xim="no (disabled, use --enable-xim to enable)" fi +# Option for XKB command. -+AC_ARG_WITH(xkb-command, -+ AS_HELP_STRING([--with-xkb-command[=XKB_COMMAND]], -+ [Use XKB_COMMAND to set keymap. ibus-xkb is available. (default is setxkbmap)]), -+ XKB_COMMAND=$with_xkb_command, -+ XKB_COMMAND=setxkbmap ++PKG_CHECK_MODULES(XKB, ++ [xkbfile],, ++ [XKB_LIBS="-lxkbfile"] +) -+AC_DEFINE_UNQUOTED(XKB_COMMAND, "$XKB_COMMAND", -+ [xkb command line to set xkb keymaps.]) -+ -+if test x"$XKB_COMMAND" = x"ibus-xkb"; then -+ enable_ibus_xkb=yes -+else -+ enable_ibus_xkb=no -+fi -+ -+AM_CONDITIONAL([ENABLE_IBUS_XKB], [test x"$enable_ibus_xkb" = x"yes"]) -+if test x"$enable_ibus_xkb" = x"yes"; then -+ PKG_CHECK_MODULES(X11, [ -+ x11 -+ ]) -+ PKG_CHECK_MODULES(XKB, -+ [xkbfile],, -+ [XKB_LIBS="-lxkbfile"] -+ ) -+ AC_DEFINE(HAVE_IBUS_XKB, 1, [define to 1 if you have xkbfile]) -+ HAVE_IBUS_XKB=true -+else -+ HAVE_IBUS_XKB=false -+fi -+AC_SUBST(HAVE_IBUS_XKB) + +# --enable-libgnomekbd option. +AC_ARG_ENABLE(libgnomekbd, @@ -187,25 +133,16 @@ index cc7d0e0..246b3fc 100644 # GObject introspection GOBJECT_INTROSPECTION_CHECK([0.6.8]) -@@ -517,6 +582,7 @@ src/ibusversion.h - src/tests/Makefile - bus/Makefile - engine/Makefile -+engine/ibus-xkb/Makefile - engine/simple.xml.in - util/Makefile - util/IMdkit/Makefile -@@ -576,6 +642,8 @@ Build options: +@@ -579,6 +618,7 @@ Build options: No snooper regexes "$NO_SNOOPER_APPS" Panel icon "$IBUS_ICON_KEYBOARD" Enable surrounding-text $enable_surrounding_text -+ XKB command $XKB_COMMAND + Build libgnomebkd $enable_libgnomekbd Run test cases $enable_tests ]) diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in -index a8c7d7f..1a0e2d2 100644 +index dbb6da8..70bf9ca 100644 --- a/data/ibus.schemas.in +++ b/data/ibus.schemas.in @@ -42,6 +42,52 @@ @@ -261,1436 +198,34 @@ index a8c7d7f..1a0e2d2 100644 /schemas/desktop/ibus/general/hotkey/trigger /desktop/ibus/general/hotkey/trigger ibus -@@ -50,6 +96,54 @@ - [Control+space,Zenkaku_Hankaku,Alt+Kanji,Alt+grave,Hangul,Alt+Release+Alt_R] - - Trigger shortcut keys -+ The shortcut keys for turning input method on or off -+ -+ -+ -+ /schemas/desktop/ibus/general/hotkey/trigger_accel -+ /desktop/ibus/general/hotkey/trigger_accel -+ ibus -+ list -+ string -+ [<Control>space] -+ -+ Trigger shortcut keys for gtk_accelerator_parse -+ The shortcut keys for turning input method on or off -+ -+ -+ -+ /schemas/desktop/ibus/general/hotkey/trigger_accel_backward -+ /desktop/ibus/general/hotkey/trigger_accel_backward -+ ibus -+ list -+ string -+ [<Control><Shift>space] -+ -+ Trigger reverse shortcut keys for gtk_accelerator_parse -+ The reverse shortcut keys for turning input method on or off -+ -+ -+ -+ /schemas/desktop/ibus/general/hotkey/trigger_ja -+ /desktop/ibus/general/hotkey/trigger_ja -+ ibus -+ list -+ string -+ [Zenkaku_Hankaku] -+ -+ Trigger shortcut keys for ja gtk_accelerator_parse -+ The shortcut keys for turning input method on or off -+ -+ -+ -+ /schemas/desktop/ibus/general/hotkey/trigger_ko -+ /desktop/ibus/general/hotkey/trigger_ko -+ ibus -+ list -+ string -+ [Hangul, Alt_R] -+ -+ Trigger shortcut keys for ko gtk_accelerator_parse - The shortcut keys for turning input method on or off +@@ -66,6 +112,19 @@ -diff --git a/engine/Makefile.am b/engine/Makefile.am -index b3b46be..90c6fde 100644 ---- a/engine/Makefile.am -+++ b/engine/Makefile.am -@@ -22,6 +22,12 @@ - - libibus = $(top_builddir)/src/libibus-@IBUS_API_VERSION@.la - -+SUBDIRS = -+ -+if ENABLE_IBUS_XKB -+SUBDIRS += ibus-xkb -+endif -+ - INCLUDES = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src \ -diff --git a/engine/ibus-xkb/Makefile.am b/engine/ibus-xkb/Makefile.am -new file mode 100644 -index 0000000..4a32e87 ---- /dev/null -+++ b/engine/ibus-xkb/Makefile.am -@@ -0,0 +1,61 @@ -+# vim:set noet ts=4: -+# -+# ibus - The Input Bus -+# -+# Copyright (c) 2012 Takao Fujiwara -+# Copyright (c) 2012 Red Hat, Inc. -+# -+# This library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License as published by the Free Software Foundation; either -+# version 2 of the License, or (at your option) any later version. -+# -+# This library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with this program; if not, write to the -+# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -+# Boston, MA 02111-1307 USA -+ -+libibus = $(top_builddir)/src/libibus-@IBUS_API_VERSION@.la -+ -+INCLUDES = \ -+ -I$(top_srcdir)/src \ -+ -I$(top_builddir)/src \ -+ $(NULL) -+ -+AM_CFLAGS = \ -+ $(INCLUDES) \ -+ -DG_LOG_DOMAIN=\"IBUS\" \ -+ -DIBUS_DISABLE_DEPRECATED \ -+ -Wno-unused-variable \ -+ -Wno-unused-but-set-variable \ -+ -Wno-unused-function \ -+ $(NULL) -+ -+libexec_PROGRAMS = ibus-xkb -+ -+ibus_xkb_SOURCES = \ -+ ibus-xkb-main.c \ -+ xkblib.h \ -+ xkblib.c \ -+ $(NULL) -+ibus_xkb_CFLAGS = \ -+ @XKB_CFLAGS@ \ -+ @X11_CFLAGS@ \ -+ @GLIB2_CFLAGS@ \ -+ $(NULL) -+ibus_xkb_LDADD = \ -+ @XKB_LIBS@ \ -+ @X11_LIBS@ \ -+ @GLIB2_LIBS@ \ -+ $(libibus) \ -+ $(NULL) -+ -+$(libibus): -+ $(MAKE) -C $(top_builddir)/src -+ -+-include $(top_srcdir)/git.mk -diff --git a/engine/ibus-xkb/ibus-xkb-main.c b/engine/ibus-xkb/ibus-xkb-main.c -new file mode 100644 -index 0000000..3dfd987 ---- /dev/null -+++ b/engine/ibus-xkb/ibus-xkb-main.c -@@ -0,0 +1,173 @@ -+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ -+/* vim:set et sts=4: */ -+/* bus - The Input Bus -+ * Copyright (C) 2012 Takao Fujiwara -+ * Copyright (C) 2012 Peng Huang -+ * Copyright (C) 2012 Red Hat, Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the -+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -+ * Boston, MA 02111-1307, USA. -+ */ -+#ifdef HAVE_CONFIG_H -+#include -+#endif -+ -+#include -+#include -+#include -+#include -+ -+#ifdef ENABLE_NLS -+#include -+#endif -+ -+#include "xkblib.h" -+ -+static gboolean query = FALSE; -+static gboolean get_group = FALSE; -+static gchar *layout = NULL; -+static gchar *variant = NULL; -+static gchar *option = NULL; -+static int group = 0; -+ -+static const GOptionEntry entries[] = -+{ -+ { "get", 'g', 0, G_OPTION_ARG_NONE, &query, N_("Query the current xkb layout"), NULL }, -+ { "layout", 'l', 0, G_OPTION_ARG_STRING, &layout, N_("Set xkb LAYOUT"), N_("LAYOUT") }, -+ { "variant", 'v', 0, G_OPTION_ARG_STRING, &variant, N_("Set xkb VARIANT"), N_("VARIANT") }, -+ { "option", 'o', 0, G_OPTION_ARG_STRING, &option, N_("Set xkb OPTION"), N_("OPTION") }, -+ { "get-group", 'G', 0, G_OPTION_ARG_NONE, &get_group, N_("Get current xkb state"), NULL }, -+ { NULL }, -+}; -+ -+ -+gboolean -+parse_setxkbmap_args (int *pargc, char ***pargv) -+{ -+ int argc = *pargc; -+ char **argv = *pargv; -+ char **new_argv = NULL; -+ int n = 1; -+ int i; -+ gboolean retval = FALSE; -+ -+ for (i = 0; i < argc; i++) { -+ if (g_strcmp0 (argv[i], "-layout") == 0 && i + 1 < argc) { -+ g_free (layout); -+ layout = g_strdup (argv[i + 1]); -+ i++; -+ retval = TRUE; -+ continue; -+ } -+ if (g_strcmp0 (argv[i], "-variant") == 0 && i + 1 < argc) { -+ g_free (variant); -+ variant = g_strdup (argv[i + 1]); -+ i++; -+ retval = TRUE; -+ continue; -+ } -+ if (g_strcmp0 (argv[i], "-option") == 0 && i + 1 < argc) { -+ g_free (option); -+ option = g_strdup (argv[i + 1]); -+ i++; -+ retval = TRUE; -+ continue; -+ } -+ if (g_strcmp0 (argv[i], "-query") == 0) { -+ query = TRUE; -+ retval = TRUE; -+ continue; -+ } -+ -+ new_argv = g_renew(char*, new_argv, n); -+ new_argv[n - 1] = g_strdup (argv[i]); -+ n++; -+ } -+ -+ *pargc = n - 1; -+ *pargv = new_argv; -+ -+ return retval; -+} -+ -+int -+main (int argc, char *argv[]) -+{ -+ gboolean parsed; -+ GOptionContext *context; -+ GError *error = NULL; -+ Display *xdisplay; -+ -+#ifdef ENABLE_NLS -+ setlocale (LC_ALL, ""); -+ -+ bindtextdomain (GETTEXT_PACKAGE, GLIB_LOCALE_DIR); -+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); -+#endif -+ -+ parsed = parse_setxkbmap_args (&argc, &argv); -+ -+ context = g_option_context_new ("- ibus daemon"); -+ -+ g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); -+ g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); -+ -+ if (!parsed && !g_option_context_parse (context, &argc, &argv, &error)) { -+ g_printerr ("Option parsing failed: %s\n", error->message); -+ return -1; -+ } -+ -+ xdisplay = XOpenDisplay (NULL); -+ if (xdisplay == NULL) { -+ g_warning ("Could not open display"); -+ return -1; -+ } -+ ibus_xkb_init (xdisplay); -+ -+ if (layout) { -+ if (option == NULL) { -+ option = ibus_xkb_get_current_option (); -+ } -+ -+ ibus_xkb_set_layout (layout, variant, option); -+ } -+ -+ if (query) { -+ g_free (layout); -+ g_free (variant); -+ g_free (option); -+ -+ layout = ibus_xkb_get_current_layout (); -+ variant = ibus_xkb_get_current_variant (); -+ option = ibus_xkb_get_current_option (); -+ g_printf ("layout: %s\n" -+ "variant: %s\n" -+ "option: %s\n", -+ layout ? layout : "", -+ variant ? variant : "", -+ option ? option : ""); -+ g_free (layout); -+ g_free (variant); -+ g_free (option); -+ } -+ if (get_group) { -+ group = ibus_xkb_get_current_group (); -+ g_printf ("group: %d\n", group); -+ } -+ -+ ibus_xkb_finit (); -+ -+ return 0; -+} -diff --git a/engine/ibus-xkb/xkblib.c b/engine/ibus-xkb/xkblib.c -new file mode 100644 -index 0000000..bb25455 ---- /dev/null -+++ b/engine/ibus-xkb/xkblib.c -@@ -0,0 +1,327 @@ -+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ -+/* vim:set et sts=4: */ -+/* bus - The Input Bus -+ * Copyright (C) 2012 Takao Fujiwara -+ * Copyright (C) 2012 Peng Huang -+ * Copyright (C) 2012 Red Hat, Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the -+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -+ * Boston, MA 02111-1307, USA. -+ */ -+#ifdef HAVE_CONFIG_H -+#include -+#endif -+ -+#include -+#include -+#include -+#include -+#include /* for XKBrules.h */ -+#include -+#include -+#include -+ -+#include "xkblib.h" -+ -+#ifndef XKB_RULES_XML_FILE -+#define XKB_RULES_XML_FILE "/usr/share/X11/xkb/rules/evdev.xml" -+#endif -+ -+static gchar **default_layouts; -+static gchar **default_variants; -+static gchar **default_options; -+static int default_layout_group; -+ -+static Display * -+get_xdisplay (Display *xdisplay) -+{ -+ static Display *saved_xdisplay = NULL; -+ if (xdisplay != NULL) { -+ saved_xdisplay = xdisplay; -+ } -+ return saved_xdisplay; -+} -+ -+static void -+init_xkb_default_layouts (Display *xdisplay) -+{ -+ XkbStateRec state; -+ Atom xkb_rules_name, type; -+ int format; -+ unsigned long l, nitems, bytes_after; -+ unsigned char *prop = NULL; -+ -+ xkb_rules_name = XInternAtom (xdisplay, "_XKB_RULES_NAMES", TRUE); -+ if (xkb_rules_name == None) { -+ g_warning ("Could not get XKB rules atom"); -+ return; -+ } -+ if (XGetWindowProperty (xdisplay, -+ XDefaultRootWindow (xdisplay), -+ xkb_rules_name, -+ 0, 1024, FALSE, XA_STRING, -+ &type, &format, &nitems, &bytes_after, &prop) != Success) { -+ g_warning ("Could not get X property"); -+ return; -+ } -+ if (nitems < 3) { -+ g_warning ("Could not get group layout from X property"); -+ return; -+ } -+ for (l = 0; l < 2; l++) { -+ prop += strlen ((const char *) prop) + 1; -+ } -+ if (prop == NULL || *prop == '\0') { -+ g_warning ("No layouts form X property"); -+ return; -+ } -+ default_layouts = g_strsplit ((gchar *) prop, ",", -1); -+ prop += strlen ((const char *) prop) + 1; -+ default_variants = g_strsplit ((gchar *) prop, ",", -1); -+ prop += strlen ((const char *) prop) + 1; -+ default_options = g_strsplit ((gchar *) prop, ",", -1); -+ -+ if (XkbGetState (xdisplay, XkbUseCoreKbd, &state) != Success) { -+ g_warning ("Could not get state"); -+ return; -+ } -+ default_layout_group = state.group; -+} -+ -+static Bool -+set_xkb_rules (Display *xdisplay, -+ const char *rules_file, const char *model, -+ const char *all_layouts, const char *all_variants, -+ const char *all_options) -+{ -+ gchar *rules_path; -+ XkbRF_RulesPtr rules; -+ XkbRF_VarDefsRec rdefs; -+ XkbComponentNamesRec rnames; -+ XkbDescPtr xkb; -+ -+ rules_path = g_strdup ("./rules/evdev"); -+ rules = XkbRF_Load (rules_path, "C", TRUE, TRUE); -+ if (rules == NULL) { -+ g_return_val_if_fail (XKB_RULES_XML_FILE != NULL, FALSE); -+ -+ g_free (rules_path); -+ if (g_str_has_suffix (XKB_RULES_XML_FILE, ".xml")) { -+ rules_path = g_strndup (XKB_RULES_XML_FILE, -+ strlen (XKB_RULES_XML_FILE) - 4); -+ } else { -+ rules_path = g_strdup (XKB_RULES_XML_FILE); -+ } -+ rules = XkbRF_Load (rules_path, "C", TRUE, TRUE); -+ } -+ g_return_val_if_fail (rules != NULL, FALSE); -+ -+ memset (&rdefs, 0, sizeof (XkbRF_VarDefsRec)); -+ memset (&rnames, 0, sizeof (XkbComponentNamesRec)); -+ rdefs.model = model ? g_strdup (model) : NULL; -+ rdefs.layout = all_layouts ? g_strdup (all_layouts) : NULL; -+ rdefs.variant = all_variants ? g_strdup (all_variants) : NULL; -+ rdefs.options = all_options ? g_strdup (all_options) : NULL; -+ XkbRF_GetComponents (rules, &rdefs, &rnames); -+ xkb = XkbGetKeyboardByName (xdisplay, XkbUseCoreKbd, &rnames, -+ XkbGBN_AllComponentsMask, -+ XkbGBN_AllComponentsMask & -+ (~XkbGBN_GeometryMask), True); -+ if (!xkb) { -+ g_warning ("Cannot load new keyboard description."); -+ return FALSE; -+ } -+ XkbRF_SetNamesProp (xdisplay, rules_path, &rdefs); -+ g_free (rules_path); -+ g_free (rdefs.model); -+ g_free (rdefs.layout); -+ g_free (rdefs.variant); -+ g_free (rdefs.options); -+ -+ return TRUE; -+} -+ -+static Bool -+update_xkb_properties (Display *xdisplay, -+ const char *rules_file, const char *model, -+ const char *all_layouts, const char *all_variants, -+ const char *all_options) -+{ -+ int len; -+ char *pval; -+ char *next; -+ Atom rules_atom; -+ Window root_window; -+ -+ len = (rules_file ? strlen (rules_file) : 0); -+ len += (model ? strlen (model) : 0); -+ len += (all_layouts ? strlen (all_layouts) : 0); -+ len += (all_variants ? strlen (all_variants) : 0); -+ len += (all_options ? strlen (all_options) : 0); -+ -+ if (len < 1) { -+ return TRUE; -+ } -+ len += 5; /* trailing NULs */ -+ -+ rules_atom = XInternAtom (xdisplay, _XKB_RF_NAMES_PROP_ATOM, False); -+ root_window = XDefaultRootWindow (xdisplay); -+ pval = next = g_new0 (char, len + 1); -+ if (!pval) { -+ return TRUE; -+ } -+ -+ if (rules_file) { -+ strcpy (next, rules_file); -+ next += strlen (rules_file); -+ } -+ *next++ = '\0'; -+ if (model) { -+ strcpy (next, model); -+ next += strlen (model); -+ } -+ *next++ = '\0'; -+ if (all_layouts) { -+ strcpy (next, all_layouts); -+ next += strlen (all_layouts); -+ } -+ *next++ = '\0'; -+ if (all_variants) { -+ strcpy (next, all_variants); -+ next += strlen (all_variants); -+ } -+ *next++ = '\0'; -+ if (all_options) { -+ strcpy (next, all_options); -+ next += strlen (all_options); -+ } -+ *next++ = '\0'; -+ if ((next - pval) != len) { -+ g_free (pval); -+ return TRUE; -+ } -+ -+ XChangeProperty (xdisplay, root_window, -+ rules_atom, XA_STRING, 8, PropModeReplace, -+ (unsigned char *) pval, len); -+ XSync(xdisplay, False); -+ -+ return TRUE; -+} -+ -+void -+ibus_xkb_init (Display *xdisplay) -+{ -+ get_xdisplay (xdisplay); -+ init_xkb_default_layouts (xdisplay); -+} -+ -+void -+ibus_xkb_finit (void) -+{ -+ g_strfreev (default_layouts); -+ default_layouts = NULL; -+ g_strfreev (default_variants); -+ default_variants = NULL; -+ g_strfreev (default_options); -+ default_options = NULL; -+} -+ -+gchar * -+ibus_xkb_get_current_layout (void) -+{ -+ if (default_layouts == NULL) { -+ g_warning ("Your system seems not to support XKB."); -+ return NULL; -+ } -+ -+ return g_strjoinv (",", (gchar **) default_layouts); -+} -+ -+gchar * -+ibus_xkb_get_current_variant (void) -+{ -+ if (default_variants == NULL) { -+ return NULL; -+ } -+ -+ return g_strjoinv (",", (gchar **) default_variants); -+} -+ -+gchar * -+ibus_xkb_get_current_option (void) -+{ -+ if (default_options == NULL) { -+ return NULL; -+ } -+ -+ return g_strjoinv (",", (gchar **) default_options); -+} -+ -+gboolean -+ibus_xkb_set_layout (const char *layouts, -+ const char *variants, -+ const char *options) -+{ -+ Display *xdisplay; -+ gboolean retval; -+ gchar *layouts_line; -+ -+ if (default_layouts == NULL) { -+ g_warning ("Your system seems not to support XKB."); -+ return FALSE; -+ } -+ -+ if (layouts == NULL || g_strcmp0 (layouts, "default") == 0) { -+ layouts_line = g_strjoinv (",", (gchar **) default_layouts); -+ } else { -+ layouts_line = g_strdup (layouts); -+ } -+ -+ xdisplay = get_xdisplay (NULL); -+ retval = set_xkb_rules (xdisplay, -+ "evdev", "evdev", -+ layouts_line, variants, options); -+ update_xkb_properties (xdisplay, -+ "evdev", "evdev", -+ layouts_line, variants, options); -+ g_free (layouts_line); -+ -+ return retval; -+} -+ -+int -+ibus_xkb_get_current_group (void) -+{ -+ Display *xdisplay = get_xdisplay (NULL); -+ XkbStateRec state; -+ -+ if (default_layouts == NULL) { -+ g_warning ("Your system seems not to support XKB."); -+ return 0; -+ } -+ -+ if (xdisplay == NULL) { -+ g_warning ("ibus-xkb is not initialized."); -+ return 0; -+ } -+ -+ if (XkbGetState (xdisplay, XkbUseCoreKbd, &state) != Success) { -+ g_warning ("Could not get state"); -+ return 0; -+ } -+ -+ return state.group; -+} -diff --git a/engine/ibus-xkb/xkblib.h b/engine/ibus-xkb/xkblib.h -new file mode 100644 -index 0000000..36597c3 ---- /dev/null -+++ b/engine/ibus-xkb/xkblib.h -@@ -0,0 +1,41 @@ -+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ -+/* vim:set et sts=4: */ -+/* bus - The Input Bus -+ * Copyright (C) 2012 Takao Fujiwara -+ * Copyright (C) 2012 Peng Huang -+ * Copyright (C) 2012 Red Hat, Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the -+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -+ * Boston, MA 02111-1307, USA. -+ */ -+#ifndef __XKBLIB_H_ -+#define __XKBLIB_H_ -+ -+#include -+ -+G_BEGIN_DECLS -+ -+void ibus_xkb_init (Display *xdisplay); -+void ibus_xkb_finit (void); -+gchar *ibus_xkb_get_current_layout (void); -+gchar *ibus_xkb_get_current_variant (void); -+gchar *ibus_xkb_get_current_option (void); -+gboolean ibus_xkb_set_layout (const char *layouts, -+ const char *variants, -+ const char *options); -+int ibus_xkb_get_current_group (void); -+ -+G_END_DECLS -+#endif -diff --git a/engine/main.vala b/engine/main.vala -index acfa737..afadca0 100644 ---- a/engine/main.vala -+++ b/engine/main.vala -@@ -21,6 +21,85 @@ - */ - - using IBus; -+using GLib; -+ -+private void print_xml(string layout, -+ string layout_desc, -+ string? variant, -+ string? variant_desc, -+ string lang) { -+ string name = "xkb:%s:%s:%s".printf(layout, variant ?? "", lang); -+ string keymap = layout; -+ string desc = layout_desc; -+ string symbol = lang; -+ -+ if (variant != null) { -+ keymap = "%s(%s)".printf(layout, variant); -+ } -+ -+ if (variant_desc != null) { -+ desc = variant_desc; -+ } -+ -+ desc = desc.replace("<", "<").replace(">", ">"); -+ -+ if (lang.length > 2) { -+ symbol = lang[0:2]; -+ } -+ -+ string engine = " -+ -+ %s -+ %s -+ GPL -+ Peng Huang <shawn.p.huang@gmail.com> -+ %s -+ %s -+ %s -+ ibus-keyboard -+ %s -+ %d -+ ".printf(name, lang, keymap, desc, desc, symbol, 99); -+ print (engine); -+} -+ -+private void print_component() { -+ IBus.XKBConfigRegistry registry = new IBus.XKBConfigRegistry(); -+ GLib.List layouts = registry.layout_list_get_layouts(); -+ GLib.List variants; -+ GLib.List langs; -+ string layout_desc; -+ const string header = ""; -+ const string footer = " -+"; -+ -+ print (header); -+ for (unowned GLib.List l = layouts; l != null; l = l.next) { -+ variants = registry.layout_list_get_variants(l.data); -+ langs = registry.layout_lang_get_langs(l.data); -+ layout_desc = registry.layout_desc_get_desc(l.data); -+ for (unowned GLib.List lg = langs; lg != null; lg = lg.next) { -+ print_xml(l.data, layout_desc, null, null, lg.data); -+ } -+ for (unowned GLib.List v = variants; v != null; v = v.next) { -+ var l_v = "%s(%s)".printf(l.data, v.data); -+ unowned GLib.List l_v_langs = null; -+ GLib.List _l_v_langs = registry.layout_lang_get_langs(l_v); -+ l_v_langs = _l_v_langs; -+ if (l_v_langs == null) { -+ l_v_langs = langs; -+ } -+ for (unowned GLib.List lg = l_v_langs; lg != null; lg = lg.next) { -+ print_xml(l.data, -+ layout_desc, -+ v.data, -+ registry.variant_desc_get_desc(l_v), -+ lg.data); -+ } -+ } -+ } -+ print (footer); -+} - - class DummyEngine : IBus.EngineSimple { - } -@@ -28,6 +107,13 @@ class DummyEngine : IBus.EngineSimple { - public int main(string[] args) { - IBus.init(); - -+ if (args.length >= 2) { -+ if (args[1] == "--xml" || args[1] == "-x") { -+ print_component(); -+ return 0; -+ } -+ } -+ - IBus.Bus bus = new IBus.Bus(); - if (!bus.is_connected()) { - warning("ibus-daemon does not exist."); -diff --git a/engine/simple.xml.in.in b/engine/simple.xml.in.in -index d064ad6..d14ad93 100644 ---- a/engine/simple.xml.in.in -+++ b/engine/simple.xml.in.in -@@ -7,608 +7,5 @@ - GPL - http://code.google.com/p/ibus - ibus -- -- -- xkb:us::eng -- eng -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- us -- English (US) -- English (US) -- ibus-keyboard -- 99 -- -- -- xkb:us:intl:eng -- eng -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- us -- intl -- English (US, international with dead keys) -- English (US, international with dead keys) -- ibus-keyboard -- 99 -- -- -- xkb:us:colemak:eng -- eng -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- us -- colemak -- English (Colemak) -- English (Colemak) -- ibus-keyboard -- 99 -- -- -- xkb:us:dvorak:eng -- eng -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- us -- dvorak -- English (Dvorak) -- English (Dvorak) -- ibus-keyboard -- 99 -- -- -- xkb:us:altgr-intl:eng -- eng -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- us -- altgr-intl -- English (international AltGr dead keys) -- English (international AltGr dead keys) -- ibus-keyboard -- 99 -- -- -- xkb:ara::ara -- ara -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- ara -- Arabic -- Arabic -- ibus-keyboard -- 99 -- -- -- xkb:be::ger -- ger -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- be -- Belgian -- Belgian -- ibus-keyboard -- 99 -- -- -- xkb:be::nld -- nld -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- be -- Belgian -- Belgian -- ibus-keyboard -- 99 -- -- -- xkb:be::fra -- fra -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- be -- Belgian -- Belgian -- ibus-keyboard -- 99 -- -- -- xkb:br::por -- por -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- br -- Portuguese (Brazil) -- Portuguese (Brazil) -- ibus-keyboard -- 99 -- -- -- xkb:br:dvorak:por -- por -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- br -- dvorak -- Portuguese (Brazil, Dvorak) -- Portuguese (Brazil, Dvorak) -- ibus-keyboard -- 99 -- -- -- xkb:bg::bul -- bul -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- bg -- Bulgarian -- Bulgarian -- ibus-keyboard -- 99 -- -- -- xkb:bg:phonetic:bul -- bul -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- bg -- phonetic -- Bulgarian (traditional phonetic) -- Bulgarian (traditional phonetic) -- ibus-keyboard -- 99 -- -- -- xkb:ca::fra -- fra -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- ca -- French (Canada) -- French (Canada) -- ibus-keyboard -- 99 -- -- -- xkb:ca:eng:eng -- eng -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- ca -- eng -- English (Canada) -- English (Canada) -- ibus-keyboard -- 99 -- -- -- xkb:hr::scr -- scr -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- hr -- Croatian -- Croatian -- ibus-keyboard -- 99 -- -- -- xkb:cz::cze -- cze -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- cz -- Czech -- Czech -- ibus-keyboard -- 99 -- -- -- xkb:dk::dan -- dan -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- dk -- Danish -- Danish -- ibus-keyboard -- 99 -- -- -- xkb:ee::est -- est -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- ee -- Estonian -- Estonian -- ibus-keyboard -- 99 -- -- -- xkb:fi::fin -- fin -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- fi -- Finnish -- Finnish -- ibus-keyboard -- 99 -- -- -- xkb:fr::fra -- fra -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- fr -- French -- French -- ibus-keyboard -- 99 -- -- -- xkb:fr:dvorak:fra -- fra -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- fr -- dvorak -- French (Dvorak) -- French (Dvorak) -- ibus-keyboard -- 99 -- -- -- xkb:de::ger -- ger -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- de -- German -- German -- ibus-keyboard -- 99 -- -- -- xkb:de:dvorak:ger -- ger -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- de -- dvorak -- German (Dvorak) -- German (Dvorak) -- ibus-keyboard -- 99 -- -- -- xkb:de:neo:ger -- ger -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- de -- neo -- German (Neo 2) -- German (Neo 2) -- ibus-keyboard -- 99 -- -- -- xkb:gr::gre -- gre -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- gr -- Greek -- Greek -- ibus-keyboard -- 99 -- -- -- xkb:hu::hun -- hun -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- hu -- Hungarian -- Hungarian -- ibus-keyboard -- 99 -- -- -- xkb:il::heb -- heb -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- il -- Hebrew -- Hebrew -- ibus-keyboard -- 99 -- -- -- xkb:it::ita -- ita -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- it -- Italian -- Italian -- ibus-keyboard -- 99 -- -- -- xkb:jp::jpn -- jpn -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- jp -- Japanese -- Japanese -- ibus-keyboard -- 99 -- -- -- xkb:latam::spa -- spa -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- latam -- Spanish (Latin American) -- Spanish (Latin American) -- ibus-keyboard -- 99 -- -- -- xkb:lt::lit -- lit -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- lt -- Lithuanian -- Lithuanian -- ibus-keyboard -- 99 -- -- -- xkb:lv:apostrophe:lav -- lav -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- lv -- apostrophe -- Latvian (apostrophe variant) -- Latvian (apostrophe variant) -- ibus-keyboard -- 99 -- -- -- xkb:pl::pol -- pol -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- pl -- Polish -- Polish -- ibus-keyboard -- 99 -- -- -- xkb:pl:dvorak:pol -- pol -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- pl -- dvorak -- Polish (Dvorak) -- Polish (Dvorak) -- ibus-keyboard -- 99 -- -- -- xkb:pt::por -- por -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- pt -- Portuguese -- Portuguese -- ibus-keyboard -- 99 -- -- -- xkb:ro::rum -- rum -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- ro -- Romanian -- Romanian -- ibus-keyboard -- 99 -- -- -- xkb:ru::rus -- rus -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- ru -- Russian -- Russian -- ibus-keyboard -- 99 -- -- -- xkb:ru:phonetic:rus -- rus -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- ru -- phonetic -- Russian (phonetic) -- Russian (phonetic) -- ibus-keyboard -- 99 -- -- -- xkb:rs::srp -- srp -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- rs -- Serbian -- Serbian -- ibus-keyboard -- 99 -- -- -- xkb:si::slv -- slv -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- si -- Slovenian -- Slovenian -- ibus-keyboard -- 99 -- -- -- xkb:sk::slo -- slo -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- sk -- Slovak -- Slovak -- ibus-keyboard -- 99 -- -- -- xkb:es::spa -- spa -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- es -- Spanish -- Spanish -- ibus-keyboard -- 99 -- -- -- xkb:es:cat:cat -- cat -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- es -- cat -- Catalan (Spain, with middle-dot L) -- Catalan (Spain, with middle-dot L) -- ibus-keyboard -- 99 -- -- -- xkb:se::swe -- swe -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- se -- Swedish -- Swedish -- ibus-keyboard -- 99 -- -- -- xkb:se:dvorak:swe -- swe -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- se -- dvorak -- Swedish (Dvorak) -- Swedish (Dvorak) -- ibus-keyboard -- 99 -- -- -- xkb:ch::ger -- ger -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- ch -- German (Switzerland) -- German (Switzerland) -- ibus-keyboard -- 99 -- -- -- xkb:ch:fr:fra -- fra -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- ch -- fr -- French (Switzerland) -- French (Switzerland) -- ibus-keyboard -- 99 -- -- -- xkb:tr::tur -- tur -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- tr -- Turkish -- Turkish -- ibus-keyboard -- 99 -- -- -- xkb:ua::ukr -- ukr -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- ua -- Ukrainian -- Ukrainian -- ibus-keyboard -- 99 -- -- -- xkb:gb:extd:eng -- eng -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- gb -- extd -- English (UK, extended WinKeys) -- English (UK, extended WinKeys) -- ibus-keyboard -- 99 -- -- -- xkb:gb:dvorak:eng -- eng -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- gb -- dvorak -- English (UK, Dvorak) -- English (UK, Dvorak) -- ibus-keyboard -- 99 -- -- -- xkb:kr:kr104:kor -- kor -- GPL -- Peng Huang <shawn.p.huang@gmail.com> -- kr -- kr104 -- Korean (101/104 key compatible) -- Korean (101/104 key compatible) -- ibus-keyboard -- 99 -- -- -+ - + ++ /schemas/desktop/ibus/general/hotkey/triggers-no-modifiers ++ /desktop/ibus/general/hotkey/triggers-no-modifiers ++ ibus ++ list ++ string ++ [] ++ ++ Trigger shortcut keys without modifier keys ++ Trigger shortcut keys without modifier keys. ++ The list is used by ibus-gjs. ++ ++ ++ + /schemas/desktop/ibus/general/hotkey/enable_unconditional + /desktop/ibus/general/hotkey/enable_unconditional + ibus diff --git a/ibus-1.0.pc.in b/ibus-1.0.pc.in -index 9f593ab..66b902a 100644 +index 9f593ab..c93a0ed 100644 --- a/ibus-1.0.pc.in +++ b/ibus-1.0.pc.in -@@ -1,9 +1,13 @@ - prefix=@prefix@ - exec_prefix=@exec_prefix@ - libdir=@libdir@ -+libexecdir=@libexecdir@ +@@ -4,6 +4,7 @@ libdir=@libdir@ includedir=@includedir@ datadir=@datadir@ pkgdatadir=@datadir@/ibus -+have_ibus_xkb=@HAVE_IBUS_XKB@ -+ibus_xkb=${libexecdir}/ibus-xkb +have_ibus_gkbd=@HAVE_IBUS_GKBD@ Name: IBus @@ -1739,91 +274,16 @@ index 58cac38..4b6f869 100644 %configure $OPTIONS # make -C po update-gmo -diff --git a/setup/main.py b/setup/main.py -index f527da1..c02229b 100644 ---- a/setup/main.py -+++ b/setup/main.py -@@ -67,6 +67,13 @@ class Setup(object): - def __init__(self): - super(Setup, self).__init__() - -+ # In the latest pygobject3 3.3.4 or later, g_variant_dup_strv -+ # returns the allocated strv but in the previous release, -+ # it returned the tuple of (strv, length) -+ self.__tuple_for_variant_strv = False -+ if type(GLib.Variant.new_strv([]).dup_strv()) == tuple: -+ self.__tuple_for_variant_strv = True -+ - # IBus.Bus() calls ibus_bus_new(). - # Gtk.Builder().add_from_file() also calls ibus_bus_new_async() - # via ibus_im_context_new(). -@@ -191,14 +198,22 @@ class Setup(object): - - # init engine page - self.__engines = self.__bus.list_engines() -+ value = self.__config.get_value("general", "load_xkb_layouts") -+ load_layouts = [] -+ if value != None: -+ load_layouts = self.__variant_dup_strv(value) -+ engines = [] -+ for engine in self.__engines: -+ if not engine.get_name().startswith('xkb:'): -+ engines.append(engine) -+ elif engine.get_layout() in load_layouts: -+ engines.append(engine) -+ - self.__combobox = self.__builder.get_object("combobox_engines") -- self.__combobox.set_engines(self.__engines) -+ self.__combobox.set_engines(engines) - -- tmp_dict = {} -- for e in self.__engines: -- tmp_dict[e.get_name()] = e - engine_names = values.get("preload_engines", []) -- engines = [tmp_dict[name] for name in engine_names if name in tmp_dict] -+ engines = self.__get_engine_descs_from_names(engine_names) - - self.__treeview = self.__builder.get_object("treeview_engines") - self.__treeview.set_engines(engines) -@@ -247,6 +262,12 @@ class Setup(object): - self.__init_panel() - self.__init_general() - -+ def __variant_dup_strv(self, variant): -+ if self.__tuple_for_variant_strv: -+ return variant.dup_strv()[0] -+ else: -+ return variant.dup_strv() -+ - def __combobox_notify_active_engine_cb(self, combobox, property): - engine = self.__combobox.get_active_engine() - button = self.__builder.get_object("button_engine_add") -@@ -271,6 +292,13 @@ class Setup(object): - args.append(path.basename(setup_path)) - return args - -+ def __get_engine_descs_from_names(self, engine_names): -+ tmp_dict = {} -+ for e in self.__engines: -+ tmp_dict[e.get_name()] = e -+ engines = [tmp_dict[name] for name in engine_names if name in tmp_dict] -+ return engines -+ - def __treeview_notify_cb(self, treeview, prop): - if prop.name not in ("active-engine", "engines"): - return diff --git a/src/Makefile.am b/src/Makefile.am -index df4ada3..f8499a8 100644 +index 7ee5df8..8fa954e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am -@@ -194,6 +194,11 @@ typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) +@@ -197,6 +197,9 @@ typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) CLEANFILES += $(dist_gir_DATA) $(typelibs_DATA) endif -+if ENABLE_IBUS_XKB +ibus_sources += ibusxkbxml.c +ibus_headers += ibusxkbxml.h -+endif + # gen enum types ibusenumtypes.h: $(ibus_headers) ibusenumtypes.h.template @@ -2506,7 +966,7 @@ index 0000000..6f5b7bd +G_END_DECLS +#endif diff --git a/ui/gtk3/Makefile.am b/ui/gtk3/Makefile.am -index 5473027..6cb02a1 100644 +index 5473027..b7e663c 100644 --- a/ui/gtk3/Makefile.am +++ b/ui/gtk3/Makefile.am @@ -47,6 +47,8 @@ USE_SYMBOL_ICON = FALSE @@ -2518,17 +978,16 @@ index 5473027..6cb02a1 100644 AM_CFLAGS = \ @GLIB2_CFLAGS@ \ @GIO2_CFLAGS@ \ -@@ -58,6 +60,9 @@ AM_CFLAGS = \ +@@ -58,6 +60,8 @@ AM_CFLAGS = \ -DBINDIR=\"$(bindir)\" \ -DIBUS_DISABLE_DEPRECATED \ -DSWITCHER_USE_SYMBOL_ICON=$(USE_SYMBOL_ICON) \ + -DHAVE_IBUS_GKBD=$(HAVE_IBUS_GKBD_C) \ -+ -DIBUS_XKB_COMMAND=\"$(libexecdir)/ibus-xkb\" \ + -DXKB_LAYOUTS_MAX_LENGTH=4 \ -Wno-unused-variable \ -Wno-unused-but-set-variable \ -Wno-unused-function \ -@@ -91,6 +96,7 @@ ibus_ui_gtk3_SOURCES = \ +@@ -91,6 +95,7 @@ ibus_ui_gtk3_SOURCES = \ application.vala \ candidatearea.vala \ candidatepanel.vala \ @@ -2536,7 +995,7 @@ index 5473027..6cb02a1 100644 handle.vala \ iconwidget.vala \ keybindingmanager.vala \ -@@ -99,17 +105,48 @@ ibus_ui_gtk3_SOURCES = \ +@@ -99,17 +104,48 @@ ibus_ui_gtk3_SOURCES = \ property.vala \ separator.vala \ switcher.vala \ @@ -2769,31 +1228,10 @@ index 0000000..2b78c69 + */ +} diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala -index c159693..63b0cde 100644 +index 24e6b2e..55b63ce 100644 --- a/ui/gtk3/panel.vala +++ b/ui/gtk3/panel.vala -@@ -21,6 +21,20 @@ - */ - - class Panel : IBus.PanelService { -+ private class Keybinding { -+ public Keybinding(uint keysym, -+ Gdk.ModifierType modifiers, -+ bool reverse) { -+ this.keysym = keysym; -+ this.modifiers = modifiers; -+ this.reverse = reverse; -+ } -+ -+ public uint keysym { get; set; } -+ public Gdk.ModifierType modifiers { get; set; } -+ public bool reverse { get; set; } -+ } -+ - private IBus.Bus m_bus; - private IBus.Config m_config; - private Gtk.StatusIcon m_status_icon; -@@ -34,10 +48,17 @@ class Panel : IBus.PanelService { +@@ -48,6 +48,13 @@ class Panel : IBus.PanelService { private Gtk.AboutDialog m_about_dialog; private Gtk.CssProvider m_css_provider; private int m_switcher_delay_time = 400; @@ -2805,25 +1243,9 @@ index c159693..63b0cde 100644 + private bool m_changed_xkb_option = false; + private GLib.Timer m_changed_layout_timer; private const string ACCELERATOR_SWITCH_IME_FOREWARD = "space"; -+ private const string ACCELERATOR_SWITCH_IME_BACKWARD = "space"; -- private uint m_switch_keysym = 0; -- private Gdk.ModifierType m_switch_modifiers = 0; -+ private GLib.List m_keybindings = new GLib.List(); - - public Panel(IBus.Bus bus) { - GLib.assert(bus.is_connected()); -@@ -60,7 +81,8 @@ class Panel : IBus.PanelService { - m_candidate_panel.page_down.connect((w) => this.page_down()); - - m_switcher = new Switcher(); -- bind_switch_shortcut(); -+ // The initial shortcut is "space" -+ bind_switch_shortcut(null); - - if (m_switcher_delay_time >= 0) { - m_switcher.set_popup_delay_time((uint) m_switcher_delay_time); -@@ -76,64 +98,132 @@ class Panel : IBus.PanelService { + private GLib.List m_keybindings = new GLib.List(); +@@ -90,6 +97,14 @@ class Panel : IBus.PanelService { ~Panel() { unbind_switch_shortcut(); @@ -2837,166 +1259,17 @@ index c159693..63b0cde 100644 + m_xkblayout = null; } -- private void bind_switch_shortcut() { -- var keybinding_manager = KeybindingManager.get_instance(); -+ private void keybinding_manager_bind(KeybindingManager keybinding_manager, -+ string? accelerator) { -+ uint switch_keysym = 0; -+ Gdk.ModifierType switch_modifiers = 0; -+ Gdk.ModifierType reverse_modifier = Gdk.ModifierType.SHIFT_MASK; -+ Keybinding keybinding; - -- var accelerator = ACCELERATOR_SWITCH_IME_FOREWARD; - Gtk.accelerator_parse(accelerator, -- out m_switch_keysym, out m_switch_modifiers); -+ out switch_keysym, out switch_modifiers); - -- // Map virtual modifiers to (i.e.Mod2, Mod3, ...) -+ // Map virtual modifiers to (i.e. Mod2, Mod3, ...) - const Gdk.ModifierType VIRTUAL_MODIFIERS = ( - Gdk.ModifierType.SUPER_MASK | - Gdk.ModifierType.HYPER_MASK | - Gdk.ModifierType.META_MASK); -- if ((m_switch_modifiers & VIRTUAL_MODIFIERS) != 0) { -+ if ((switch_modifiers & VIRTUAL_MODIFIERS) != 0) { - // workaround a bug in gdk vapi vala > 0.18 - // https://bugzilla.gnome.org/show_bug.cgi?id=677559 - #if VALA_0_18 - Gdk.Keymap.get_default().map_virtual_modifiers( -- ref m_switch_modifiers); -+ ref switch_modifiers); - #else -- if ((m_switch_modifiers & Gdk.ModifierType.SUPER_MASK) != 0) -- m_switch_modifiers |= Gdk.ModifierType.MOD4_MASK; -- if ((m_switch_modifiers & Gdk.ModifierType.HYPER_MASK) != 0) -- m_switch_modifiers |= Gdk.ModifierType.MOD4_MASK; -+ if ((switch_modifiers & Gdk.ModifierType.SUPER_MASK) != 0) -+ switch_modifiers |= Gdk.ModifierType.MOD4_MASK; -+ if ((switch_modifiers & Gdk.ModifierType.HYPER_MASK) != 0) -+ switch_modifiers |= Gdk.ModifierType.MOD4_MASK; - #endif -- m_switch_modifiers &= ~VIRTUAL_MODIFIERS; -+ switch_modifiers &= ~VIRTUAL_MODIFIERS; - } - -- if (m_switch_keysym == 0 && m_switch_modifiers == 0) { -+ if (switch_keysym == 0 && switch_modifiers == 0) { - warning("Parse accelerator '%s' failed!", accelerator); - return; - } - -- keybinding_manager.bind(m_switch_keysym, m_switch_modifiers, -+ keybinding = new Keybinding(switch_keysym, -+ switch_modifiers, -+ false); -+ m_keybindings.append(keybinding); -+ -+ keybinding_manager.bind(switch_keysym, switch_modifiers, - (e) => handle_engine_switch(e, false)); - - // accelerator already has Shift mask -- if ((m_switch_modifiers & Gdk.ModifierType.SHIFT_MASK) != 0) -+ if ((switch_modifiers & reverse_modifier) != 0) { - return; -+ } - -- keybinding_manager.bind(m_switch_keysym, -- m_switch_modifiers | Gdk.ModifierType.SHIFT_MASK, -+ switch_modifiers |= reverse_modifier; -+ keybinding = new Keybinding(switch_keysym, -+ switch_modifiers, -+ true); -+ m_keybindings.append(keybinding); -+ -+ keybinding_manager.bind(switch_keysym, switch_modifiers, - (e) => handle_engine_switch(e, true)); -+ -+ } -+ -+ // ToDo: Customize the input method with ibus-setup -+ private void bind_switch_shortcut(Variant ?variant) { -+ string locale = GLib.Intl.setlocale(GLib.LocaleCategory.ALL, -+ null); -+ if (locale == null) { -+ locale = "C"; -+ } -+ -+ string[] accelerators = {}; -+ Variant var_trigger = variant; -+ -+ if (var_trigger == null && m_config != null) { -+ var_trigger = m_config.get_value("general/hotkey", -+ "trigger_accel"); -+ } -+ -+ if (var_trigger != null) { -+ accelerators = var_trigger.dup_strv(); -+ } else { -+ accelerators += ACCELERATOR_SWITCH_IME_FOREWARD; -+ } -+ -+ if (accelerators.length == 1 && -+ accelerators[0] == ACCELERATOR_SWITCH_IME_FOREWARD) { -+ // FIXME: When us keyboard is used, Zenkaku_Hankaku does not work. -+ /* -+ if (locale[0:2] == "ja") { -+ accelerators += "Zenkaku_Hankaku"; -+ } -+ */ -+ if (locale[0:2] == "ko") { -+ accelerators += "Hangul"; -+ accelerators += "Alt_R"; -+ } -+ } -+ -+ var keybinding_manager = KeybindingManager.get_instance(); -+ -+ foreach (var accelerator in accelerators) { -+ keybinding_manager_bind(keybinding_manager, accelerator); -+ } - } - - private void unbind_switch_shortcut() { - var keybinding_manager = KeybindingManager.get_instance(); - -- if (m_switch_keysym == 0 && m_switch_modifiers == 0) -- return; -+ unowned GLib.List keybindings = m_keybindings; -+ -+ while (keybindings != null) { -+ Keybinding keybinding = keybindings.data; - -- keybinding_manager.unbind(m_switch_keysym, m_switch_modifiers); -- keybinding_manager.unbind(m_switch_keysym, -- m_switch_modifiers | Gdk.ModifierType.SHIFT_MASK); -+ keybinding_manager.unbind(keybinding.keysym, -+ keybinding.modifiers); -+ keybindings = keybindings.next; -+ } - -- m_switch_keysym = 0; -- m_switch_modifiers = 0; -+ m_keybindings = null; - } - - private void set_custom_font() { -@@ -225,10 +315,14 @@ class Panel : IBus.PanelService { - m_config.watch("general", "preload_engines"); - m_config.watch("general", "engines_order"); - m_config.watch("general", "switcher_delay_time"); -+ m_config.watch("general/hotkey", "trigger_accel"); + private void keybinding_manager_bind(KeybindingManager keybinding_manager, +@@ -281,6 +296,7 @@ class Panel : IBus.PanelService { + m_config.watch("general/hotkey", "triggers"); m_config.watch("panel", "custom_font"); m_config.watch("panel", "use_custom_font"); + init_engines_order(); update_engines(m_config.get_value("general", "preload_engines"), m_config.get_value("general", "engines_order")); -+ unbind_switch_shortcut(); -+ bind_switch_shortcut(null); - set_switcher_delay_time(null); - } else { - update_engines(null, null); -@@ -282,6 +376,200 @@ class Panel : IBus.PanelService { - } + unbind_switch_shortcut(); +@@ -293,6 +309,204 @@ class Panel : IBus.PanelService { + set_custom_font(); } + private void gkbdlayout_changed_cb() { @@ -3090,7 +1363,7 @@ index c159693..63b0cde 100644 + var_xkb_engine_names += "%s:%s:%s".printf("xkb", name, lang); + } + -+ GLib.Variant var_engines = ++ GLib.Variant var_engines = + m_config.get_value("general", "preload_engines"); + string[] engine_names = {}; + bool updated_engine_names = false; @@ -3135,11 +1408,8 @@ index c159693..63b0cde 100644 + } + } + -+ private void set_xkb_group_layout(string layout) { -+ int[] retval = m_xkblayout.set_layout(layout, -+ "default", -+ "default", -+ true); ++ private void set_xkb_group_layout(IBus.EngineDesc engine) { ++ int[] retval = m_xkblayout.set_layout(engine, true); + if (retval[0] >= 0) { + /* If an XKB keymap is added into the XKB group, + * this._gkbdlayout.lock_group will be called after @@ -3149,7 +1419,10 @@ index c159693..63b0cde 100644 + } + } + -+ private bool set_gkbd_layout(string layout) { ++ private bool set_gkbd_layout(IBus.EngineDesc engine) { ++ string layout = engine.get_layout(); ++ string variant = engine.get_layout_variant(); ++ + /* If a previous ibus engine changed XKB options, need to set the + * default XKB option. */ + if (m_changed_xkb_option == true) { @@ -3157,6 +1430,10 @@ index c159693..63b0cde 100644 + return false; + } + ++ if (variant != "" && variant != "default") { ++ layout = "%s(%s)".printf(layout, variant); ++ } ++ + int gkbd_len = m_gkbdlayout.get_group_names().length; + for (int i = 0; i < m_layouts.length && i < gkbd_len; i++) { + string sys_layout = m_layouts[i]; @@ -3174,7 +1451,7 @@ index c159693..63b0cde 100644 + private void set_layout(IBus.EngineDesc engine) { + string layout = engine.get_layout(); + -+ if (layout == "default" || layout == null) { ++ if (layout == "" || layout == null) { + return; + } + @@ -3183,20 +1460,20 @@ index c159693..63b0cde 100644 + } + + if (HAVE_IBUS_GKBD && m_gkbdlayout != null) { -+ if (set_gkbd_layout(layout)) { ++ if (set_gkbd_layout(engine)) { + return; + } -+ set_xkb_group_layout(layout); ++ set_xkb_group_layout(engine); + return; + } + -+ m_xkblayout.set_layout(layout); ++ m_xkblayout.set_layout(engine); + } + - private void switch_engine(int i, bool force = false) { - GLib.assert(i >= 0 && i < m_engines.length); - -@@ -296,7 +584,7 @@ class Panel : IBus.PanelService { + private void exec_setxkbmap(IBus.EngineDesc engine) { + string layout = engine.get_layout(); + string variant = engine.get_layout_variant(); +@@ -352,7 +566,7 @@ class Panel : IBus.PanelService { return; } // set xkb layout @@ -3205,58 +1482,12 @@ index c159693..63b0cde 100644 } private void config_value_changed_cb(IBus.Config config, -@@ -308,6 +596,12 @@ class Panel : IBus.PanelService { - return; - } - -+ if (section == "general/hotkey" && name == "trigger_accel") { -+ unbind_switch_shortcut(); -+ bind_switch_shortcut(variant); -+ return; -+ } -+ - if (section == "panel" && (name == "custom_font" || - name == "use_custom_font")) { - set_custom_font(); -@@ -316,6 +610,7 @@ class Panel : IBus.PanelService { - - if (section == "general" && name == "switcher_delay_time") { - set_switcher_delay_time(variant); -+ return; - } - } - -@@ -324,15 +619,22 @@ class Panel : IBus.PanelService { - if (m_engines.length <= 1) - return; - -+ uint keyval = event.key.keyval; -+ uint modifiers = KeybindingManager.MODIFIER_FILTER & event.key.state; -+ - uint primary_modifiers = - KeybindingManager.get_primary_modifier(event.key.state); - - bool pressed = KeybindingManager.primary_modifier_still_pressed( - event, primary_modifiers); -+ -+ if (revert) { -+ modifiers &= ~Gdk.ModifierType.SHIFT_MASK; -+ } -+ - if (pressed && m_switcher_delay_time >= 0) { - int i = revert ? m_engines.length - 1 : 1; -- i = m_switcher.run(m_switch_keysym, m_switch_modifiers, event, -- m_engines, i); -+ i = m_switcher.run(keyval, modifiers, event, m_engines, i); - if (i < 0) { - debug("switch cancelled"); - } else { diff --git a/ui/gtk3/xkblayout.vala b/ui/gtk3/xkblayout.vala new file mode 100644 -index 0000000..2092a60 +index 0000000..165a905 --- /dev/null +++ b/ui/gtk3/xkblayout.vala -@@ -0,0 +1,465 @@ +@@ -0,0 +1,431 @@ +/* vim:set et sts=4 sw=4: + * + * ibus - The Input Bus @@ -3282,13 +1513,11 @@ index 0000000..2092a60 + */ + +public extern const bool HAVE_IBUS_GKBD; -+public extern const bool HAVE_IBUS_XKB; +public extern const int XKB_LAYOUTS_MAX_LENGTH; -+public extern const string IBUS_XKB_COMMAND; + +class XKBLayout +{ -+ string m_xkb_command = IBUS_XKB_COMMAND; ++ string m_xkb_command = "setxkbmap"; + IBus.Config m_config = null; + string[] m_xkb_latin_layouts = {}; + GLib.Pid m_xkb_pid = -1; @@ -3302,10 +1531,6 @@ index 0000000..2092a60 + string m_default_option = ""; + + public XKBLayout(IBus.Config? config) { -+ if (!HAVE_IBUS_XKB) { -+ m_xkb_command = "setxkbmap"; -+ } -+ + m_config = config; + + if (config != null) { @@ -3350,6 +1575,11 @@ index 0000000..2092a60 + if (element.length <= line.length && + line[0:element.length] == element) { + retval = line[element.length:line.length]; ++ if (retval == null) { ++ retval = ""; ++ } else { ++ retval = retval.strip(); ++ } + } + } + return retval; @@ -3476,27 +1706,15 @@ index 0000000..2092a60 + } + + public string get_layout() { -+ if (HAVE_IBUS_XKB) { -+ return get_output_from_cmdline("--get", "layout: "); -+ } else { -+ return get_output_from_cmdline("-query", "layout: "); -+ } ++ return get_output_from_cmdline("-query", "layout: "); + } + + public string get_variant() { -+ if (HAVE_IBUS_XKB) { -+ return get_output_from_cmdline("--get", "variant: "); -+ } else { -+ return get_output_from_cmdline("-query", "variant: "); -+ } ++ return get_output_from_cmdline("-query", "variant: "); + } + + public string get_option() { -+ if (HAVE_IBUS_XKB) { -+ return get_output_from_cmdline("--get", "option: "); -+ } else { -+ return get_output_from_cmdline("-query", "options: "); -+ } ++ return get_output_from_cmdline("-query", "options: "); + } + + /* @@ -3505,11 +1723,13 @@ index 0000000..2092a60 + } + */ + -+ public int[] set_layout(string _layout="default", -+ string _variant="default", -+ string _option="default", -+ bool use_group_layout=false) { -+ assert (_layout != null); ++ public int[] set_layout(IBus.EngineDesc engine, ++ bool use_group_layout=false) { ++ string layout = engine.get_layout(); ++ string variant = engine.get_layout_variant(); ++ string option = engine.get_layout_option(); ++ ++ assert (layout != null); + + int xkb_group_id = 0; + int changed_option = 0; @@ -3518,26 +1738,11 @@ index 0000000..2092a60 + return {-1, 0}; + } + -+ if (_layout == "default" && _variant == "default" && -+ _option == "default") { ++ if (layout == "default" && ++ (variant == "default" || variant == "") && ++ (option == "default" || option == "")) { + return {-1, 0}; + } -+ // const gchar to gchar -+ string layout = _layout; -+ string variant = _variant; -+ string option = _option; -+ -+ if (variant == "default") { -+ string[] array = get_variant_from_layout(layout); -+ layout = array[0]; -+ variant = array[1]; -+ } -+ -+ if (option == "default") { -+ string[] array = get_option_from_layout(layout); -+ layout = array[0]; -+ option = array[1]; -+ } + + bool need_us_layout = false; + foreach (string latin_layout in m_xkb_latin_layouts) { @@ -3616,25 +1821,17 @@ index 0000000..2092a60 + + string[] args = {}; + args += m_xkb_command; -+ if (HAVE_IBUS_XKB) { -+ args += "--layout"; -+ args += layout; -+ if (variant != null) { -+ args += "--variant"; -+ args += variant; -+ } -+ if (option != null) { -+ args += "--option"; -+ args += option; -+ } -+ } else { -+ args += layout; -+ if (variant != null) { -+ args += variant; -+ } -+ if (option != null) { -+ args += option; -+ } ++ args += "-layout"; ++ args += layout; ++ if (variant != null) { ++ args += "-variant"; ++ args += variant; ++ } ++ if (option != null) { ++ /* TODO: Need to get the session XKB options */ ++ args += "-option"; ++ args += "-option"; ++ args += option; + } + + GLib.Pid child_pid; @@ -3647,7 +1844,7 @@ index 0000000..2092a60 + null, + out child_pid); + } catch (GLib.SpawnError err) { -+ stderr.printf("IBUS_ERROR: %s\n", err.message); ++ stderr.printf("Execute setxkbmap failed: %s\n", err.message); + return {-1, 0}; + } + m_xkb_pid = child_pid; diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch index a48ab7b..00c3b85 100644 --- a/ibus-HEAD.patch +++ b/ibus-HEAD.patch @@ -1,323 +1,397 @@ -From 15f3ccb38474c6bb206a2158d86171c93d6ec6a5 Mon Sep 17 00:00:00 2001 +From 8ac534fc002356b93e2015a8866f1ea89e3895f9 Mon Sep 17 00:00:00 2001 From: fujiwarat -Date: Tue, 13 Nov 2012 12:05:07 +0900 -Subject: [PATCH] Update simple.xml to enable layout_variant tag. +Date: Sat, 15 Dec 2012 17:40:18 +0900 +Subject: [PATCH] Use Variant.unpack() instead of Variant.dup_strv(). -Review URL: https://codereview.appspot.com/6820129 +Variant.dup_strv() returns a tuple in pygobject 3.2, e.g. (['space'], 1L), and a list in pygobject 3.4, e.g. ['space'] . + +BUG=RH#887153 + +Review URL: https://codereview.appspot.com/6941051 --- - engine/simple.xml.in.in | 112 ++++++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 93 insertions(+), 19 deletions(-) + setup/main.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/engine/simple.xml.in.in b/engine/simple.xml.in.in -index 25db578..d064ad6 100644 ---- a/engine/simple.xml.in.in -+++ b/engine/simple.xml.in.in -@@ -24,7 +24,8 @@ - eng - GPL - Peng Huang <shawn.p.huang@gmail.com> -- us(intl) -+ us -+ intl - English (US, international with dead keys) - English (US, international with dead keys) - ibus-keyboard -@@ -35,7 +36,8 @@ - eng - GPL - Peng Huang <shawn.p.huang@gmail.com> -- us(colemak) -+ us -+ colemak - English (Colemak) - English (Colemak) - ibus-keyboard -@@ -46,7 +48,8 @@ - eng - GPL - Peng Huang <shawn.p.huang@gmail.com> -- us(dvorak) -+ us -+ dvorak - English (Dvorak) - English (Dvorak) - ibus-keyboard -@@ -57,20 +60,21 @@ - eng - GPL - Peng Huang <shawn.p.huang@gmail.com> -- us(altgr-intl) -+ us -+ altgr-intl - English (international AltGr dead keys) - English (international AltGr dead keys) - ibus-keyboard - 99 - - -- xkb:us:altgr-intl:eng -- eng -+ xkb:ara::ara -+ ara - GPL - Peng Huang <shawn.p.huang@gmail.com> -- us(altgr-intl) -- English (international AltGr dead keys) -- English (international AltGr dead keys) -+ ara -+ Arabic -+ Arabic - ibus-keyboard - 99 - -@@ -119,6 +123,18 @@ - 99 - - -+ xkb:br:dvorak:por -+ por -+ GPL -+ Peng Huang <shawn.p.huang@gmail.com> -+ br -+ dvorak -+ Portuguese (Brazil, Dvorak) -+ Portuguese (Brazil, Dvorak) -+ ibus-keyboard -+ 99 -+ -+ - xkb:bg::bul - bul - GPL -@@ -134,7 +150,8 @@ - bul - GPL - Peng Huang <shawn.p.huang@gmail.com> -- bg(phonetic) -+ bg -+ phonetic - Bulgarian (traditional phonetic) - Bulgarian (traditional phonetic) - ibus-keyboard -@@ -156,7 +173,8 @@ - eng - GPL - Peng Huang <shawn.p.huang@gmail.com> -- ca(eng) -+ ca -+ eng - English (Canada) - English (Canada) - ibus-keyboard -@@ -229,6 +247,18 @@ - 99 - - -+ xkb:fr:dvorak:fra -+ fra -+ GPL -+ Peng Huang <shawn.p.huang@gmail.com> -+ fr -+ dvorak -+ French (Dvorak) -+ French (Dvorak) -+ ibus-keyboard -+ 99 -+ -+ - xkb:de::ger - ger - GPL -@@ -240,11 +270,24 @@ - 99 - - -+ xkb:de:dvorak:ger -+ ger -+ GPL -+ Peng Huang <shawn.p.huang@gmail.com> -+ de -+ dvorak -+ German (Dvorak) -+ German (Dvorak) -+ ibus-keyboard -+ 99 -+ -+ - xkb:de:neo:ger - ger - GPL - Peng Huang <shawn.p.huang@gmail.com> -- de(neo) -+ de -+ neo - German (Neo 2) - German (Neo 2) - ibus-keyboard -@@ -332,7 +375,8 @@ - lav - GPL - Peng Huang <shawn.p.huang@gmail.com> -- lv(apostrophe) -+ lv -+ apostrophe - Latvian (apostrophe variant) - Latvian (apostrophe variant) - ibus-keyboard -@@ -350,6 +394,18 @@ - 99 - - -+ xkb:pl:dvorak:pol -+ pol -+ GPL -+ Peng Huang <shawn.p.huang@gmail.com> -+ pl -+ dvorak -+ Polish (Dvorak) -+ Polish (Dvorak) -+ ibus-keyboard -+ 99 -+ -+ - xkb:pt::por - por - GPL -@@ -387,7 +443,8 @@ - rus - GPL - Peng Huang <shawn.p.huang@gmail.com> -- ru(phonetic) -+ ru -+ phonetic - Russian (phonetic) - Russian (phonetic) - ibus-keyboard -@@ -442,7 +499,8 @@ - cat - GPL - Peng Huang <shawn.p.huang@gmail.com> -- es(cat) -+ es -+ cat - Catalan (Spain, with middle-dot L) - Catalan (Spain, with middle-dot L) - ibus-keyboard -@@ -460,6 +518,18 @@ - 99 - - -+ xkb:se:dvorak:swe -+ swe -+ GPL -+ Peng Huang <shawn.p.huang@gmail.com> -+ se -+ dvorak -+ Swedish (Dvorak) -+ Swedish (Dvorak) -+ ibus-keyboard -+ 99 -+ -+ - xkb:ch::ger - ger - GPL -@@ -475,7 +545,8 @@ - fra - GPL - Peng Huang <shawn.p.huang@gmail.com> -- ch(fr) -+ ch -+ fr - French (Switzerland) - French (Switzerland) - ibus-keyboard -@@ -508,7 +579,8 @@ - eng - GPL - Peng Huang <shawn.p.huang@gmail.com> -- gb(extd) -+ gb -+ extd - English (UK, extended WinKeys) - English (UK, extended WinKeys) - ibus-keyboard -@@ -519,7 +591,8 @@ - eng - GPL - Peng Huang <shawn.p.huang@gmail.com> -- gb(dvorak) -+ gb -+ dvorak - English (UK, Dvorak) - English (UK, Dvorak) - ibus-keyboard -@@ -530,7 +603,8 @@ - kor - GPL - Peng Huang <shawn.p.huang@gmail.com> -- kr(kr104) -+ kr -+ kr104 - Korean (101/104 key compatible) - Korean (101/104 key compatible) - ibus-keyboard --- -1.8.0 - -From ae98b5a58846e1326550027dc8d2a773ed8a24c5 Mon Sep 17 00:00:00 2001 -From: fujiwarat -Date: Fri, 30 Nov 2012 11:43:43 +0900 -Subject: [PATCH] Fix xmllint errors. - -Review URL: https://codereview.appspot.com/6842115 ---- - conf/dconf/dconf.xml.in.in | 2 +- - conf/gconf/gconf.xml.in.in | 2 +- - conf/memconf/memconf.xml.in.in | 2 +- - ui/gtk3/gtkpanel.xml.in.in | 2 +- - 4 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/conf/dconf/dconf.xml.in.in b/conf/dconf/dconf.xml.in.in -index 0367008..ceb2b0c 100644 ---- a/conf/dconf/dconf.xml.in.in -+++ b/conf/dconf/dconf.xml.in.in -@@ -1,4 +1,4 @@ -- -+ - - - org.freedesktop.IBus.Config -diff --git a/conf/gconf/gconf.xml.in.in b/conf/gconf/gconf.xml.in.in -index 0644d7e..d82179f 100644 ---- a/conf/gconf/gconf.xml.in.in -+++ b/conf/gconf/gconf.xml.in.in -@@ -1,4 +1,4 @@ -- -+ - - - org.freedesktop.IBus.Config -diff --git a/conf/memconf/memconf.xml.in.in b/conf/memconf/memconf.xml.in.in -index b60dbf2..939e40a 100644 ---- a/conf/memconf/memconf.xml.in.in -+++ b/conf/memconf/memconf.xml.in.in -@@ -1,4 +1,4 @@ -- -+ - - org.freedesktop.IBus.Config - On-memory Config Component -diff --git a/ui/gtk3/gtkpanel.xml.in.in b/ui/gtk3/gtkpanel.xml.in.in -index c480bcd..1d2cf73 100644 ---- a/ui/gtk3/gtkpanel.xml.in.in -+++ b/ui/gtk3/gtkpanel.xml.in.in -@@ -1,4 +1,4 @@ -- -+ - - - org.freedesktop.IBus.Panel +diff --git a/setup/main.py b/setup/main.py +index a8acc7a..707faa4 100644 +--- a/setup/main.py ++++ b/setup/main.py +@@ -87,7 +87,7 @@ class Setup(object): + label = 'switch_engine' + variant = self.__config.get_value('general/hotkey', name) + if variant != None: +- shortcuts = variant.dup_strv() ++ shortcuts = variant.unpack() + else: + shortcuts = ['space'] + +-- +1.7.12.1 + +From 62cd0492e3459416e1775aedc327bced53f66828 Mon Sep 17 00:00:00 2001 +From: Rui Matos +Date: Wed, 9 Jan 2013 10:14:55 -0500 +Subject: [PATCH] client: Queue events while the IBus context isn't ready + +There are actually 3 patches here. + +--- +client: Queue events while the IBus context isn't ready + +We may lose events that ought to be processed while the IBus context +isn't ready or if the connection to IBus isn't fully established yet. + +To avoid that, enqueue events to be processed later when the IBus +context creation finishes. + +--- +client: Don't cancel an ongoing create input context on another request + +This would only add more delays. + +--- +client: Cancel any ongoing create input context request on finalize + +BUG= + +Review URL: https://codereview.appspot.com/6988047 +Patch from Rui Matos . +--- + client/gtk2/ibusimcontext.c | 220 ++++++++++++++++++++++++++------------------ + 1 file changed, 133 insertions(+), 87 deletions(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index 011676f..94005b7 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -40,6 +40,8 @@ + # define IDEBUG(a...) + #endif + ++#define MAX_QUEUED_EVENTS 20 ++ + struct _IBusIMContext { + GtkIMContext parent; + +@@ -63,6 +65,7 @@ struct _IBusIMContext { + + /* cancellable */ + GCancellable *cancellable; ++ GQueue *events_queue; + }; + + struct _IBusIMContextClass { +@@ -154,6 +157,8 @@ static GType _ibus_type_im_context = 0; + static GtkIMContextClass *parent_class = NULL; + + static IBusBus *_bus = NULL; ++static guint _daemon_name_watch_id = 0; ++static gboolean _daemon_is_running = FALSE; + + void + ibus_im_context_register_type (GTypeModule *type_module) +@@ -261,6 +266,46 @@ _process_key_event_done (GObject *object, + gdk_event_free ((GdkEvent *)event); + } + ++static gboolean ++_process_key_event (IBusInputContext *context, ++ GdkEventKey *event) ++{ ++ guint state = event->state; ++ gboolean retval = FALSE; ++ ++ if (event->type == GDK_KEY_RELEASE) { ++ state |= IBUS_RELEASE_MASK; ++ } ++ ++ if (_use_sync_mode) { ++ retval = ibus_input_context_process_key_event (context, ++ event->keyval, ++ event->hardware_keycode - 8, ++ state); ++ } ++ else { ++ ibus_input_context_process_key_event_async (context, ++ event->keyval, ++ event->hardware_keycode - 8, ++ state, ++ -1, ++ NULL, ++ _process_key_event_done, ++ gdk_event_copy ((GdkEvent *) event)); ++ ++ retval = TRUE; ++ } ++ ++ if (retval) { ++ event->state |= IBUS_HANDLED_MASK; ++ } ++ else { ++ event->state |= IBUS_IGNORED_MASK; ++ } ++ ++ return retval; ++} ++ + + /* emit "retrieve-surrounding" glib signal of GtkIMContext, if + * context->caps has IBUS_CAP_SURROUNDING_TEXT and the current IBus +@@ -387,38 +432,7 @@ _key_snooper_cb (GtkWidget *widget, + ibusimcontext->time = event->time; + } + +- guint state = event->state; +- if (event->type == GDK_KEY_RELEASE) { +- state |= IBUS_RELEASE_MASK; +- } +- +- if (_use_sync_mode) { +- retval = ibus_input_context_process_key_event ( +- ibuscontext, +- event->keyval, +- event->hardware_keycode - 8, +- state); +- } +- else { +- ibus_input_context_process_key_event_async ( +- ibuscontext, +- event->keyval, +- event->hardware_keycode - 8, +- state, +- -1, +- NULL, +- _process_key_event_done, +- gdk_event_copy ((GdkEvent *) event)); +- retval = TRUE; +- +- } +- +- if (retval) { +- event->state |= IBUS_HANDLED_MASK; +- } +- else { +- event->state |= IBUS_IGNORED_MASK; +- } ++ retval = _process_key_event (ibuscontext, event); + + if (ibusimcontext != NULL) { + /* unref ibusimcontext could call ibus_im_context_finalize here +@@ -450,6 +464,23 @@ _get_boolean_env(const gchar *name, + } + + static void ++daemon_name_appeared (GDBusConnection *connection, ++ const gchar *name, ++ const gchar *owner, ++ gpointer data) ++{ ++ _daemon_is_running = TRUE; ++} ++ ++static void ++daemon_name_vanished (GDBusConnection *connection, ++ const gchar *name, ++ gpointer data) ++{ ++ _daemon_is_running = FALSE; ++} ++ ++static void + ibus_im_context_class_init (IBusIMContextClass *class) + { + IDEBUG ("%s", __FUNCTION__); +@@ -533,6 +564,14 @@ ibus_im_context_class_init (IBusIMContextClass *class) + /* always install snooper */ + if (_key_snooper_id == 0) + _key_snooper_id = gtk_key_snooper_install (_key_snooper_cb, NULL); ++ ++ _daemon_name_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, ++ IBUS_SERVICE_IBUS, ++ G_BUS_NAME_WATCHER_FLAGS_NONE, ++ daemon_name_appeared, ++ daemon_name_vanished, ++ NULL, ++ NULL); + } + + static void +@@ -543,6 +582,8 @@ ibus_im_context_class_fini (IBusIMContextClass *class) + gtk_key_snooper_remove (_key_snooper_id); + _key_snooper_id = 0; + } ++ ++ g_bus_unwatch_name (_daemon_name_watch_id); + } + + /* Copied from gtk+2.0-2.20.1/modules/input/imcedilla.c to fix crosbug.com/11421. +@@ -602,6 +643,7 @@ ibus_im_context_init (GObject *obj) + ibusimcontext->caps = IBUS_CAP_PREEDIT_TEXT | IBUS_CAP_FOCUS; + #endif + ++ ibusimcontext->events_queue = g_queue_new (); + + // Create slave im context + ibusimcontext->slave = gtk_im_context_simple_new (); +@@ -651,6 +693,13 @@ ibus_im_context_finalize (GObject *obj) + + g_signal_handlers_disconnect_by_func (_bus, G_CALLBACK (_bus_connected_cb), obj); + ++ if (ibusimcontext->cancellable != NULL) { ++ /* Cancel any ongoing create input context request */ ++ g_cancellable_cancel (ibusimcontext->cancellable); ++ g_object_unref (ibusimcontext->cancellable); ++ ibusimcontext->cancellable = NULL; ++ } ++ + if (ibusimcontext->ibuscontext) { + ibus_proxy_destroy ((IBusProxy *)ibusimcontext->ibuscontext); + } +@@ -670,6 +719,9 @@ ibus_im_context_finalize (GObject *obj) + pango_attr_list_unref (ibusimcontext->preedit_attrs); + } + ++ g_queue_free_full (ibusimcontext->events_queue, ++ (GDestroyNotify)gdk_event_free); ++ + G_OBJECT_CLASS(parent_class)->finalize (obj); + } + +@@ -681,65 +733,56 @@ ibus_im_context_filter_keypress (GtkIMContext *context, + + IBusIMContext *ibusimcontext = IBUS_IM_CONTEXT (context); + +- if (G_LIKELY (ibusimcontext->ibuscontext && ibusimcontext->has_focus)) { +- /* If context does not have focus, ibus will process key event in sync mode. +- * It is a workaround for increase search in treeview. +- */ +- gboolean retval = FALSE; +- +- if (event->state & IBUS_HANDLED_MASK) +- return TRUE; ++ if (!_daemon_is_running) ++ return gtk_im_context_filter_keypress (ibusimcontext->slave, event); + +- if (event->state & IBUS_IGNORED_MASK) +- return gtk_im_context_filter_keypress (ibusimcontext->slave, event); ++ /* If context does not have focus, ibus will process key event in ++ * sync mode. It is a workaround for increase search in treeview. ++ */ ++ if (!ibusimcontext->has_focus) ++ return gtk_im_context_filter_keypress (ibusimcontext->slave, event); + +- /* XXX it is a workaround for some applications do not set client window. */ +- if (ibusimcontext->client_window == NULL && event->window != NULL) +- gtk_im_context_set_client_window ((GtkIMContext *)ibusimcontext, event->window); ++ if (event->state & IBUS_HANDLED_MASK) ++ return TRUE; + +- _request_surrounding_text (ibusimcontext); ++ if (event->state & IBUS_IGNORED_MASK) ++ return gtk_im_context_filter_keypress (ibusimcontext->slave, event); + +- if (ibusimcontext != NULL) { +- ibusimcontext->time = event->time; +- } ++ /* XXX it is a workaround for some applications do not set client ++ * window. */ ++ if (ibusimcontext->client_window == NULL && event->window != NULL) ++ gtk_im_context_set_client_window ((GtkIMContext *)ibusimcontext, ++ event->window); + +- guint state = event->state; +- if (event->type == GDK_KEY_RELEASE) { +- state |= IBUS_RELEASE_MASK; +- } ++ _request_surrounding_text (ibusimcontext); + +- if (_use_sync_mode) { +- retval = ibus_input_context_process_key_event ( +- ibusimcontext->ibuscontext, +- event->keyval, +- event->hardware_keycode - 8, +- state); +- } +- else { +- ibus_input_context_process_key_event_async ( +- ibusimcontext->ibuscontext, +- event->keyval, +- event->hardware_keycode - 8, +- state, +- -1, +- NULL, +- _process_key_event_done, +- gdk_event_copy ((GdkEvent *) event)); +- retval = TRUE; +- } ++ ibusimcontext->time = event->time; + +- if (retval) { +- event->state |= IBUS_HANDLED_MASK; ++ if (ibusimcontext->ibuscontext) { ++ if (_process_key_event (ibusimcontext->ibuscontext, event)) + return TRUE; +- } +- else { +- event->state |= IBUS_IGNORED_MASK; +- return gtk_im_context_filter_keypress (ibusimcontext->slave, event); +- } ++ else ++ return gtk_im_context_filter_keypress (ibusimcontext->slave, ++ event); + } +- else { +- return gtk_im_context_filter_keypress (ibusimcontext->slave, event); ++ ++ /* At this point we _should_ be waiting for the IBus context to be ++ * created or the connection to IBus to be established. If that's ++ * the case we queue events to be processed when the IBus context ++ * is ready. */ ++ g_return_val_if_fail (ibusimcontext->cancellable != NULL || ++ ibus_bus_is_connected (_bus) == FALSE, ++ FALSE); ++ g_queue_push_tail (ibusimcontext->events_queue, ++ gdk_event_copy ((GdkEvent *)event)); ++ ++ if (g_queue_get_length (ibusimcontext->events_queue) > MAX_QUEUED_EVENTS) { ++ g_warning ("Events queue growing too big, will start to drop."); ++ gdk_event_free ((GdkEvent *) ++ g_queue_pop_head (ibusimcontext->events_queue)); + } ++ ++ return TRUE; + } + + static void +@@ -1482,6 +1525,14 @@ _create_input_context_done (IBusBus *bus, + ibus_input_context_focus_in (ibusimcontext->ibuscontext); + _set_cursor_location_internal (ibusimcontext); + } ++ ++ if (!g_queue_is_empty (ibusimcontext->events_queue)) { ++ GdkEventKey *event; ++ while (event = g_queue_pop_head (ibusimcontext->events_queue)) { ++ _process_key_event (context, event); ++ gdk_event_free ((GdkEvent *)event); ++ } ++ } + } + + g_object_unref (ibusimcontext); +@@ -1494,12 +1545,7 @@ _create_input_context (IBusIMContext *ibusimcontext) + + g_assert (ibusimcontext->ibuscontext == NULL); + +- if (ibusimcontext->cancellable != NULL) { +- /* Cancel previous create input context request */ +- g_cancellable_cancel (ibusimcontext->cancellable); +- g_object_unref (ibusimcontext->cancellable); +- ibusimcontext->cancellable = NULL; +- } ++ g_return_if_fail (ibusimcontext->cancellable == NULL); + + ibusimcontext->cancellable = g_cancellable_new (); + -- 1.8.0 diff --git a/ibus-xx-f17.patch b/ibus-xx-f17.patch new file mode 100644 index 0000000..01bffe3 --- /dev/null +++ b/ibus-xx-f17.patch @@ -0,0 +1,91 @@ +--- ibus-1.5.1/bindings/vala/Makefile.am.orig 2013-01-15 16:58:25.571433690 +0900 ++++ ibus-1.5.1/bindings/vala/Makefile.am 2013-01-15 16:58:46.983455158 +0900 +@@ -20,17 +20,38 @@ + # Free Software Foundation, Inc., 59 Temple Place, Suite 330, + # Boston, MA 02111-1307 USA + +--include $(VAPIGEN_MAKEFILE) ++vapidir = $(datadir)/vala/vapi ++dist_vapi_DATA = \ ++ ibus-@IBUS_API_VERSION@.vapi \ ++ ibus-@IBUS_API_VERSION@.deps \ ++ $(NULL) + ++# Don't rebuild vapi every time gir is updated. ++if ENABLE_LIBGNOMEKBD + vapi_deps = \ +- IBus-1.0.metadata \ +- IBus-1.0-custom.vala \ +- $(top_builddir)/src/IBus-1.0.gir \ ++ $(srcdir)/IBus-1.0.metadata \ ++ $(srcdir)/IBus-1.0-custom.vala \ ++ | \ ++ $(builddir)/gkbd.vapi \ ++ $(top_srcdir)/src/IBus-@IBUS_API_VERSION@.gir \ + $(NULL) ++else ++vapi_deps = \ ++ $(srcdir)/IBus-1.0.metadata \ ++ $(srcdir)/IBus-1.0-custom.vala \ ++ | \ ++ $(top_srcdir)/src/IBus-@IBUS_API_VERSION@.gir \ ++ $(NULL) ++endif + +-if ENABLE_LIBGNOMEKBD +-vapi_deps += $(builddir)/gkbd.vapi ++ibus-@IBUS_API_VERSION@.vapi: $(vapi_deps) ++ $(AM_V_GEN) $(VAPIGEN) --library ibus-@IBUS_API_VERSION@ \ ++ --pkg gio-2.0 \ ++ --metadatadir=$(srcdir) \ ++ $(top_srcdir)/src/IBus-@IBUS_API_VERSION@.gir \ ++ $(srcdir)/IBus-1.0-custom.vala + ++if ENABLE_LIBGNOMEKBD + $(builddir)/gkbd.vapi: + $(AM_V_GEN) $(VAPIGEN) --library gkbd \ + --metadatadir $(srcdir) \ +@@ -39,25 +60,10 @@ $(builddir)/gkbd.vapi: + $(NULL) + endif + +-ibus-1.0.vapi: $(vapi_deps) +- +-VAPIGEN_VAPIS = ibus-1.0.vapi +- +-ibus_1_0_vapi_DEPS = gio-2.0 +-ibus_1_0_vapi_METADATADIRS = $(srcdir) +-ibus_1_0_vapi_FILES = \ +- $(top_builddir)/src/IBus-1.0.gir \ +- $(srcdir)/IBus-1.0-custom.vala \ +- $(NULL) +- +-vapidir = $(datadir)/vala/vapi +-vapi_DATA = $(VAPIGEN_VAPIS) $(VAPIGEN_VAPIS:.vapi=.deps) +- + EXTRA_DIST = \ + Gkbd-3.0.metadata \ + IBus-1.0.metadata \ + IBus-1.0-custom.vala \ +- ibus-1.0.deps \ + config.vapi \ + xi.vapi \ + Xkl-1.0.metadata \ +@@ -65,4 +71,6 @@ EXTRA_DIST = \ + + CLEANFILES = gkbd.vapi + ++MAINTAINERCLEANFILES = ibus-@IBUS_API_VERSION@.vapi ++ + -include $(top_srcdir)/git.mk +--- ibus-1.5.1/setup/keyboardshortcut.py.orig 2013-01-15 17:00:05.093191054 +0900 ++++ ibus-1.5.1/setup/keyboardshortcut.py 2013-01-15 17:00:18.034160760 +0900 +@@ -207,7 +207,7 @@ class KeyboardShortcutSelection(Gtk.VBox + def __set_selected_shortcut(self, shortcut): + model = self.__shortcut_view.get_model() + path, column = self.__shortcut_view.get_cursor() +- model[path[0]][0] = shortcut ++ model[path][0] = shortcut + self.__update_add_and_apply_buttons() + + def __del_selected_shortcut(self): diff --git a/ibus-xx-g-s-disable-preedit.patch b/ibus-xx-g-s-disable-preedit.patch index 6bc62cc..e5c5e36 100644 --- a/ibus-xx-g-s-disable-preedit.patch +++ b/ibus-xx-g-s-disable-preedit.patch @@ -12,10 +12,10 @@ diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c index 584b92d..c4c61d3 100644 --- a/client/gtk2/ibusimcontext.c +++ b/client/gtk2/ibusimcontext.c -@@ -584,6 +584,14 @@ ibus_im_context_init (GObject *obj) - #else - ibusimcontext->caps = IBUS_CAP_PREEDIT_TEXT | IBUS_CAP_FOCUS; - #endif +@@ -645,6 +645,15 @@ ibus_im_context_init (GObject *obj) + + ibusimcontext->events_queue = g_queue_new (); + + if (!g_getenv ("IBUS_GNOME_SHELL_ENABLE_PREEDIT_TEXT")) { + const gchar * prgname = g_get_prgname (); + if (g_strcmp0 (prgname, "gnome-shell") == 0) { @@ -24,9 +24,10 @@ index 584b92d..c4c61d3 100644 + } + } + } - - ++ // Create slave im context + ibusimcontext->slave = gtk_im_context_simple_new (); + gtk_im_context_simple_add_table (GTK_IM_CONTEXT_SIMPLE (ibusimcontext->slave), -- 1.7.10.4 diff --git a/ibus-xx-no-use.diff b/ibus-xx-no-use.diff deleted file mode 100644 index df996c9..0000000 --- a/ibus-xx-no-use.diff +++ /dev/null @@ -1,484 +0,0 @@ -From fdec59545fb94f768c847730854ca03c5af2f652 Mon Sep 17 00:00:00 2001 -From: fujiwarat -Date: Fri, 7 Dec 2012 17:59:49 +0900 -Subject: [PATCH] Disabled to show non-used GUI. - ---- - setup/keyboardshortcut.py | 90 ++++++++++++++++++++++++----------------------- - setup/main.py | 45 +++++++++++++----------- - setup/setup.ui | 51 +++++++++++++++++---------- - 3 files changed, 103 insertions(+), 83 deletions(-) - -diff --git a/setup/keyboardshortcut.py b/setup/keyboardshortcut.py -index 3861d2f..9349e42 100644 ---- a/setup/keyboardshortcut.py -+++ b/setup/keyboardshortcut.py -@@ -103,9 +103,8 @@ class KeyboardShortcutSelection(Gtk.VBox): - self.__modifier_buttons.append(("Hyper", - Gtk.CheckButton.new_with_mnemonic("_Hyper"), - Gdk.ModifierType.HYPER_MASK)) -- self.__modifier_buttons.append(("Capslock", -- Gtk.CheckButton.new_with_mnemonic("Capsloc_k"), -- Gdk.ModifierType.LOCK_MASK)) -+ # is not parsed by gtk_accelerator_parse() -+ # FIXME: Need to check if ibus gtk panel can enable . - self.__modifier_buttons.append(("Release", - Gtk.CheckButton.new_with_mnemonic("_Release"), - Gdk.ModifierType.RELEASE_MASK)) -@@ -119,7 +118,6 @@ class KeyboardShortcutSelection(Gtk.VBox): - table.attach(self.__modifier_buttons[4][1], 0, 1, 1, 2) - table.attach(self.__modifier_buttons[5][1], 1, 2, 1, 2) - table.attach(self.__modifier_buttons[6][1], 2, 3, 1, 2) -- table.attach(self.__modifier_buttons[7][1], 3, 4, 1, 2) - hbox.pack_start(table, True, True, 4) - self.pack_start(hbox, False, True, 4) - -@@ -185,19 +183,20 @@ class KeyboardShortcutSelection(Gtk.VBox): - modifiers.append(name) - if keycode.startswith("_"): - keycode = keycode[1:] -- keys = modifiers + [keycode] -- shortcut = "+".join(keys) -+ shortcut = "".join(map(lambda m: '<' + m + '>', modifiers)) -+ shortcut += keycode - return shortcut - - def __set_shortcut_to_buttons(self, shortcut): -- keys = shortcut.split("+") -- mods = keys[:-1] -+ (keyval, state) = Gtk.accelerator_parse(shortcut) -+ if keyval == 0 and state == 0: -+ return - for name, button, mask in self.__modifier_buttons: -- if name in mods: -+ if state & mask: - button.set_active(True) - else: - button.set_active(False) -- self.__keycode_entry.set_text(keys[-1]) -+ self.__keycode_entry.set_text(shortcut.rsplit('>', 1)[-1]) - - def __get_selected_shortcut(self): - model = self.__shortcut_view.get_model() -@@ -252,49 +251,52 @@ class KeyboardShortcutSelection(Gtk.VBox): - message = _("Please press a key (or a key combination).\nThe dialog will be closed when the key is released.") - dlg.set_markup(message) - dlg.set_title(_("Please press a key (or a key combination)")) -- -- def __key_press_event(d, k, out): -- out.append(k.copy()) -- -- def __key_release_event(d, k, out): -- d.response(Gtk.ResponseType.OK) -- -- dlg.connect("key-press-event", __key_press_event, out) -- dlg.connect("key-release-event", __key_release_event, None) -+ sw = Gtk.ScrolledWindow() -+ -+ def __accel_edited_cb(c, path, keyval, state, keycode): -+ out.append(keyval) -+ out.append(state) -+ out.append(keycode) -+ dlg.response(Gtk.ResponseType.OK) -+ -+ model = Gtk.ListStore(GObject.TYPE_INT, -+ GObject.TYPE_UINT, -+ GObject.TYPE_UINT) -+ accel_view = Gtk.TreeView(model) -+ sw.add(accel_view) -+ column = Gtk.TreeViewColumn() -+ renderer = Gtk.CellRendererAccel(accel_mode=Gtk.CellRendererAccelMode.OTHER, -+ editable=True) -+ renderer.connect('accel-edited', __accel_edited_cb) -+ column.pack_start(renderer, True) -+ column.add_attribute(renderer, 'accel-mods', 0) -+ column.add_attribute(renderer, 'accel-key', 1) -+ column.add_attribute(renderer, 'keycode', 2) -+ accel_view.append_column(column) -+ it = model.append(None) -+ area = dlg.get_message_area() -+ area.pack_end(sw, True, True, 0) -+ sw.show_all() - id = dlg.run() - dlg.destroy() -- if id != Gtk.ResponseType.OK or not out: -+ if id != Gtk.ResponseType.OK or len(out) < 3: - return -- keyevent = out[len(out) - 1] -- state = keyevent.state & (Gdk.ModifierType.CONTROL_MASK | \ -- Gdk.ModifierType.SHIFT_MASK | \ -- Gdk.ModifierType.MOD1_MASK | \ -- Gdk.ModifierType.META_MASK | \ -- Gdk.ModifierType.SUPER_MASK | \ -- Gdk.ModifierType.HYPER_MASK) -- -- -- if state == 0: -- state = state | Gdk.ModifierType.RELEASE_MASK -- elif keyevent.keyval in (Gdk.KEY_Control_L, Gdk.KEY_Control_R) and state == Gdk.ModifierType.CONTROL_MASK: -- state = state | Gdk.ModifierType.RELEASE_MASK -- elif keyevent.keyval in (Gdk.KEY_Shift_L, Gdk.KEY_Shift_R) and state == Gdk.ModifierType.SHIFT_MASK: -- state = state | Gdk.ModifierType.RELEASE_MASK -- elif keyevent.keyval in (Gdk.KEY_Alt_L, Gdk.KEY_Alt_R) and state == Gdk.ModifierType.MOD1_MASK: -- state = state | Gdk.ModifierType.RELEASE_MASK -- elif keyevent.keyval in (Gdk.KEY_Meta_L, Gdk.KEY_Meta_R) and state == Gdk.ModifierType.META_MASK: -- state = state | Gdk.ModifierType.RELEASE_MASK -- elif keyevent.keyval in (Gdk.KEY_Super_L, Gdk.KEY_Super_R) and state == Gdk.ModifierType.SUPER_MASK: -- state = state | Gdk.ModifierType.RELEASE_MASK -- elif keyevent.keyval in (Gdk.KEY_Hyper_L, Gdk.KEY_Hyper_R) and state == Gdk.ModifierType.HYPER_MASK: -- state = state | Gdk.ModifierType.RELEASE_MASK -+ keyval = out[0] -+ state = out[1] -+ keycode = out[2] - - for name, button, mask in self.__modifier_buttons: - if state & mask: - button.set_active(True) - else: - button.set_active(False) -- self.__keycode_entry.set_text(Gdk.keyval_name(keyevent.keyval)) -+ -+ shortcut = Gtk.accelerator_name_with_keycode(None, -+ keyval, -+ keycode, -+ state) -+ shortcut = shortcut.replace('', '') -+ self.__keycode_entry.set_text(shortcut.rsplit('>', 1)[-1]) - - def __add_button_clicked_cb(self, button): - shortcut = self.__get_shortcut_from_buttons() -diff --git a/setup/main.py b/setup/main.py -index 46209b6..aa8e935 100644 ---- a/setup/main.py -+++ b/setup/main.py -@@ -92,22 +92,24 @@ class Setup(object): - self.__init_ui() - - def __init_hotkey(self): -- default_values = { -- "trigger" : (N_("trigger"), ["Control+space"]), -- "enable_unconditional" : (N_("enable"), []), -- "disable_unconditional" : (N_("disable"), []) -- } -- -- values = dict(self.__config.get_values("general/hotkey")) -- -- for name, (label, shortcuts) in default_values.items(): -- shortcuts = values.get(name, shortcuts) -- button = self.__builder.get_object("button_%s" % name) -- entry = self.__builder.get_object("entry_%s" % name) -- entry.set_text("; ".join(shortcuts)) -- entry.set_tooltip_text("\n".join(shortcuts)) -- button.connect("clicked", self.__shortcut_button_clicked_cb, -- label, "general/hotkey", name, entry) -+ name = 'trigger_accel' -+ label = 'switch_engine' -+ variant = self.__config.get_value('general/hotkey', name) -+ if variant != None: -+ shortcuts = variant.unpack() -+ else: -+ shortcuts = ['space'] -+ -+ button = self.__builder.get_object("button_%s" % label) -+ entry = self.__builder.get_object("entry_%s" % label) -+ entry.set_text("; ".join(shortcuts)) -+ tooltip = "\n".join(shortcuts) -+ tooltip += "\n" + \ -+ _("Use shortcut with shift to switch to the previous input method") -+ -+ entry.set_tooltip_text(tooltip) -+ button.connect("clicked", self.__shortcut_button_clicked_cb, -+ name, "general/hotkey", label, entry) - - def __init_panel(self): - values = dict(self.__config.get_values("panel")) -@@ -449,7 +451,8 @@ class Setup(object): - def __shortcut_button_clicked_cb(self, button, name, section, _name, entry): - buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, - Gtk.STOCK_OK, Gtk.ResponseType.OK) -- title = _("Select keyboard shortcut for %s") % _(name) -+ title = _("Select keyboard shortcut for %s") % \ -+ _("switching input methods") - dialog = keyboardshortcut.KeyboardShortcutSelectionDialog(buttons = buttons, title = title) - text = entry.get_text() - if text: -@@ -462,11 +465,13 @@ class Setup(object): - dialog.destroy() - if id != Gtk.ResponseType.OK: - return -- self.__config.set_value(section, _name, GLib.Variant.new_strv(shortcuts)) -+ self.__config.set_value(section, name, GLib.Variant.new_strv(shortcuts)) - text = "; ".join(shortcuts) - entry.set_text(text) -- entry.set_tooltip_text(text) -- -+ tooltip = "\n".join(shortcuts) -+ tooltip += "\n" + \ -+ _("Use shortcut with shift to switch to the previous input method") -+ entry.set_tooltip_text(tooltip) - - def __item_started_column_toggled_cb(self, cell, path_str, model): - -diff --git a/setup/setup.ui b/setup/setup.ui -index 2026172..aa41453 100644 ---- a/setup/setup.ui -+++ b/setup/setup.ui -@@ -121,8 +121,7 @@ - - - -- True -- False -+ True - False - The shortcut keys for switching to previous input method in the list - 0 -@@ -137,7 +136,7 @@ - - - -- True -+ True - False - 6 - -@@ -172,6 +171,7 @@ - - 1 - 2 -+ GTK_FILL - - - -@@ -180,7 +180,7 @@ - False - 6 - -- -+ - True - True - False -@@ -192,7 +192,7 @@ - - - -- -+ - ... - False - True -@@ -213,17 +213,17 @@ - 2 - 3 - 4 -+ GTK_FILL - - - - -- True -+ True - False - 6 - - -- True -- False -+ True - True - False - -@@ -237,8 +237,7 @@ - - ... - False -- True -- False -+ True - True - False - False -@@ -256,11 +255,12 @@ - 2 - 4 - 5 -+ GTK_FILL - - - - -- True -+ True - False - The shortcut keys for turning input method on or off - 0 -@@ -273,7 +273,7 @@ - - - -- True -+ True - False - 0 - Enable: -@@ -287,7 +287,7 @@ - - - -- True -+ True - False - 6 - -@@ -324,11 +324,12 @@ - 2 - 1 - 2 -+ GTK_FILL - - - - -- True -+ True - False - 0 - Disable: -@@ -342,7 +343,7 @@ - - - -- True -+ True - False - 6 - -@@ -379,6 +380,7 @@ - 2 - 2 - 3 -+ GTK_FILL - - - -@@ -431,6 +433,7 @@ - - - GTK_FILL -+ GTK_FILL - - - -@@ -448,11 +451,12 @@ - - 1 - 2 -+ GTK_FILL - - - - -- True -+ True - False - Set the behavior of ibus how to show or hide language bar - 0 -@@ -463,6 +467,7 @@ - 1 - 2 - GTK_FILL -+ GTK_FILL - - - -@@ -477,11 +482,12 @@ - 2 - 3 - GTK_FILL -+ GTK_FILL - - - - -- True -+ True - False - model_panel_show_mode - -@@ -496,6 +502,7 @@ - 2 - 1 - 2 -+ GTK_FILL - - - -@@ -515,6 +522,7 @@ - 2 - 2 - 3 -+ GTK_FILL - - - -@@ -534,13 +542,14 @@ - 3 - 4 - GTK_FILL -+ GTK_FILL - - - - - Show input method name on language bar - False -- True -+ True - True - False - Show input method's name on language bar when check the checkbox -@@ -553,6 +562,7 @@ - 4 - 5 - GTK_FILL -+ GTK_FILL - - - -@@ -572,6 +582,7 @@ - 5 - 6 - GTK_FILL -+ GTK_FILL - - - -@@ -590,6 +601,7 @@ - 6 - 7 - GTK_FILL -+ GTK_FILL - - - -@@ -605,6 +617,7 @@ - 2 - 6 - 7 -+ GTK_FILL - - - -@@ -1001,7 +1014,7 @@ You may use up/down buttons to change it.</i></small> - - - -- True -+ True - False - 0 - none --- -1.8.0 - diff --git a/ibus-xx-setup-frequent-lang.patch b/ibus-xx-setup-frequent-lang.patch index beddad3..d8d7b4b 100644 --- a/ibus-xx-setup-frequent-lang.patch +++ b/ibus-xx-setup-frequent-lang.patch @@ -1,6 +1,6 @@ -From 58d4c946db3396897f36f71d33e939dfbbf0ebed Mon Sep 17 00:00:00 2001 +From 7c4c048bd5aceb15d44042c72ff931d0c05d440f Mon Sep 17 00:00:00 2001 From: fujiwarat -Date: Tue, 27 Nov 2012 15:53:34 +0900 +Date: Fri, 11 Jan 2013 23:04:53 +0900 Subject: [PATCH] Enable ibus-setup to show the frequently used languages only in IME list. @@ -11,10 +11,10 @@ Subject: [PATCH] Enable ibus-setup to show the frequently used languages 3 files changed, 300 insertions(+), 24 deletions(-) diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in -index 64f6f33..23739af 100644 +index 7833959..72bcc72 100644 --- a/data/ibus.schemas.in +++ b/data/ibus.schemas.in -@@ -348,6 +348,174 @@ se,si,sk,sy,sy(ku),th,tj,tr,ua,uz,vn +@@ -325,6 +325,174 @@ se,si,sk,sy,sy(ku),th,tj,tr,ua,uz,vn @@ -190,7 +190,7 @@ index 64f6f33..23739af 100644 /desktop/ibus/panel/custom_font ibus diff --git a/setup/enginecombobox.py b/setup/enginecombobox.py -index f80b164..578098c 100644 +index 0f8a6ae..9828ee6 100644 --- a/setup/enginecombobox.py +++ b/setup/enginecombobox.py @@ -45,6 +45,9 @@ class EngineComboBox(Gtk.ComboBox): @@ -362,7 +362,7 @@ index f80b164..578098c 100644 else: renderer.set_property("visible", True) renderer.set_property("sensitive", True) -@@ -124,7 +215,8 @@ class EngineComboBox(Gtk.ComboBox): +@@ -119,7 +210,8 @@ class EngineComboBox(Gtk.ComboBox): renderer.set_property("pixbuf", pixbuf) def __name_cell_data_cb(self, celllayout, renderer, model, iter, data): @@ -372,7 +372,7 @@ index f80b164..578098c 100644 if isinstance (engine, str) or isinstance (engine, unicode): renderer.set_property("sensitive", False) -@@ -132,8 +224,15 @@ class EngineComboBox(Gtk.ComboBox): +@@ -127,8 +219,15 @@ class EngineComboBox(Gtk.ComboBox): renderer.set_property("weight", Pango.Weight.NORMAL) elif isinstance(engine, int): renderer.set_property("sensitive", True) @@ -390,7 +390,7 @@ index f80b164..578098c 100644 else: renderer.set_property("sensitive", True) renderer.set_property("text", engine.get_longname()) -@@ -149,10 +248,18 @@ class EngineComboBox(Gtk.ComboBox): +@@ -144,10 +243,18 @@ class EngineComboBox(Gtk.ComboBox): if i == 0 or i == -1: return None iter = self.get_active_iter() @@ -411,17 +411,17 @@ index f80b164..578098c 100644 return self.get_property("active-engine") diff --git a/setup/main.py b/setup/main.py -index 5da6340..d6fa3ef 100644 +index aae6bb9..ded85c0 100644 --- a/setup/main.py +++ b/setup/main.py -@@ -224,6 +224,7 @@ class Setup(object): - engines.append(engine) - +@@ -207,6 +207,7 @@ class Setup(object): + # init engine page + self.__engines = self.__bus.list_engines() self.__combobox = self.__builder.get_object("combobox_engines") + self.__combobox.set_config(self.__config) - self.__combobox.set_engines(engines) + self.__combobox.set_engines(self.__engines) - engine_names = values.get("preload_engines", []) + tmp_dict = {} -- 1.8.0 diff --git a/ibus.spec b/ibus.spec index c981569..02958f5 100644 --- a/ibus.spec +++ b/ibus.spec @@ -17,7 +17,7 @@ %global with_gkbd 1 %endif -%global ibus_gjs_version 3.4.1.20120815 +%global ibus_gjs_version 3.4.1.20130115 %global ibus_api_version 1.0 @@ -32,12 +32,10 @@ %endif %global dbus_python_version 0.83.0 -# FIXME: It's better to use the new icon names -%global gnome_icon_theme_legacy_version 2.91.6 Name: ibus -Version: 1.4.99.20121109 -Release: 9%{?dist} +Version: 1.5.1 +Release: 1%{?dist} Summary: Intelligent Input Bus for Linux OS License: LGPLv2+ Group: System Environment/Libraries @@ -48,10 +46,6 @@ Source1: %{name}-xinput # ibus-gjs Source2: http://fujiwara.fedorapeople.org/ibus/gnome-shell/%{name}-gjs-%{ibus_gjs_version}.tar.gz %endif -%if (0%{?fedora} < 19 && 0%{?rhel} < 7) -# Upstreamed translations. -Source3: http://fujiwara.fedorapeople.org/ibus/po/%{name}-po-1.4.99.20121207.tar.gz -%endif # Upstreamed patches. Patch0: %{name}-HEAD.patch # https://bugzilla.redhat.com/show_bug.cgi?id=810211 @@ -68,8 +62,10 @@ Patch4: %{name}-xx-setup-frequent-lang.patch # https://bugzilla.gnome.org/show_bug.cgi?id=658420 Patch92: %{name}-xx-g-s-disable-preedit.patch %endif -# Hide no nused properties in f17. -Patch94: %{name}-xx-no-use.diff +%if (0%{?fedora} < 18 && 0%{?rhel} < 7) +# The patch enables to build on fedora 17. +Patch93: %{name}-xx-f17.patch +%endif BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -91,6 +87,7 @@ BuildRequires: vala-tools BuildRequires: GConf2-devel %if %with_pygobject3 BuildRequires: gobject-introspection-devel +BuildRequires: pygobject3-devel %endif BuildRequires: intltool BuildRequires: iso-codes-devel @@ -132,7 +129,6 @@ Requires: notify-python Requires: libgnomekbd %endif Requires: librsvg2 -Requires: gnome-icon-theme-legacy >= %{gnome_icon_theme_legacy_version} %if (0%{?fedora} <= 17 && 0%{?rhel} < 7) Requires: gnome-icon-theme-symbolic %endif @@ -230,9 +226,6 @@ The ibus-devel-docs package contains developer documentation for ibus %if %with_gjs gzip -dc %SOURCE2 | tar xf - %endif -%if (0%{?fedora} < 19 && 0%{?rhel} < 7) -gzip -dc %SOURCE3 | tar xf - -%endif # home [dot] corp [dot] redhat [dot] com/wiki/rpmdiff-multilib # Update timestamps on the files touched by a patch, to avoid non-equal @@ -270,8 +263,10 @@ UpdateTimestamps -p1 %{PATCH3} %patch4 -p1 -b .setup-frequent-lang UpdateTimestamps -p1 %{PATCH4} -%patch94 -p1 -b .no-used -UpdateTimestamps -p1 %{PATCH94} +%if (0%{?fedora} < 18 && 0%{?rhel} < 7) +%patch93 -p1 -b .f17 +UpdateTimestamps -p1 %{PATCH93} +%endif %build %if %with_xkbfile @@ -285,17 +280,12 @@ autoreconf -f -i --enable-gtk-doc \ --with-no-snooper-apps='gnome-do,Do.*,firefox.*,.*chrome.*,.*chromium.*' \ --enable-surrounding-text \ -%if (0%{?fedora} > 17 || 0%{?rhel} > 6) - --with-panel-icon-keyboard=legacy \ -%endif -%if %with_xkbfile - --with-xkb-command=ibus-xkb \ +%if (0%{?fedora} <= 17 && 0%{?rhel} < 7) + --with-panel-icon-keyboard=yes \ %endif %if %with_gkbd --enable-libgnomekbd \ %endif - --enable-dconf \ - --disable-gconf \ %if %with_pygobject2 --enable-python-library \ %endif @@ -448,10 +438,8 @@ fi %{_sysconfdir}/bash_completion.d/ibus.bash %{_sysconfdir}/dconf/db/ibus.d %{_sysconfdir}/dconf/profile/ibus +%python2_sitearch/gi/overrides/IBus.py* %config %{_xinputconf} -%if %with_xkbfile -%{_libexecdir}/ibus-xkb -%endif %files libs %{_libdir}/libibus-%{ibus_api_version}.so.* @@ -483,6 +471,11 @@ fi %{_datadir}/gtk-doc/html/* %changelog +* Tue Jan 08 2013 Takao Fujiwara - 1.5.1-1 +- Bumped to 1.5.1 +- Bumped to ibus-gjs 3.4.1.20130115 for f17 +- Removed ibus-xx-no-use.diff + * Fri Dec 14 2012 Takao Fujiwara - 1.4.99.20121109-9 - Updated ibus-xx-no-use.diff not to use variant.dup_strv() diff --git a/sources b/sources index aa61f95..ce31a01 100644 --- a/sources +++ b/sources @@ -1,4 +1,3 @@ -be482479357210283e91a47f43a0a0fe ibus-1.4.99.20121109.tar.gz +f0103201249c657712f5f4d9a36923ed ibus-1.5.1.tar.gz 2d2ad58e3e41429dbd883ba7e501c9b2 ibus-gjs-3.2.1.20111230.tar.gz -8acf4ac4d1a7dfb9a0af9e755a8e7dba ibus-gjs-3.4.1.20120815.tar.gz -e2a13c45eea2cdb86572bbccec7a2e16 ibus-po-1.4.99.20121207.tar.gz +da9a22c82ab33423d7afeb3da4146fa8 ibus-gjs-3.4.1.20130115.tar.gz