[ibus] Bumped to 1.4.99.20120712
Takao Fujiwara
fujiwara at fedoraproject.org
Tue Jul 17 11:08:50 UTC 2012
commit db31e528307a958d02b7d718baf339b634e067e8
Author: Takao Fujiwara <tfujiwar at redhat.com>
Date: Tue Jul 17 19:27:02 2012 +0900
Bumped to 1.4.99.20120712
.gitignore | 1 +
ibus-530711-preload-sys.patch | 41 +-
ibus-541492-xkb.patch | 2296 +++++++++++++++++++-----------------
ibus-HEAD.patch | 318 +++++-
ibus-xx-branding-switcher-ui.patch | 213 ----
ibus-xx-f18-build.patch | 11 +
ibus-xx-g-s-disable-preedit.patch | 12 +-
ibus-xx-no-use.diff | 89 +-
ibus-xx-setup-frequent-lang.patch | 27 +-
ibus.spec | 37 +-
sources | 2 +-
11 files changed, 1673 insertions(+), 1374 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 75dcfec..b7b95c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@ ibus-1.3.6.tar.gz
/ibus-1.4.99.20120304.tar.gz
/ibus-1.4.99.20120317.tar.gz
/ibus-1.4.99.20120428.tar.gz
+/ibus-1.4.99.20120712.tar.gz
/ibus-gjs-3.0.2.20110823.tar.gz
/ibus-gjs-3.1.4.20110823.tar.gz
/ibus-gjs-3.0.2.20110908.tar.gz
diff --git a/ibus-530711-preload-sys.patch b/ibus-530711-preload-sys.patch
index 4e6b847..05ae8e7 100644
--- a/ibus-530711-preload-sys.patch
+++ b/ibus-530711-preload-sys.patch
@@ -1,6 +1,6 @@
-From f580050ab5612e1841639949781802dc6ee50fa1 Mon Sep 17 00:00:00 2001
+From 9be5aced5397e3558870e4aa1a446e1aacc1730c Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Sat, 28 Apr 2012 13:07:57 +0900
+Date: Tue, 17 Jul 2012 17:43:03 +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,
@@ -19,13 +19,13 @@ IBUS_PRELOAD_ENGINE_MODE_USER and users can customize the value
---
data/ibus.schemas.in | 24 +++++++++
setup/main.py | 61 ++++++++++++++++++++--
- setup/setup.ui | 21 ++++++--
+ setup/setup.ui | 22 ++++++--
src/ibustypes.h | 10 ++++
ui/gtk3/panel.vala | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++
- 5 files changed, 245 insertions(+), 7 deletions(-)
+ 5 files changed, 246 insertions(+), 7 deletions(-)
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
-index 5e6c2d7..20c1bc3 100644
+index 3591687..0d127d5 100644
--- a/data/ibus.schemas.in
+++ b/data/ibus.schemas.in
@@ -2,6 +2,30 @@
@@ -60,7 +60,7 @@ index 5e6c2d7..20c1bc3 100644
<applyto>/desktop/ibus/general/preload_engines</applyto>
<owner>ibus</owner>
diff --git a/setup/main.py b/setup/main.py
-index 4f57106..7612407 100644
+index f3fe1c5..b7833e3 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -181,6 +181,20 @@ class Setup(object):
@@ -160,12 +160,12 @@ index 4f57106..7612407 100644
def __config_reloaded_cb(self, bus):
pass
diff --git a/setup/setup.ui b/setup/setup.ui
-index e37cb32..fec1646 100644
+index 8121d62..2026172 100644
--- a/setup/setup.ui
+++ b/setup/setup.ui
-@@ -585,7 +585,22 @@
+@@ -653,7 +653,23 @@
<property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkCheckButton" id="checkbutton_preload_engine_mode">
@@ -179,27 +179,28 @@ index e37cb32..fec1646 100644
+ </object>
+ <packing>
+ <property name="expand">False</property>
++ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox_customize_active_input_methods">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
- <object class="GtkAlignment" id="alignment6">
-@@ -752,7 +767,7 @@
- </child>
- </object>
+@@ -842,7 +858,7 @@
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
-@@ -791,7 +806,7 @@ You may use up/down buttons to change it.</i></small></property>
- </object>
+@@ -889,7 +905,7 @@ You may use up/down buttons to change it.</i></small></property>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
@@ -227,10 +228,10 @@ index d916265..422eb84 100644
* @x: x coordinate.
* @y: y coordinate.
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
-index c08f188..1adb78b 100644
+index 2ecd48b..24acd4c 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
-@@ -215,6 +215,8 @@ class Panel : IBus.PanelService {
+@@ -279,6 +279,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,7 +240,7 @@ index c08f188..1adb78b 100644
m_config.watch("general", "engines_order");
m_config.watch("panel", "custom_font");
m_config.watch("panel", "use_custom_font");
-@@ -274,7 +276,136 @@ class Panel : IBus.PanelService {
+@@ -338,7 +340,136 @@ class Panel : IBus.PanelService {
init_gkbd();
}
@@ -376,7 +377,7 @@ index c08f188..1adb78b 100644
}
private void update_xkb_engines() {
-@@ -449,6 +580,11 @@ class Panel : IBus.PanelService {
+@@ -499,6 +630,11 @@ class Panel : IBus.PanelService {
string section,
string name,
Variant variant) {
@@ -389,5 +390,5 @@ index c08f188..1adb78b 100644
update_engines(variant, null);
return;
--
-1.7.10
+1.7.10.4
diff --git a/ibus-541492-xkb.patch b/ibus-541492-xkb.patch
index c419dbd..cd570ed 100644
--- a/ibus-541492-xkb.patch
+++ b/ibus-541492-xkb.patch
@@ -1,37 +1,39 @@
-From 8115592c491ed0bfd60df15d109dda2d7ae1dbc0 Mon Sep 17 00:00:00 2001
+From 184f68d12049e8554fe7e44d1ca1b53f0f391f07 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Wed, 9 May 2012 19:23:11 +0900
+Date: Tue, 17 Jul 2012 17:42:49 +0900
Subject: [PATCH] Add ibus-xkb and libgnomekbd.
---
- client/x11/gdk-private.c | 3 +-
- configure.ac | 59 +++++
- data/ibus.schemas.in | 102 ++++++++
- engine/Makefile.am | 20 ++
- engine/ibus-xkb-main.c | 111 +++++++++
- engine/main.vala | 86 +++++++
- engine/simple.xml.in.in | 531 +---------------------------------------
- engine/xkblib.c | 327 +++++++++++++++++++++++++
- engine/xkblib.h | 41 ++++
- ibus-1.0.pc.in | 4 +
- setup/main.py | 25 +-
- src/Makefile.am | 5 +
- src/ibus.h | 1 +
- src/ibusxkbxml.c | 466 +++++++++++++++++++++++++++++++++++
- src/ibusxkbxml.h | 187 ++++++++++++++
- ui/gtk3/Gkbd-3.0.metadata | 1 +
- ui/gtk3/Makefile.am | 48 ++++
- ui/gtk3/Xkl-1.0.metadata | 3 +
- ui/gtk3/gkbdlayout.vala.false | 63 +++++
- ui/gtk3/gkbdlayout.vala.true | 111 +++++++++
- ui/gtk3/keybindingmanager.vala | 4 +
- ui/gtk3/panel.vala | 279 +++++++++++++++++++--
- ui/gtk3/switcher.vala | 53 +++-
- ui/gtk3/xkblayout.vala | 466 +++++++++++++++++++++++++++++++++++
- 24 files changed, 2433 insertions(+), 563 deletions(-)
- create mode 100644 engine/ibus-xkb-main.c
- create mode 100644 engine/xkblib.c
- create mode 100644 engine/xkblib.h
+ client/x11/gdk-private.c | 3 +-
+ configure.ac | 60 +++++
+ data/ibus.schemas.in | 102 ++++++++
+ engine/Makefile.am | 6 +
+ engine/ibus-xkb/Makefile.am | 64 +++++
+ engine/ibus-xkb/ibus-xkb-main.c | 111 ++++++++
+ engine/ibus-xkb/xkblib.c | 327 ++++++++++++++++++++++++
+ engine/ibus-xkb/xkblib.h | 41 +++
+ engine/main.vala | 86 +++++++
+ engine/simple.xml.in.in | 531 +--------------------------------------
+ ibus-1.0.pc.in | 4 +
+ ibus.spec.in | 12 +
+ setup/main.py | 25 +-
+ src/Makefile.am | 5 +
+ src/ibus.h | 1 +
+ src/ibusxkbxml.c | 466 ++++++++++++++++++++++++++++++++++
+ src/ibusxkbxml.h | 187 ++++++++++++++
+ ui/gtk3/Gkbd-3.0.metadata | 1 +
+ ui/gtk3/Makefile.am | 48 ++++
+ ui/gtk3/Xkl-1.0.metadata | 3 +
+ ui/gtk3/gkbdlayout.vala.false | 63 +++++
+ ui/gtk3/gkbdlayout.vala.true | 111 ++++++++
+ ui/gtk3/panel.vala | 356 ++++++++++++++++++++++----
+ ui/gtk3/switcher.vala | 47 ++--
+ ui/gtk3/xkblayout.vala | 466 ++++++++++++++++++++++++++++++++++
+ 25 files changed, 2518 insertions(+), 608 deletions(-)
+ 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/Gkbd-3.0.metadata
@@ -55,7 +57,7 @@ index 009a5b0..20689c3 100644
#endif
diff --git a/configure.ac b/configure.ac
-index 8498efe..731cdf5 100644
+index 8498efe..2204715 100644
--- a/configure.ac
+++ b/configure.ac
@@ -252,6 +252,63 @@ else
@@ -122,7 +124,15 @@ index 8498efe..731cdf5 100644
# GObject introspection
GOBJECT_INTROSPECTION_CHECK([0.6.8])
-@@ -574,5 +631,7 @@ Build options:
+@@ -514,6 +571,7 @@ src/ibusversion.h
+ src/tests/Makefile
+ bus/Makefile
+ engine/Makefile
++engine/ibus-xkb/Makefile
+ engine/simple.xml.in
+ util/Makefile
+ util/IMdkit/Makefile
+@@ -574,5 +632,7 @@ Build options:
Panel icon "$IBUS_ICON_KEYBOARD"
Enable surrounding-text $enable_surrounding_text
Run test cases $enable_tests
@@ -131,10 +141,63 @@ index 8498efe..731cdf5 100644
])
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
-index 53ba05c..5e6c2d7 100644
+index 53ba05c..3591687 100644
--- a/data/ibus.schemas.in
+++ b/data/ibus.schemas.in
-@@ -34,6 +34,62 @@
+@@ -26,6 +26,52 @@
+ </locale>
+ </schema>
+ <schema>
++ <key>/schemas/desktop/ibus/general/use_xmodmap</key>
++ <applyto>/desktop/ibus/general/use_xmodmap</applyto>
++ <owner>ibus</owner>
++ <type>bool</type>
++ <default>true</default>
++ <locale name="C">
++ <short>Use xmodmap</short>
++ <long>Run xmodmap if .xmodmap/.Xmodmap exists.</long>
++ </locale>
++ </schema>
++ <schema>
++ <key>/schemas/desktop/ibus/general/xkb_latin_layouts</key>
++ <applyto>/desktop/ibus/general/xkb_latin_layouts</applyto>
++ <owner>ibus</owner>
++ <type>list</type>
++ <list_type>string</list_type>
++ <default>[ara,bg,cz,dev,gr,gur,in,jp(kana),mal,mkd,ru,ua]</default>
++ <locale name="C">
++ <short>Latin layout which have no ASCII</short>
++ <long>us layout is appended to the latin layouts. variant is not needed.</long>
++ </locale>
++ </schema>
++ <schema>
++ <key>/schemas/desktop/ibus/general/load_xkb_layouts</key>
++ <applyto>/desktop/ibus/general/load_xkb_layouts</applyto>
++ <owner>ibus</owner>
++ <type>list</type>
++ <list_type>string</list_type>
++ <default>[us,us(chr),us(dvorak),ad,al,am,ara,az,ba,bd,be,bg,br,bt,by,
++de,dk,ca,ch,cn(tib),cz,ee,epo,es,et,fi,fo,fr,
++gb,ge,ge(dsb),ge(ru),ge(os),gh,gh(akan),gh(ewe),gh(fula),gh(ga),gh(hausa),
++gn,gr,hu,hr,ie,ie(CloGaelach),il,
++in,
++in(tel),in(bolnagri),iq,iq(ku),ir,ir(ku),is,it,jp,
++kg,kh,kz,la,latam,lk,lk(tam_unicode),lt,lv,ma,ma(tifinagh),mal,mao,
++me,mk,mm,mt,mv,ng,ng(hausa),ng,ng(igbo),ng(yoruba),nl,no,no(smi),np,
++pk,pl,pl(csb),pt,ro,rs,ru,ru(cv),ru(kom),ru(sah),ru(tt),ru(xal),
++se,si,sk,sy,sy(ku),th,tj,tr,ua,uz,vn
++]</default>
++ <locale name="C">
++ <short>XKB layout list which is shown on ibus-setup</short>
++ <long>XKB layout list which is shown on ibus-setup.
++ The format is "layout" or "layout(variant)".</long>
++ </locale>
++ </schema>
++ <schema>
+ <key>/schemas/desktop/ibus/general/hotkey/trigger</key>
+ <applyto>/desktop/ibus/general/hotkey/trigger</applyto>
+ <owner>ibus</owner>
+@@ -34,6 +80,62 @@
<default>[Control+space,Zenkaku_Hankaku,Alt+Kanji,Alt+grave,Hangul,Alt+Release+Alt_R]</default>
<locale name="C">
<short>Trigger shortcut keys</short>
@@ -197,95 +260,98 @@ index 53ba05c..5e6c2d7 100644
<long>The shortcut keys for turning input method on or off</long>
</locale>
</schema>
-@@ -203,6 +259,52 @@
- </locale>
- </schema>
- <schema>
-+ <key>/schemas/desktop/ibus/general/use_xmodmap</key>
-+ <applyto>/desktop/ibus/general/use_xmodmap</applyto>
-+ <owner>ibus</owner>
-+ <type>bool</type>
-+ <default>true</default>
-+ <locale name="C">
-+ <short>Use xmodmap</short>
-+ <long>Run xmodmap if .xmodmap/.Xmodmap exists.</long>
-+ </locale>
-+ </schema>
-+ <schema>
-+ <key>/schemas/desktop/ibus/general/xkb_latin_layouts</key>
-+ <applyto>/desktop/ibus/general/xkb_latin_layouts</applyto>
-+ <owner>ibus</owner>
-+ <type>list</type>
-+ <list_type>string</list_type>
-+ <default>[ara,bg,cz,dev,gr,gur,in,jp(kana),mal,mkd,ru,ua]</default>
-+ <locale name="C">
-+ <short>Latin layout which have no ASCII</short>
-+ <long>us layout is appended to the latin layouts. variant is not needed.</long>
-+ </locale>
-+ </schema>
-+ <schema>
-+ <key>/schemas/desktop/ibus/general/load_xkb_layouts</key>
-+ <applyto>/desktop/ibus/general/load_xkb_layouts</applyto>
-+ <owner>ibus</owner>
-+ <type>list</type>
-+ <list_type>string</list_type>
-+ <default>[us,us(chr),us(dvorak),ad,al,am,ara,az,ba,bd,be,bg,br,bt,by,
-+de,dk,ca,ch,cn(tib),cz,ee,epo,es,et,fi,fo,fr,
-+gb,ge,ge(dsb),ge(ru),ge(os),gh,gh(akan),gh(ewe),gh(fula),gh(ga),gh(hausa),
-+gn,gr,hu,hr,ie,ie(CloGaelach),il,
-+in,
-+in(tel),in(bolnagri),iq,iq(ku),ir,ir(ku),is,it,jp,
-+kg,kh,kz,la,latam,lk,lk(tam_unicode),lt,lv,ma,ma(tifinagh),mal,mao,
-+me,mk,mm,mt,mv,ng,ng(hausa),ng,ng(igbo),ng(yoruba),nl,no,no(smi),np,
-+pk,pl,pl(csb),pt,ro,rs,ru,ru(cv),ru(kom),ru(sah),ru(tt),ru(xal),
-+se,si,sk,sy,sy(ku),th,tj,tr,ua,uz,vn
-+]</default>
-+ <locale name="C">
-+ <short>XKB layout list which is shown on ibus-setup</short>
-+ <long>XKB layout list which is shown on ibus-setup.
-+ The format is "layout" or "layout(variant)".</long>
-+ </locale>
-+ </schema>
-+ <schema>
- <key>/schemas/desktop/ibus/panel/use_custom_font</key>
- <applyto>/desktop/ibus/panel/use_custom_font</applyto>
- <owner>ibus</owner>
diff --git a/engine/Makefile.am b/engine/Makefile.am
-index b3b46be..a95736b 100644
+index b3b46be..7a806fc 100644
--- a/engine/Makefile.am
+++ b/engine/Makefile.am
-@@ -78,6 +78,26 @@ component_DATA = \
+@@ -22,6 +22,12 @@
- componentdir = $(pkgdatadir)/component
+ libibus = $(top_builddir)/src/libibus- at IBUS_API_VERSION@.la
++SUBDIRS =
++
+if ENABLE_XKB
-+libexec_PROGRAMS += 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..65ede37
+--- /dev/null
++++ b/engine/ibus-xkb/Makefile.am
+@@ -0,0 +1,64 @@
++# vim:set noet ts=4:
++#
++# ibus - The Input Bus
++#
++# Copyright (c) 2012 Takao Fujiwara <takao.fujiwara1 at gmail.com>
++# 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- at 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)
++
++AM_LDADD = \
++ $(NULL)
++
++libexec_PROGRAMS = ibus-xkb
++
+ibus_xkb_SOURCES = \
-+ ibus-xkb-main.c \
-+ xkblib.h \
-+ xkblib.c \
-+ $(NULL)
++ ibus-xkb-main.c \
++ xkblib.h \
++ xkblib.c \
++ $(NULL)
+ibus_xkb_CFLAGS = \
-+ @XKB_CFLAGS@ \
-+ @X11_CFLAGS@ \
-+ @GLIB2_CFLAGS@ \
-+ $(NULL)
++ @XKB_CFLAGS@ \
++ @X11_CFLAGS@ \
++ @GLIB2_CFLAGS@ \
++ $(NULL)
+ibus_xkb_LDADD = \
-+ @XKB_LIBS@ \
-+ @X11_LIBS@ \
-+ @GLIB2_LIBS@ \
-+ $(libibus) \
-+ $(NULL)
-+endif
++ @XKB_LIBS@ \
++ @X11_LIBS@ \
++ @GLIB2_LIBS@ \
++ $(libibus) \
++ $(NULL)
+
- CLEANFILES = \
- simple.xml \
- $(NULL)
-diff --git a/engine/ibus-xkb-main.c b/engine/ibus-xkb-main.c
++$(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..2529e4d
--- /dev/null
-+++ b/engine/ibus-xkb-main.c
++++ b/engine/ibus-xkb/ibus-xkb-main.c
@@ -0,0 +1,111 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+/* vim:set et sts=4: */
@@ -398,833 +464,189 @@ index 0000000..2529e4d
+
+ return 0;
+}
-diff --git a/engine/main.vala b/engine/main.vala
-index e1fd129..377fa2f 100644
---- a/engine/main.vala
-+++ b/engine/main.vala
-@@ -21,6 +21,85 @@
- */
-
- using IBus;
-+using GLib;
+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 <takao.fujiwara1 at gmail.com>
++ * Copyright (C) 2012 Peng Huang <shawn.p.huang at gmail.com>
++ * 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 <config.h>
++#endif
+
-+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;
++#include <glib.h>
++#include <X11/Xlib.h>
++#include <X11/Xatom.h>
++#include <X11/XKBlib.h>
++#include <stdio.h> /* for XKBrules.h */
++#include <X11/extensions/XKBrules.h>
++#include <X11/extensions/XKBstr.h>
++#include <string.h>
+
-+ if (variant != null) {
-+ keymap = "%s(%s)".printf(layout, variant);
-+ }
++#include "xkblib.h"
+
-+ if (variant_desc != null) {
-+ desc = variant_desc;
++#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;
++}
+
-+ desc = desc.replace("<", "<").replace(">", ">");
++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;
+
-+ if (lang.length > 2) {
-+ symbol = lang[0:2];
++ 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);
+
-+ string engine = "
-+ <engine>
-+ <name>%s</name>
-+ <language>%s</language>
-+ <license>GPL</license>
-+ <author>Peng Huang <shawn.p.huang at gmail.com></author>
-+ <layout>%s</layout>
-+ <longname>%s</longname>
-+ <description>%s</description>
-+ <icon>ibus-keyboard</icon>
-+ <symbol>%s</symbol>
-+ <rank>%d</rank>
-+ </engine>".printf(name, lang, keymap, desc, desc, symbol, 99);
-+ print (engine);
++ if (XkbGetState (xdisplay, XkbUseCoreKbd, &state) != Success) {
++ g_warning ("Could not get state");
++ return;
++ }
++ default_layout_group = state.group;
+}
+
-+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 = "<engines>";
-+ const string footer = "
-+</engines>";
++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;
+
-+ print (header);
-+ for (unowned GLib.List<string> 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<string> lg = langs; lg != null; lg = lg.next) {
-+ print_xml(l.data, layout_desc, null, null, lg.data);
-+ }
-+ for (unowned GLib.List<string> v = variants; v != null; v = v.next) {
-+ var l_v = "%s(%s)".printf(l.data, v.data);
-+ unowned GLib.List<string> l_v_langs = null;
-+ GLib.List<string> _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<string> 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);
-+ }
++ 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);
+ }
-+ print (footer);
++ 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;
+}
-
- 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;
-+ }
++
++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;
+ }
-+
- 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 25db578..7de949a 100644
---- a/engine/simple.xml.in.in
-+++ b/engine/simple.xml.in.in
-@@ -7,534 +7,5 @@
- <license>GPL</license>
- <homepage>http://code.google.com/p/ibus</homepage>
- <textdomain>ibus</textdomain>
-- <engines>
-- <engine>
-- <name>xkb:us::eng</name>
-- <language>eng</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>us</layout>
-- <longname>English (US)</longname>
-- <description>English (US)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:us:intl:eng</name>
-- <language>eng</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>us(intl)</layout>
-- <longname>English (US, international with dead keys)</longname>
-- <description>English (US, international with dead keys)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:us:colemak:eng</name>
-- <language>eng</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>us(colemak)</layout>
-- <longname>English (Colemak)</longname>
-- <description>English (Colemak)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:us:dvorak:eng</name>
-- <language>eng</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>us(dvorak)</layout>
-- <longname>English (Dvorak)</longname>
-- <description>English (Dvorak)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:us:altgr-intl:eng</name>
-- <language>eng</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>us(altgr-intl)</layout>
-- <longname>English (international AltGr dead keys)</longname>
-- <description>English (international AltGr dead keys)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:us:altgr-intl:eng</name>
-- <language>eng</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>us(altgr-intl)</layout>
-- <longname>English (international AltGr dead keys)</longname>
-- <description>English (international AltGr dead keys)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:be::ger</name>
-- <language>ger</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>be</layout>
-- <longname>Belgian</longname>
-- <description>Belgian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:be::nld</name>
-- <language>nld</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>be</layout>
-- <longname>Belgian</longname>
-- <description>Belgian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:be::fra</name>
-- <language>fra</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>be</layout>
-- <longname>Belgian</longname>
-- <description>Belgian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:br::por</name>
-- <language>por</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>br</layout>
-- <longname>Portuguese (Brazil)</longname>
-- <description>Portuguese (Brazil)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:bg::bul</name>
-- <language>bul</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>bg</layout>
-- <longname>Bulgarian</longname>
-- <description>Bulgarian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:bg:phonetic:bul</name>
-- <language>bul</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>bg(phonetic)</layout>
-- <longname>Bulgarian (traditional phonetic)</longname>
-- <description>Bulgarian (traditional phonetic)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:ca::fra</name>
-- <language>fra</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>ca</layout>
-- <longname>French (Canada)</longname>
-- <description>French (Canada)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:ca:eng:eng</name>
-- <language>eng</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>ca(eng)</layout>
-- <longname>English (Canada)</longname>
-- <description>English (Canada)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:hr::scr</name>
-- <language>scr</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>hr</layout>
-- <longname>Croatian</longname>
-- <description>Croatian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:cz::cze</name>
-- <language>cze</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>cz</layout>
-- <longname>Czech</longname>
-- <description>Czech</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:dk::dan</name>
-- <language>dan</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>dk</layout>
-- <longname>Danish</longname>
-- <description>Danish</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:ee::est</name>
-- <language>est</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>ee</layout>
-- <longname>Estonian</longname>
-- <description>Estonian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:fi::fin</name>
-- <language>fin</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>fi</layout>
-- <longname>Finnish</longname>
-- <description>Finnish</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:fr::fra</name>
-- <language>fra</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>fr</layout>
-- <longname>French</longname>
-- <description>French</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:de::ger</name>
-- <language>ger</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>de</layout>
-- <longname>German</longname>
-- <description>German</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:de:neo:ger</name>
-- <language>ger</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>de(neo)</layout>
-- <longname>German (Neo 2)</longname>
-- <description>German (Neo 2)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:gr::gre</name>
-- <language>gre</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>gr</layout>
-- <longname>Greek</longname>
-- <description>Greek</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:hu::hun</name>
-- <language>hun</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>hu</layout>
-- <longname>Hungarian</longname>
-- <description>Hungarian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:il::heb</name>
-- <language>heb</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>il</layout>
-- <longname>Hebrew</longname>
-- <description>Hebrew</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:it::ita</name>
-- <language>ita</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>it</layout>
-- <longname>Italian</longname>
-- <description>Italian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:jp::jpn</name>
-- <language>jpn</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>jp</layout>
-- <longname>Japanese</longname>
-- <description>Japanese</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:latam::spa</name>
-- <language>spa</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>latam</layout>
-- <longname>Spanish (Latin American)</longname>
-- <description>Spanish (Latin American)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:lt::lit</name>
-- <language>lit</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>lt</layout>
-- <longname>Lithuanian</longname>
-- <description>Lithuanian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:lv:apostrophe:lav</name>
-- <language>lav</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>lv(apostrophe)</layout>
-- <longname>Latvian (apostrophe variant)</longname>
-- <description>Latvian (apostrophe variant)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:pl::pol</name>
-- <language>pol</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>pl</layout>
-- <longname>Polish</longname>
-- <description>Polish</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:pt::por</name>
-- <language>por</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>pt</layout>
-- <longname>Portuguese</longname>
-- <description>Portuguese</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:ro::rum</name>
-- <language>rum</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>ro</layout>
-- <longname>Romanian</longname>
-- <description>Romanian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:ru::rus</name>
-- <language>rus</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>ru</layout>
-- <longname>Russian</longname>
-- <description>Russian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:ru:phonetic:rus</name>
-- <language>rus</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>ru(phonetic)</layout>
-- <longname>Russian (phonetic)</longname>
-- <description>Russian (phonetic)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:rs::srp</name>
-- <language>srp</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>rs</layout>
-- <longname>Serbian</longname>
-- <description>Serbian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:si::slv</name>
-- <language>slv</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>si</layout>
-- <longname>Slovenian</longname>
-- <description>Slovenian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:sk::slo</name>
-- <language>slo</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>sk</layout>
-- <longname>Slovak</longname>
-- <description>Slovak</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:es::spa</name>
-- <language>spa</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>es</layout>
-- <longname>Spanish</longname>
-- <description>Spanish</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:es:cat:cat</name>
-- <language>cat</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>es(cat)</layout>
-- <longname>Catalan (Spain, with middle-dot L)</longname>
-- <description>Catalan (Spain, with middle-dot L)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:se::swe</name>
-- <language>swe</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>se</layout>
-- <longname>Swedish</longname>
-- <description>Swedish</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:ch::ger</name>
-- <language>ger</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>ch</layout>
-- <longname>German (Switzerland)</longname>
-- <description>German (Switzerland)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:ch:fr:fra</name>
-- <language>fra</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>ch(fr)</layout>
-- <longname>French (Switzerland)</longname>
-- <description>French (Switzerland)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:tr::tur</name>
-- <language>tur</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>tr</layout>
-- <longname>Turkish</longname>
-- <description>Turkish</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:ua::ukr</name>
-- <language>ukr</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>ua</layout>
-- <longname>Ukrainian</longname>
-- <description>Ukrainian</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:gb:extd:eng</name>
-- <language>eng</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>gb(extd)</layout>
-- <longname>English (UK, extended WinKeys)</longname>
-- <description>English (UK, extended WinKeys)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:gb:dvorak:eng</name>
-- <language>eng</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>gb(dvorak)</layout>
-- <longname>English (UK, Dvorak)</longname>
-- <description>English (UK, Dvorak)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- <engine>
-- <name>xkb:kr:kr104:kor</name>
-- <language>kor</language>
-- <license>GPL</license>
-- <author>Peng Huang <shawn.p.huang at gmail.com></author>
-- <layout>kr(kr104)</layout>
-- <longname>Korean (101/104 key compatible)</longname>
-- <description>Korean (101/104 key compatible)</description>
-- <icon>ibus-keyboard</icon>
-- <rank>99</rank>
-- </engine>
-- </engines>
-+ <engines exec=\"${libexecdir}/ibus-engine-simple --xml\" />
- </component>
-diff --git a/engine/xkblib.c b/engine/xkblib.c
-new file mode 100644
-index 0000000..bb25455
---- /dev/null
-+++ b/engine/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 <takao.fujiwara1 at gmail.com>
-+ * Copyright (C) 2012 Peng Huang <shawn.p.huang at gmail.com>
-+ * 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 <config.h>
-+#endif
-+
-+#include <glib.h>
-+#include <X11/Xlib.h>
-+#include <X11/Xatom.h>
-+#include <X11/XKBlib.h>
-+#include <stdio.h> /* for XKBrules.h */
-+#include <X11/extensions/XKBrules.h>
-+#include <X11/extensions/XKBstr.h>
-+#include <string.h>
-+
-+#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 */
++ len += 5; /* trailing NULs */
+
+ rules_atom = XInternAtom (xdisplay, _XKB_RF_NAMES_PROP_ATOM, False);
+ root_window = XDefaultRootWindow (xdisplay);
@@ -1375,11 +797,11 @@ index 0000000..bb25455
+
+ return state.group;
+}
-diff --git a/engine/xkblib.h b/engine/xkblib.h
+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/xkblib.h
++++ 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: */
@@ -1422,6 +844,650 @@ index 0000000..36597c3
+
+G_END_DECLS
+#endif
+diff --git a/engine/main.vala b/engine/main.vala
+index e1fd129..377fa2f 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 = "
++ <engine>
++ <name>%s</name>
++ <language>%s</language>
++ <license>GPL</license>
++ <author>Peng Huang <shawn.p.huang at gmail.com></author>
++ <layout>%s</layout>
++ <longname>%s</longname>
++ <description>%s</description>
++ <icon>ibus-keyboard</icon>
++ <symbol>%s</symbol>
++ <rank>%d</rank>
++ </engine>".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 = "<engines>";
++ const string footer = "
++</engines>";
++
++ print (header);
++ for (unowned GLib.List<string> 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<string> lg = langs; lg != null; lg = lg.next) {
++ print_xml(l.data, layout_desc, null, null, lg.data);
++ }
++ for (unowned GLib.List<string> v = variants; v != null; v = v.next) {
++ var l_v = "%s(%s)".printf(l.data, v.data);
++ unowned GLib.List<string> l_v_langs = null;
++ GLib.List<string> _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<string> 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 25db578..7de949a 100644
+--- a/engine/simple.xml.in.in
++++ b/engine/simple.xml.in.in
+@@ -7,534 +7,5 @@
+ <license>GPL</license>
+ <homepage>http://code.google.com/p/ibus</homepage>
+ <textdomain>ibus</textdomain>
+- <engines>
+- <engine>
+- <name>xkb:us::eng</name>
+- <language>eng</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>us</layout>
+- <longname>English (US)</longname>
+- <description>English (US)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:us:intl:eng</name>
+- <language>eng</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>us(intl)</layout>
+- <longname>English (US, international with dead keys)</longname>
+- <description>English (US, international with dead keys)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:us:colemak:eng</name>
+- <language>eng</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>us(colemak)</layout>
+- <longname>English (Colemak)</longname>
+- <description>English (Colemak)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:us:dvorak:eng</name>
+- <language>eng</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>us(dvorak)</layout>
+- <longname>English (Dvorak)</longname>
+- <description>English (Dvorak)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:us:altgr-intl:eng</name>
+- <language>eng</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>us(altgr-intl)</layout>
+- <longname>English (international AltGr dead keys)</longname>
+- <description>English (international AltGr dead keys)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:us:altgr-intl:eng</name>
+- <language>eng</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>us(altgr-intl)</layout>
+- <longname>English (international AltGr dead keys)</longname>
+- <description>English (international AltGr dead keys)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:be::ger</name>
+- <language>ger</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>be</layout>
+- <longname>Belgian</longname>
+- <description>Belgian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:be::nld</name>
+- <language>nld</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>be</layout>
+- <longname>Belgian</longname>
+- <description>Belgian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:be::fra</name>
+- <language>fra</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>be</layout>
+- <longname>Belgian</longname>
+- <description>Belgian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:br::por</name>
+- <language>por</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>br</layout>
+- <longname>Portuguese (Brazil)</longname>
+- <description>Portuguese (Brazil)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:bg::bul</name>
+- <language>bul</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>bg</layout>
+- <longname>Bulgarian</longname>
+- <description>Bulgarian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:bg:phonetic:bul</name>
+- <language>bul</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>bg(phonetic)</layout>
+- <longname>Bulgarian (traditional phonetic)</longname>
+- <description>Bulgarian (traditional phonetic)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:ca::fra</name>
+- <language>fra</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>ca</layout>
+- <longname>French (Canada)</longname>
+- <description>French (Canada)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:ca:eng:eng</name>
+- <language>eng</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>ca(eng)</layout>
+- <longname>English (Canada)</longname>
+- <description>English (Canada)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:hr::scr</name>
+- <language>scr</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>hr</layout>
+- <longname>Croatian</longname>
+- <description>Croatian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:cz::cze</name>
+- <language>cze</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>cz</layout>
+- <longname>Czech</longname>
+- <description>Czech</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:dk::dan</name>
+- <language>dan</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>dk</layout>
+- <longname>Danish</longname>
+- <description>Danish</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:ee::est</name>
+- <language>est</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>ee</layout>
+- <longname>Estonian</longname>
+- <description>Estonian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:fi::fin</name>
+- <language>fin</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>fi</layout>
+- <longname>Finnish</longname>
+- <description>Finnish</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:fr::fra</name>
+- <language>fra</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>fr</layout>
+- <longname>French</longname>
+- <description>French</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:de::ger</name>
+- <language>ger</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>de</layout>
+- <longname>German</longname>
+- <description>German</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:de:neo:ger</name>
+- <language>ger</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>de(neo)</layout>
+- <longname>German (Neo 2)</longname>
+- <description>German (Neo 2)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:gr::gre</name>
+- <language>gre</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>gr</layout>
+- <longname>Greek</longname>
+- <description>Greek</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:hu::hun</name>
+- <language>hun</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>hu</layout>
+- <longname>Hungarian</longname>
+- <description>Hungarian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:il::heb</name>
+- <language>heb</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>il</layout>
+- <longname>Hebrew</longname>
+- <description>Hebrew</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:it::ita</name>
+- <language>ita</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>it</layout>
+- <longname>Italian</longname>
+- <description>Italian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:jp::jpn</name>
+- <language>jpn</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>jp</layout>
+- <longname>Japanese</longname>
+- <description>Japanese</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:latam::spa</name>
+- <language>spa</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>latam</layout>
+- <longname>Spanish (Latin American)</longname>
+- <description>Spanish (Latin American)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:lt::lit</name>
+- <language>lit</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>lt</layout>
+- <longname>Lithuanian</longname>
+- <description>Lithuanian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:lv:apostrophe:lav</name>
+- <language>lav</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>lv(apostrophe)</layout>
+- <longname>Latvian (apostrophe variant)</longname>
+- <description>Latvian (apostrophe variant)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:pl::pol</name>
+- <language>pol</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>pl</layout>
+- <longname>Polish</longname>
+- <description>Polish</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:pt::por</name>
+- <language>por</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>pt</layout>
+- <longname>Portuguese</longname>
+- <description>Portuguese</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:ro::rum</name>
+- <language>rum</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>ro</layout>
+- <longname>Romanian</longname>
+- <description>Romanian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:ru::rus</name>
+- <language>rus</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>ru</layout>
+- <longname>Russian</longname>
+- <description>Russian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:ru:phonetic:rus</name>
+- <language>rus</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>ru(phonetic)</layout>
+- <longname>Russian (phonetic)</longname>
+- <description>Russian (phonetic)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:rs::srp</name>
+- <language>srp</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>rs</layout>
+- <longname>Serbian</longname>
+- <description>Serbian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:si::slv</name>
+- <language>slv</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>si</layout>
+- <longname>Slovenian</longname>
+- <description>Slovenian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:sk::slo</name>
+- <language>slo</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>sk</layout>
+- <longname>Slovak</longname>
+- <description>Slovak</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:es::spa</name>
+- <language>spa</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>es</layout>
+- <longname>Spanish</longname>
+- <description>Spanish</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:es:cat:cat</name>
+- <language>cat</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>es(cat)</layout>
+- <longname>Catalan (Spain, with middle-dot L)</longname>
+- <description>Catalan (Spain, with middle-dot L)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:se::swe</name>
+- <language>swe</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>se</layout>
+- <longname>Swedish</longname>
+- <description>Swedish</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:ch::ger</name>
+- <language>ger</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>ch</layout>
+- <longname>German (Switzerland)</longname>
+- <description>German (Switzerland)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:ch:fr:fra</name>
+- <language>fra</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>ch(fr)</layout>
+- <longname>French (Switzerland)</longname>
+- <description>French (Switzerland)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:tr::tur</name>
+- <language>tur</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>tr</layout>
+- <longname>Turkish</longname>
+- <description>Turkish</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:ua::ukr</name>
+- <language>ukr</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>ua</layout>
+- <longname>Ukrainian</longname>
+- <description>Ukrainian</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:gb:extd:eng</name>
+- <language>eng</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>gb(extd)</layout>
+- <longname>English (UK, extended WinKeys)</longname>
+- <description>English (UK, extended WinKeys)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:gb:dvorak:eng</name>
+- <language>eng</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>gb(dvorak)</layout>
+- <longname>English (UK, Dvorak)</longname>
+- <description>English (UK, Dvorak)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- <engine>
+- <name>xkb:kr:kr104:kor</name>
+- <language>kor</language>
+- <license>GPL</license>
+- <author>Peng Huang <shawn.p.huang at gmail.com></author>
+- <layout>kr(kr104)</layout>
+- <longname>Korean (101/104 key compatible)</longname>
+- <description>Korean (101/104 key compatible)</description>
+- <icon>ibus-keyboard</icon>
+- <rank>99</rank>
+- </engine>
+- </engines>
++ <engines exec=\"${libexecdir}/ibus-engine-simple --xml\" />
+ </component>
diff --git a/ibus-1.0.pc.in b/ibus-1.0.pc.in
index 9f593ab..66b902a 100644
--- a/ibus-1.0.pc.in
@@ -1440,8 +1506,52 @@ index 9f593ab..66b902a 100644
Name: IBus
Description: IBus Library
+diff --git a/ibus.spec.in b/ibus.spec.in
+index 58cac38..4b6f869 100644
+--- a/ibus.spec.in
++++ b/ibus.spec.in
+@@ -4,6 +4,7 @@
+
+ # Build flags
+ %define build_python_library 0
++%define build_xkb 0
+
+ %define glib_ver %([ -a %{_libdir}/pkgconfig/glib-2.0.pc ] && pkg-config --modversion glib-2.0 | cut -d. -f 1,2 || echo -n "999")
+ %define gconf2_version 2.12.0
+@@ -38,6 +39,10 @@ BuildRequires: GConf2-devel
+ BuildRequires: pygobject2-devel
+ BuildRequires: intltool
+ BuildRequires: iso-codes-devel
++%if %{build_xkb}
++BuildRequires: libxkbfile-devel
++BuildRequires: libgnomekbd-devel
++%endif
+
+ Requires: %{name}-libs = %{version}-%{release}
+ Requires: %{name}-gtk2 = %{version}-%{release}
+@@ -51,6 +56,9 @@ Requires: im-chooser >= %{im_chooser_version}
+ Requires: GConf2 >= %{gconf2_version}
+ Requires: notify-python
+ Requires: librsvg2
++%if %{build_xkb}
++Requires: libgnomekbd
++%endif
+
+ Requires(post): desktop-file-utils
+ Requires(postun): desktop-file-utils
+@@ -132,6 +140,10 @@ OPTIONS="$OPTIONS --enable-python-library"
+ OPTIONS="$OPTIONS --disable-python-library"
+ %endif
+
++%if %{build_xkb}
++OPTIONS="$OPTIONS --enable-xkb --enable-libgnomekbd"
++%endif
++
+ %configure $OPTIONS
+
+ # make -C po update-gmo
diff --git a/setup/main.py b/setup/main.py
-index fdfb33a..4f57106 100644
+index 300f11b..f3fe1c5 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -183,14 +183,22 @@ class Setup(object):
@@ -2187,12 +2297,12 @@ index 0000000..661e6fd
@@ -0,0 +1 @@
+Configuration cheader_filename="libgnomekbd/gkbd-configuration.h"
diff --git a/ui/gtk3/Makefile.am b/ui/gtk3/Makefile.am
-index 87a7373..6a426fa 100644
+index 639e3ea..e8e8d15 100644
--- a/ui/gtk3/Makefile.am
+++ b/ui/gtk3/Makefile.am
-@@ -42,6 +42,9 @@ INCLUDES = \
- -I$(top_builddir)/src \
- $(NULL)
+@@ -44,6 +44,9 @@ INCLUDES = \
+
+ USE_SYMBOL_ICON = FALSE
+HAVE_IBUS_XKB_C = $(strip $(subst false, FALSE, $(subst true, TRUE, $(HAVE_IBUS_XKB))))
+HAVE_IBUS_GKBD_C = $(strip $(subst false, FALSE, $(subst true, TRUE, $(HAVE_IBUS_GKBD))))
@@ -2200,10 +2310,10 @@ index 87a7373..6a426fa 100644
AM_CFLAGS = \
@GLIB2_CFLAGS@ \
@GIO2_CFLAGS@ \
-@@ -57,6 +60,10 @@ AM_CFLAGS = \
- -DBINDIR=\"@bindir@\" \
+@@ -60,6 +63,10 @@ AM_CFLAGS = \
-DIBUS_DISABLE_DEPRECATED \
-DIBUS_VERSION=\"@IBUS_VERSION@\" \
+ -DSWITCHER_USE_SYMBOL_ICON=$(USE_SYMBOL_ICON) \
+ -DHAVE_IBUS_XKB=$(HAVE_IBUS_XKB_C) \
+ -DHAVE_IBUS_GKBD=$(HAVE_IBUS_GKBD_C) \
+ -DIBUS_XKB_COMMAND=\"$(libexecdir)/ibus-xkb\" \
@@ -2211,7 +2321,7 @@ index 87a7373..6a426fa 100644
-Wno-unused-variable \
-Wno-unused-but-set-variable \
-Wno-unused-function \
-@@ -87,6 +94,7 @@ ibus_ui_gtk3_SOURCES = \
+@@ -90,6 +97,7 @@ ibus_ui_gtk3_SOURCES = \
application.vala \
candidatearea.vala \
candidatepanel.vala \
@@ -2219,7 +2329,7 @@ index 87a7373..6a426fa 100644
handle.vala \
iconwidget.vala \
keybindingmanager.vala \
-@@ -95,6 +103,7 @@ ibus_ui_gtk3_SOURCES = \
+@@ -98,6 +106,7 @@ ibus_ui_gtk3_SOURCES = \
property.vala \
separator.vala \
switcher.vala \
@@ -2227,7 +2337,7 @@ index 87a7373..6a426fa 100644
grabkeycode.c \
$(NULL)
-@@ -102,12 +111,51 @@ ibus_ui_gtk3_LDADD = \
+@@ -105,12 +114,51 @@ ibus_ui_gtk3_LDADD = \
$(AM_LDADD) \
$(NULL)
@@ -2474,26 +2584,29 @@ index 0000000..adacd81
+ }
+ */
+}
-diff --git a/ui/gtk3/keybindingmanager.vala b/ui/gtk3/keybindingmanager.vala
-index dd3c7bd..4459ab2 100644
---- a/ui/gtk3/keybindingmanager.vala
-+++ b/ui/gtk3/keybindingmanager.vala
-@@ -133,6 +133,10 @@ public class KeybindingManager : GLib.Object {
- m_bindings.remove (binding);
- }
-
-+ public GLib.List get_keybindings() {
-+ return m_bindings.copy();
-+ }
-+
- public static KeybindingManager get_instance () {
- if (m_instance == null)
- m_instance = new KeybindingManager ();
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
-index 251a65e..ff83284 100644
+index 25d705d..2ecd48b 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
-@@ -41,8 +41,17 @@ class Panel : IBus.PanelService {
+@@ -29,6 +29,17 @@ public extern const string IBUS_VERSION;
+ public extern const string BINDIR;
+
+ class Panel : IBus.PanelService {
++ private class Keybinding {
++ public Keybinding(uint keysym,
++ Gdk.ModifierType modifiers) {
++ this.keysym = keysym;
++ this.modifiers = modifiers;
++ }
++
++ public uint keysym { get; set; }
++ public Gdk.ModifierType modifiers { get; set; }
++ }
++
+ private IBus.Bus m_bus;
+ private IBus.Config m_config;
+ private Gtk.StatusIcon m_status_icon;
+@@ -41,10 +52,16 @@ class Panel : IBus.PanelService {
private GLib.Pid m_setup_pid = 0;
private Gtk.AboutDialog m_about_dialog;
private Gtk.CssProvider m_css_provider;
@@ -2504,39 +2617,26 @@ index 251a65e..ff83284 100644
+ private int m_fallback_lock_id = -1;
+ private bool m_changed_xkb_option = false;
+ private GLib.Timer m_changed_layout_timer;
-+ private GLib.List m_keybindings;
private const string ACCELERATOR_SWITCH_IME_FOREWARD = "<Control>space";
- private const string ACCELERATOR_SWITCH_IME_BACKWARD = "<Control><Shift>space";
-+ private string[] ACCELERATOR_IME_HOTKEYS = {};
+
+- private uint m_switch_keysym = 0;
+- private Gdk.ModifierType m_switch_modifiers = 0;
++ private GLib.List<Keybinding> m_keybindings = new GLib.List<Keybinding>();
public Panel(IBus.Bus bus) {
GLib.assert(bus.is_connected());
-@@ -66,13 +75,6 @@ class Panel : IBus.PanelService {
+@@ -67,7 +84,6 @@ class Panel : IBus.PanelService {
+ m_candidate_panel.page_down.connect((w) => this.page_down());
m_switcher = new Switcher();
+- bind_switch_shortcut();
-- var keybinding_manager = KeybindingManager.get_instance();
-- keybinding_manager.bind(ACCELERATOR_SWITCH_IME_FOREWARD,
-- (e) => handle_engine_switch(e, false));
--
-- keybinding_manager.bind(ACCELERATOR_SWITCH_IME_BACKWARD,
-- (e) => handle_engine_switch(e, true));
--
m_property_manager = new PropertyManager();
m_property_manager.property_activate.connect((k, s) => {
- property_activate(k, s);
-@@ -83,8 +85,67 @@ class Panel : IBus.PanelService {
+@@ -79,64 +95,119 @@ class Panel : IBus.PanelService {
~Panel() {
- var keybinding_manager = KeybindingManager.get_instance();
-- keybinding_manager.unbind(ACCELERATOR_SWITCH_IME_FOREWARD);
-- keybinding_manager.unbind(ACCELERATOR_SWITCH_IME_BACKWARD);
-+ foreach (string keybinding in ACCELERATOR_IME_HOTKEYS) {
-+ keybinding_manager.unbind(keybinding);
-+ if (keybinding == ACCELERATOR_SWITCH_IME_FOREWARD) {
-+ keybinding_manager.unbind(ACCELERATOR_SWITCH_IME_BACKWARD);
-+ }
-+ }
+ unbind_switch_shortcut();
+
+ if (HAVE_IBUS_GKBD && m_gkbdlayout != null) {
+ m_gkbdlayout.changed.disconnect(gkbdlayout_changed_cb);
@@ -2545,16 +2645,17 @@ index 251a65e..ff83284 100644
+ }
+
+ m_xkblayout = null;
-+ }
-+
+ }
+
+ // ToDo: Customize the input method with ibus-setup
-+ private void set_keybinding() {
+ private void bind_switch_shortcut() {
+ string locale = GLib.Intl.setlocale(GLib.LocaleCategory.ALL,
+ null);
+ if (locale == null) {
+ locale = "C";
+ }
+
++ string[] ACCELERATOR_IME_HOTKEYS = {};
+ ACCELERATOR_IME_HOTKEYS += ACCELERATOR_SWITCH_IME_FOREWARD;
+
+ if (m_config != null) {
@@ -2582,24 +2683,120 @@ index 251a65e..ff83284 100644
+ }
+ }
+
-+ var keybinding_manager = KeybindingManager.get_instance();
-+ foreach (string keybinding in ACCELERATOR_IME_HOTKEYS) {
-+ keybinding_manager.bind(keybinding,
-+ (e) => handle_engine_switch(e, false));
-+ if (keybinding == ACCELERATOR_SWITCH_IME_FOREWARD) {
-+ keybinding_manager.bind(ACCELERATOR_SWITCH_IME_BACKWARD,
-+ (e) => handle_engine_switch(e, true));
+ var keybinding_manager = KeybindingManager.get_instance();
+
+- var accelerator = ACCELERATOR_SWITCH_IME_FOREWARD;
+- Gtk.accelerator_parse(accelerator,
+- out m_switch_keysym, out m_switch_modifiers);
+-
+- // 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) {
+- // workaround a bug in gdk vapi vala > 0.18
+- // https://bugzilla.gnome.org/show_bug.cgi?id=677559
++ foreach (var accelerator in ACCELERATOR_IME_HOTKEYS) {
++ uint switch_keysym = 0;
++ Gdk.ModifierType switch_modifiers = 0;
++ Gtk.accelerator_parse(accelerator,
++ out switch_keysym, out switch_modifiers);
++
++ // 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 ((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);
++ Gdk.Keymap.get_default().map_virtual_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) {
+- warning("Parse accelerator '%s' failed!", accelerator);
+- return;
+- }
++ if (switch_keysym == 0 && switch_modifiers == 0) {
++ warning("Parse accelerator '%s' failed!", accelerator);
++ continue;
+ }
+
+- keybinding_manager.bind(m_switch_keysym, m_switch_modifiers,
+- (e) => handle_engine_switch(e, false));
++ Keybinding keybinding = new Keybinding(switch_keysym,
++ switch_modifiers);
++ m_keybindings.append(keybinding);
+
+- // accelerator already has Shift mask
+- if ((m_switch_modifiers & Gdk.ModifierType.SHIFT_MASK) != 0)
+- return;
++ keybinding_manager.bind(switch_keysym, switch_modifiers,
++ (e) => handle_engine_switch(e, false));
+
+- keybinding_manager.bind(m_switch_keysym,
+- m_switch_modifiers | Gdk.ModifierType.SHIFT_MASK,
+- (e) => handle_engine_switch(e, true));
++ // accelerator already has Shift mask
++ if ((switch_modifiers & Gdk.ModifierType.SHIFT_MASK) != 0) {
++ continue;
++ }
++
++ keybinding_manager.bind(switch_keysym,
++ switch_modifiers | Gdk.ModifierType.SHIFT_MASK,
++ (e) => handle_engine_switch(e, true));
++ }
+ }
+
+ private void unbind_switch_shortcut() {
+ var keybinding_manager = KeybindingManager.get_instance();
+
+- if (m_switch_keysym == 0 && m_switch_modifiers == 0)
+- return;
++ unowned GLib.List<Keybinding> keybindings = m_keybindings;
+
+- keybinding_manager.unbind(m_switch_keysym, m_switch_modifiers);
+- keybinding_manager.unbind(m_switch_keysym,
+- m_switch_modifiers | Gdk.ModifierType.SHIFT_MASK);
++ for (;
++ keybindings != null;
++ keybindings = keybindings.next) {
++ Keybinding keybinding = keybindings.data;
+
+- m_switch_keysym = 0;
+- m_switch_modifiers = 0;
++ keybinding_manager.unbind(keybinding.keysym,
++ keybinding.modifiers);
++ keybinding_manager.unbind(keybinding.keysym,
++ keybinding.modifiers | Gdk.ModifierType.SHIFT_MASK);
++ m_keybindings.remove(keybinding);
+ }
-+ m_keybindings = keybinding_manager.get_keybindings();
}
private void set_custom_font() {
-@@ -152,12 +213,14 @@ class Panel : IBus.PanelService {
+@@ -204,12 +275,14 @@ class Panel : IBus.PanelService {
}
m_config = config;
-+ set_keybinding();
++ bind_switch_shortcut();
if (m_config != null) {
m_config.value_changed.connect(config_value_changed_cb);
m_config.watch("general", "preload_engines");
@@ -2610,7 +2807,7 @@ index 251a65e..ff83284 100644
update_engines(m_config.get_value("general", "preload_engines"),
m_config.get_value("general", "engines_order"));
} else {
-@@ -167,6 +230,192 @@ class Panel : IBus.PanelService {
+@@ -219,6 +292,192 @@ class Panel : IBus.PanelService {
set_custom_font();
}
@@ -2803,7 +3000,7 @@ index 251a65e..ff83284 100644
private void switch_engine(int i, bool force = false) {
GLib.assert(i >= 0 && i < m_engines.length);
-@@ -186,15 +435,7 @@ class Panel : IBus.PanelService {
+@@ -233,15 +492,7 @@ class Panel : IBus.PanelService {
return;
}
// set xkb layout
@@ -2817,113 +3014,110 @@ index 251a65e..ff83284 100644
- warning("execute setxkblayout failed");
- }
+ set_layout(engine.get_layout());
+ }
- string[] names = {};
- foreach(var desc in m_engines) {
-@@ -234,7 +475,7 @@ class Panel : IBus.PanelService {
+ private void config_value_changed_cb(IBus.Config config,
+@@ -272,8 +523,7 @@ class Panel : IBus.PanelService {
event, primary_modifiers);
if (pressed) {
int i = revert ? m_engines.length - 1 : 1;
-- i = m_switcher.run(event, m_engines, i);
-+ i = m_switcher.run(event, m_engines, i, m_keybindings);
+- i = m_switcher.run(m_switch_keysym, m_switch_modifiers, event,
+- m_engines, i);
++ i = m_switcher.run(m_keybindings, event, m_engines, i);
if (i < 0) {
debug("switch cancelled");
} else {
diff --git a/ui/gtk3/switcher.vala b/ui/gtk3/switcher.vala
-index 81812ec..52b0577 100644
+index ea56c07..f209e7f 100644
--- a/ui/gtk3/switcher.vala
+++ b/ui/gtk3/switcher.vala
-@@ -23,14 +23,42 @@
- using IBus;
- using GLib;
- using Gtk;
-+using Gdk;
+@@ -71,13 +71,23 @@ class Switcher : Gtk.Window {
+ public string longname { get; set; }
+ }
- class Switcher : Gtk.Window {
+ private class Keybinding {
-+ public Keybinding(string accelerator,
-+ uint keysym,
++ public Keybinding(uint keysym,
+ Gdk.ModifierType modifiers) {
-+ this.accelerator = accelerator;
+ this.keysym = keysym;
+ this.modifiers = modifiers;
+ }
+
-+ public string accelerator { get; set; }
+ public uint keysym { get; set; }
+ public Gdk.ModifierType modifiers { get; set; }
+ }
+
-+ public static const uint MODIFIER_FILTER =
-+ Gdk.ModifierType.MODIFIER_MASK & ~(
-+ Gdk.ModifierType.MOD2_MASK |
-+ Gdk.ModifierType.LOCK_MASK |
-+ Gdk.ModifierType.MOD4_MASK |
-+ Gdk.ModifierType.MOD5_MASK |
-+ Gdk.ModifierType.BUTTON1_MASK |
-+ Gdk.ModifierType.BUTTON2_MASK |
-+ Gdk.ModifierType.BUTTON3_MASK |
-+ Gdk.ModifierType.BUTTON4_MASK |
-+ Gdk.ModifierType.BUTTON5_MASK);
-+
private Gtk.Box m_box;
- private Gtk.Button[] m_buttons = {};
+ private Gtk.Label m_label;
+ private IBusEngineButton[] m_buttons = {};
private IBus.EngineDesc[] m_engines;
private uint m_selected_engine;
- private uint m_primary_modifier;
- private GLib.MainLoop m_loop;
+- private uint m_keyval;
+- private uint m_modifiers;
+ private unowned GLib.List<Keybinding> m_keybindings;
+ private Gdk.ModifierType m_primary_modifier;
+ private GLib.MainLoop m_loop;
private int m_result;
-
- public Switcher() {
-@@ -49,7 +77,7 @@ class Switcher : Gtk.Window {
+@@ -113,19 +123,17 @@ class Switcher : Gtk.Window {
grab_focus();
}
-- public int run(Gdk.Event event, IBus.EngineDesc[] engines, int index) {
-+ public int run(Gdk.Event event, IBus.EngineDesc[] engines, int index, GLib.List keybindings) {
+- public int run(uint keyval,
+- uint state,
++ public int run(GLib.List keybindings,
+ Gdk.Event event,
+ IBus.EngineDesc[] engines,
+ int index) {
assert (m_loop == null);
assert (index < engines.length);
-@@ -61,6 +89,7 @@ class Switcher : Gtk.Window {
- m_result = 0;
- m_selected_engine = index;
- m_buttons[index].grab_focus();
+- m_keyval = keyval;
+- m_modifiers = state;
+ m_keybindings = (GLib.List<Keybinding>) keybindings;
+ m_primary_modifier =
+ KeybindingManager.get_primary_modifier(
+- state & KeybindingManager.MODIFIER_FILTER);
++ event.key.state & KeybindingManager.MODIFIER_FILTER);
- Gdk.Device device = event.get_device();
- if (device == null) {
-@@ -219,14 +248,24 @@ class Switcher : Gtk.Window {
-
+ update_engines(engines);
+ m_result = 0;
+@@ -310,23 +318,26 @@ class Switcher : Gtk.Window {
public override bool key_press_event(Gdk.EventKey e) {
+ bool retval = true;
Gdk.EventKey *pe = &e;
-- switch (pe->keyval) {
-- case 0x0020: /* space */
-- case 0xff80: /* KP_Space */
-- if ((pe->state & Gdk.ModifierType.SHIFT_MASK) == 0)
-+ Gdk.ModifierType state = pe->state & MODIFIER_FILTER;
-+
++ uint modifiers = KeybindingManager.MODIFIER_FILTER & pe->state;
+
+- do {
+- uint modifiers = KeybindingManager.MODIFIER_FILTER & pe->state;
+-
+- if ((modifiers != m_modifiers) &&
+- (modifiers != (m_modifiers | Gdk.ModifierType.SHIFT_MASK))) {
+- break;
+- }
+ for (unowned GLib.List<Keybinding> keybindings = m_keybindings;
+ keybindings != null;
+ keybindings = keybindings.next) {
+ Keybinding keybinding = keybindings.data;
-+ if (pe->keyval == keybinding.keysym &&
-+ state == keybinding.modifiers) {
-+ if ((state & Gdk.ModifierType.SHIFT_MASK) == 0) {
+
+- if (pe->keyval == m_keyval) {
+- if (modifiers == m_modifiers)
++ if (pe->keyval == keybinding.keysym) {
++ if (modifiers == (uint) keybinding.modifiers) {
next_engine();
-- else
-+ } else {
+- else // modififers == m_modifiers | SHIFT_MASK
++ return true;
++ } else if (modifiers ==
++ ((uint) keybinding.modifiers | Gdk.ModifierType.SHIFT_MASK)) {
previous_engine();
- break;
++ return true;
+ }
-+ return true;
-+ }
+ }
+ }
-+
-+ switch (pe->keyval) {
- case 0x08fb: /* leftarrow */
- case 0xff51: /* Down */
- break;
+
++ do {
+ switch (pe->keyval) {
+ case 0x08fb: /* leftarrow */
+ case 0xff51: /* Left */
diff --git a/ui/gtk3/xkblayout.vala b/ui/gtk3/xkblayout.vala
new file mode 100644
index 0000000..8b75387
@@ -3397,5 +3591,5 @@ index 0000000..8b75387
+ */
+}
--
-1.7.10
+1.7.10.4
diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch
index f9ca7f6..3f6deb4 100644
--- a/ibus-HEAD.patch
+++ b/ibus-HEAD.patch
@@ -1,37 +1,311 @@
-From 469335730bb9dc7ba1702cfc5108491b6993677b Mon Sep 17 00:00:00 2001
+From f453bf83f502d8b1e2b6f07cf669c14cbcfe008e Mon Sep 17 00:00:00 2001
+From: Peng Huang <shawn.p.huang at gmail.com>
+Date: Thu, 12 Jul 2012 16:41:30 -0400
+Subject: [PATCH] IBusBus: honor new connect-async prop in the socket monitor
+ callback
+
+I think we should make use of the async connection here if the
+property is set.
+
+But we also need a new flag for ongoing async connection attempts
+because the socket monitor callback may be called several times before
+the connection is established.
+
+BUG=http://code.google.com/p/ibus/issues/detail?id=1482
+TEST=
+
+Review URL: https://codereview.appspot.com/6346090
+---
+ src/ibusbus.c | 149 +++++++++++++++++++++++++++++++++++----------------------
+ 1 file changed, 93 insertions(+), 56 deletions(-)
+
+diff --git a/src/ibusbus.c b/src/ibusbus.c
+index fc3c11b..9118020 100644
+--- a/src/ibusbus.c
++++ b/src/ibusbus.c
+@@ -60,6 +60,8 @@ struct _IBusBusPrivate {
+ IBusConfig *config;
+ gchar *unique_name;
+ gboolean connect_async;
++ gchar *bus_address;
++ GCancellable *cancellable;
+ };
+
+ static guint bus_signals[LAST_SIGNAL] = { 0 };
+@@ -103,6 +105,8 @@ static void ibus_bus_get_property (IBusBus *bus,
+ GValue *value,
+ GParamSpec *pspec);
+
++static void ibus_bus_close_connection (IBusBus *bus);
++
+ G_DEFINE_TYPE (IBusBus, ibus_bus, IBUS_TYPE_OBJECT)
+
+ static void
+@@ -270,56 +274,57 @@ _connection_closed_cb (GDBusConnection *connection,
+ * However we think the error message is almost harmless. */
+ g_debug ("_connection_closed_cb: %s", error->message);
+ }
++ ibus_bus_close_connection (bus);
++}
+
+- g_assert (bus->priv->connection == connection);
+- g_signal_handlers_disconnect_by_func (bus->priv->connection,
+- G_CALLBACK (_connection_closed_cb),
+- bus);
+- g_object_unref (bus->priv->connection);
+- bus->priv->connection = NULL;
+-
++static void
++ibus_bus_close_connection (IBusBus *bus)
++{
+ g_free (bus->priv->unique_name);
+ bus->priv->unique_name = NULL;
+
+ bus->priv->watch_dbus_signal_id = 0;
+ bus->priv->watch_ibus_signal_id = 0;
+
+- g_signal_emit (bus, bus_signals[DISCONNECTED], 0);
+-}
++ g_free (bus->priv->bus_address);
++ bus->priv->bus_address = NULL;
++
++ /* Cancel ongoing connect request. */
++ g_cancellable_cancel (bus->priv->cancellable);
++ g_cancellable_reset (bus->priv->cancellable);
+
+-static void
+-ibus_bus_disconnect (IBusBus *bus)
+-{
+ /* unref the old connection at first */
+ if (bus->priv->connection != NULL) {
+ g_signal_handlers_disconnect_by_func (bus->priv->connection,
+ G_CALLBACK (_connection_closed_cb),
+ bus);
++ if (!g_dbus_connection_is_closed(bus->priv->connection))
++ g_dbus_connection_close(bus->priv->connection, NULL, NULL, NULL);
+ g_object_unref (bus->priv->connection);
+ bus->priv->connection = NULL;
++ g_signal_emit (bus, bus_signals[DISCONNECTED], 0);
+ }
+ }
+
+ static void
+-ibus_bus_connect_finish (IBusBus *bus)
+-{
+- if (bus->priv->connection) {
+- /* FIXME */
+- ibus_bus_hello (bus);
+-
+- g_signal_connect (bus->priv->connection,
+- "closed",
+- (GCallback) _connection_closed_cb,
+- bus);
+- if (bus->priv->watch_dbus_signal) {
+- ibus_bus_watch_dbus_signal (bus);
+- }
+- if (bus->priv->watch_ibus_signal) {
+- ibus_bus_watch_ibus_signal (bus);
+- }
+-
+- g_signal_emit (bus, bus_signals[CONNECTED], 0);
++ibus_bus_connect_completed (IBusBus *bus)
++{
++ g_assert (bus->priv->connection);
++ /* FIXME */
++ ibus_bus_hello (bus);
++
++ g_signal_connect (bus->priv->connection,
++ "closed",
++ (GCallback) _connection_closed_cb,
++ bus);
++ if (bus->priv->watch_dbus_signal) {
++ ibus_bus_watch_dbus_signal (bus);
++ }
++ if (bus->priv->watch_ibus_signal) {
++ ibus_bus_watch_ibus_signal (bus);
+ }
++
++ g_signal_emit (bus, bus_signals[CONNECTED], 0);
+ }
+
+ static void
+@@ -333,7 +338,8 @@ _bus_connect_async_cb (GObject *source_object,
+ IBusBus *bus = IBUS_BUS (user_data);
+ GError *error = NULL;
+
+- bus->priv->connection = g_dbus_connection_new_for_address_finish (res, &error);
++ bus->priv->connection =
++ g_dbus_connection_new_for_address_finish (res, &error);
+
+ if (error != NULL) {
+ g_warning ("Unable to connect to ibus: %s", error->message);
+@@ -341,8 +347,13 @@ _bus_connect_async_cb (GObject *source_object,
+ error = NULL;
+ }
+
+- if (bus->priv->connection)
+- ibus_bus_connect_finish (bus);
++ if (bus->priv->connection != NULL) {
++ ibus_bus_connect_completed (bus);
++ }
++ else {
++ g_free (bus->priv->bus_address);
++ bus->priv->bus_address = NULL;
++ }
+
+ /* unref the ref from ibus_bus_connect */
+ g_object_unref (bus);
+@@ -351,32 +362,52 @@ _bus_connect_async_cb (GObject *source_object,
+ static void
+ ibus_bus_connect_async (IBusBus *bus)
+ {
+- ibus_bus_disconnect (bus);
++ const gchar *bus_address = ibus_get_address ();
+
+- if (ibus_get_address () != NULL) {
+- g_object_ref (bus);
+- g_dbus_connection_new_for_address (ibus_get_address (),
+- G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
+- G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
+- NULL, NULL,
+- _bus_connect_async_cb, bus);
+- }
++ if (bus_address == NULL)
++ return;
++
++ if (g_strcmp0 (bus->priv->bus_address, bus_address) == 0)
++ return;
++
++ /* Close current connection and cancel ongoing connect request. */
++ ibus_bus_close_connection (bus);
++
++ bus->priv->bus_address = g_strdup (bus_address);
++ g_object_ref (bus);
++ g_dbus_connection_new_for_address (
++ bus_address,
++ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
++ G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
++ NULL,
++ bus->priv->cancellable,
++ _bus_connect_async_cb, bus);
+ }
+
+ static void
+ ibus_bus_connect (IBusBus *bus)
+ {
+- ibus_bus_disconnect (bus);
++ const gchar *bus_address = ibus_get_address ();
+
+- if (ibus_get_address () != NULL) {
+- bus->priv->connection =
+- g_dbus_connection_new_for_address_sync (ibus_get_address (),
+- G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
+- G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
+- NULL, NULL, NULL);
+- }
++ if (bus_address == NULL)
++ return;
+
+- ibus_bus_connect_finish (bus);
++ if (g_strcmp0 (bus_address, bus->priv->bus_address) == 0 &&
++ bus->priv->connection != NULL)
++ return;
++
++ /* Close current connection and cancel ongoing connect request. */
++ ibus_bus_close_connection (bus);
++
++ bus->priv->connection = g_dbus_connection_new_for_address_sync (
++ bus_address,
++ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
++ G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
++ NULL, NULL, NULL);
++ if (bus->priv->connection) {
++ bus->priv->bus_address = g_strdup (bus_address);
++ ibus_bus_connect_completed (bus);
++ }
+ }
+
+ static void
+@@ -391,10 +422,7 @@ _changed_cb (GFileMonitor *monitor,
+ event_type != G_FILE_MONITOR_EVENT_DELETED)
+ return;
+
+- if (ibus_bus_is_connected (bus))
+- return;
+-
+- ibus_bus_connect (bus);
++ ibus_bus_connect_async (bus);
+ }
+
+ static void
+@@ -414,6 +442,8 @@ ibus_bus_init (IBusBus *bus)
+ bus->priv->watch_ibus_signal_id = 0;
+ bus->priv->unique_name = NULL;
+ bus->priv->connect_async = FALSE;
++ bus->priv->bus_address = NULL;
++ bus->priv->cancellable = g_cancellable_new ();
+
+ path = g_path_get_dirname (ibus_get_socket_path ());
+
+@@ -523,6 +553,13 @@ ibus_bus_destroy (IBusObject *object)
+ g_free (bus->priv->unique_name);
+ bus->priv->unique_name = NULL;
+
++ g_free (bus->priv->bus_address);
++ bus->priv->bus_address = NULL;
++
++ g_cancellable_cancel (bus->priv->cancellable);
++ g_object_unref (bus->priv->cancellable);
++ bus->priv->cancellable = NULL;
++
+ IBUS_OBJECT_CLASS (ibus_bus_parent_class)->destroy (object);
+ }
+
+@@ -1621,7 +1658,7 @@ ibus_bus_get_engines_by_names (IBusBus *bus,
+ G_VARIANT_TYPE ("(av)"));
+ if (result == NULL)
+ return NULL;
+-
++
+ GArray *array = g_array_new (TRUE, TRUE, sizeof (IBusEngineDesc *));
+ GVariantIter *iter = NULL;
+ g_variant_get (result, "(av)", &iter);
+--
+1.7.10.4
+
+From 52fbf82dd1babc0d8de7be0f5bb6de622c069b4d Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Wed, 9 May 2012 17:09:23 +0900
+Date: Tue, 12 Jun 2012 11:53:29 +0900
Subject: [PATCH] Fix not to switch engines by non-trigger keys.
---
- ui/gtk3/switcher.vala | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
+ ui/gtk3/switcher.vala | 6 ++++++
+ 1 file changed, 6 insertions(+)
diff --git a/ui/gtk3/switcher.vala b/ui/gtk3/switcher.vala
-index 73b58d2..81812ec 100644
+index b543a8f..ea56c07 100644
--- a/ui/gtk3/switcher.vala
+++ b/ui/gtk3/switcher.vala
-@@ -58,6 +58,7 @@ class Switcher : Gtk.Window {
- event.key.state & KeybindingManager.MODIFIER_FILTER);
+@@ -128,6 +128,7 @@ class Switcher : Gtk.Window {
+ state & KeybindingManager.MODIFIER_FILTER);
update_engines(engines);
+ m_result = 0;
m_selected_engine = index;
+ m_label.set_text(m_buttons[index].longname);
m_buttons[index].grab_focus();
-
-@@ -242,7 +243,11 @@ class Switcher : Gtk.Window {
- break;
- default:
- debug("0x%04x", pe->keyval);
-- break;
-+ if (m_loop != null) {
-+ m_loop.quit();
-+ m_loop = null;
-+ }
-+ return false;
- }
- return true;
- }
+@@ -343,6 +344,11 @@ class Switcher : Gtk.Window {
+ break;
+ default:
+ debug("0x%04x", pe->keyval);
++ if (m_loop != null) {
++ m_loop.quit();
++ m_loop = null;
++ }
++ retval = false;
+ break;
+ }
+ } while (false);
--
-1.7.10
+1.7.10.4
diff --git a/ibus-xx-f18-build.patch b/ibus-xx-f18-build.patch
new file mode 100644
index 0000000..fac369a
--- /dev/null
+++ b/ibus-xx-f18-build.patch
@@ -0,0 +1,11 @@
+--- ibus-1.4.99.20120712/ui/gtk3/panel.vala.orig
++++ ibus-1.4.99.20120712/ui/gtk3/panel.vala
+@@ -157,7 +157,7 @@ class Panel : IBus.PanelService {
+ 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
++#if VALA_0_20
+ Gdk.Keymap.get_default().map_virtual_modifiers(
+ ref switch_modifiers);
+ #else
diff --git a/ibus-xx-g-s-disable-preedit.patch b/ibus-xx-g-s-disable-preedit.patch
index a14f1d4..6bc62cc 100644
--- a/ibus-xx-g-s-disable-preedit.patch
+++ b/ibus-xx-g-s-disable-preedit.patch
@@ -1,18 +1,18 @@
-From 2238af14b654218696220f83b5ee39ae49c2ad98 Mon Sep 17 00:00:00 2001
+From 027e4a40a37601c6733a8911fd3949a9310b0258 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Wed, 7 Sep 2011 15:25:27 +0900
+Date: Wed, 9 May 2012 19:15:00 +0900
Subject: [PATCH] Added a workaround to disable preedit in gnome-shell
https://bugzilla.gnome.org/show_bug.cgi?id=658420
---
client/gtk2/ibusimcontext.c | 8 ++++++++
- 1 files changed, 8 insertions(+), 0 deletions(-)
+ 1 file changed, 8 insertions(+)
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
-index 327a5d9..39d2d0c 100644
+index 584b92d..c4c61d3 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
-@@ -583,6 +583,14 @@ ibus_im_context_init (GObject *obj)
+@@ -584,6 +584,14 @@ ibus_im_context_init (GObject *obj)
#else
ibusimcontext->caps = IBUS_CAP_PREEDIT_TEXT | IBUS_CAP_FOCUS;
#endif
@@ -28,5 +28,5 @@ index 327a5d9..39d2d0c 100644
// Create slave im context
--
-1.7.5.4
+1.7.10.4
diff --git a/ibus-xx-no-use.diff b/ibus-xx-no-use.diff
index cce7ce1..38f84c5 100644
--- a/ibus-xx-no-use.diff
+++ b/ibus-xx-no-use.diff
@@ -1,6 +1,18 @@
---- ibus-1.4.99.20120428/setup/main.py.orig 2012-05-01 12:11:29.055651061 +0900
-+++ ibus-1.4.99.20120428/setup/main.py 2012-05-01 17:55:23.053440859 +0900
-@@ -75,22 +75,30 @@ class Setup(object):
+From 1cd16fa05c05e64bf5ee89c92a02fe4323e1de2b Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1 at gmail.com>
+Date: Thu, 24 May 2012 17:49:19 +0900
+Subject: [PATCH] Disabled to show non-used GUI.
+
+---
+ setup/main.py | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++------
+ setup/setup.ui | 33 +++++++++++++++++--------------
+ 2 files changed, 72 insertions(+), 21 deletions(-)
+
+diff --git a/setup/main.py b/setup/main.py
+index 0e4c83d..fda20ea 100644
+--- a/setup/main.py
++++ b/setup/main.py
+@@ -77,22 +77,30 @@ class Setup(object):
self.__init_ui()
def __init_hotkey(self):
@@ -37,7 +49,7 @@
def __init_panel(self):
values = dict(self.__config.get_values("panel"))
-@@ -443,6 +451,46 @@ class Setup(object):
+@@ -445,6 +453,46 @@ class Setup(object):
entry.set_text(text)
entry.set_tooltip_text(text)
@@ -84,27 +96,29 @@
def __item_started_column_toggled_cb(self, cell, path_str, model):
---- ibus-1.4.99.20120317/setup/setup.ui.orig 2012-03-16 14:58:23.948466373 +0900
-+++ ibus-1.4.99.20120317/setup/setup.ui 2012-03-16 14:59:22.242094469 +0900
-@@ -102,7 +102,7 @@
+diff --git a/setup/setup.ui b/setup/setup.ui
+index 2026172..c6f5f3a 100644
+--- a/setup/setup.ui
++++ b/setup/setup.ui
+@@ -106,7 +106,7 @@
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label8">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">The shortcut keys for switching to next input method in the list</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Next input method:</property>
-@@ -116,7 +116,7 @@
+@@ -121,7 +121,7 @@
</child>
<child>
<object class="GtkLabel" id="label9">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="sensitive">False</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">The shortcut keys for switching to previous input method in the list</property>
- <property name="xalign">0</property>
-@@ -137,7 +137,7 @@
+@@ -144,7 +144,7 @@
<object class="GtkEntry" id="entry_trigger">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -112,8 +126,8 @@
+ <!-- property name="editable">False</property -->
</object>
<packing>
- <property name="position">0</property>
-@@ -145,7 +145,9 @@
+ <property name="expand">True</property>
+@@ -154,7 +154,9 @@
</child>
<child>
<object class="GtkButton" id="button_trigger">
@@ -121,10 +135,10 @@
+ <!-- property name="label" translatable="yes">...</property -->
+ <property name="label">gtk-apply</property>
+ <property name="use_stock">True</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
-@@ -160,11 +162,12 @@
+@@ -172,11 +174,12 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@@ -135,96 +149,99 @@
<object class="GtkHBox" id="hbox5">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <object class="GtkEntry" id="entry_next_engine">
-@@ -199,7 +202,7 @@
+@@ -217,7 +220,7 @@
</child>
<child>
<object class="GtkHBox" id="hbox6">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <object class="GtkEntry" id="entry_prev_engine">
-@@ -248,7 +251,7 @@
+@@ -273,7 +276,7 @@
</child>
<child>
<object class="GtkLabel" id="label18">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Enable:</property>
- </object>
-@@ -261,7 +264,7 @@
+@@ -287,7 +290,7 @@
</child>
<child>
<object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <object class="GtkEntry" id="entry_enable_unconditional">
-@@ -296,7 +299,7 @@
+@@ -328,7 +331,7 @@
</child>
<child>
<object class="GtkLabel" id="label19">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Disable:</property>
- </object>
-@@ -309,7 +312,7 @@
+@@ -342,7 +345,7 @@
</child>
<child>
<object class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <object class="GtkEntry" id="entry_disable_unconditional">
-@@ -406,7 +409,7 @@
+@@ -452,7 +455,7 @@
</child>
<child>
<object class="GtkLabel" id="label10">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Set the behavior of ibus how to show or hide language bar</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Show language panel:</property>
-@@ -433,7 +436,7 @@
+@@ -481,7 +484,7 @@
</child>
<child>
<object class="GtkComboBox" id="combobox_panel_show">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="can_focus">False</property>
<property name="model">model_panel_show_mode</property>
<child>
- <object class="GtkCellRendererText" id="renderer2"/>
-@@ -470,7 +473,7 @@
- <child>
+@@ -521,7 +524,7 @@
<object class="GtkCheckButton" id="checkbutton_show_icon_on_systray">
<property name="label" translatable="yes">Show icon on system tray</property>
+ <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Show icon on system tray</property>
-@@ -486,7 +489,7 @@
- <child>
+@@ -540,7 +543,7 @@
<object class="GtkCheckButton" id="checkbutton_show_im_name">
<property name="label" translatable="yes">Show input method name on language bar</property>
+ <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Show input method's name on language bar when check the checkbox</property>
-@@ -893,7 +896,7 @@ You may use up/down buttons to change it
+@@ -1001,7 +1004,7 @@ You may use up/down buttons to change it.</i></small></property>
</child>
<child>
<object class="GtkFrame" id="frame5">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
- <child>
+--
+1.7.10.4
+
diff --git a/ibus-xx-setup-frequent-lang.patch b/ibus-xx-setup-frequent-lang.patch
index ad85a08..1967b9d 100644
--- a/ibus-xx-setup-frequent-lang.patch
+++ b/ibus-xx-setup-frequent-lang.patch
@@ -1,17 +1,17 @@
-From f4e54576688df705f20fb25597852a451e063cef Mon Sep 17 00:00:00 2001
+From 3eb162c984dc420b085547b0a590f079262ef97d Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Sat, 28 Apr 2012 13:08:12 +0900
+Date: Tue, 17 Jul 2012 17:43:10 +0900
Subject: [PATCH] Enable ibus-setup to show the frequently used languages
only in IME list.
---
data/ibus.schemas.in | 168 +++++++++++++++++++++++++++++++++++++++++++++++
- setup/enginecombobox.py | 156 ++++++++++++++++++++++++++++++++++++-------
+ setup/enginecombobox.py | 155 ++++++++++++++++++++++++++++++++++++-------
setup/main.py | 1 +
- 3 files changed, 300 insertions(+), 25 deletions(-)
+ 3 files changed, 300 insertions(+), 24 deletions(-)
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
-index 20c1bc3..f6b55d6 100644
+index 0d127d5..1ea4277 100644
--- a/data/ibus.schemas.in
+++ b/data/ibus.schemas.in
@@ -340,6 +340,174 @@ se,si,sk,sy,sy(ku),th,tj,tr,ua,uz,vn
@@ -190,7 +190,7 @@ index 20c1bc3..f6b55d6 100644
<applyto>/desktop/ibus/panel/custom_font</applyto>
<owner>ibus</owner>
diff --git a/setup/enginecombobox.py b/setup/enginecombobox.py
-index 0ac7368..578098c 100644
+index f80b164..578098c 100644
--- a/setup/enginecombobox.py
+++ b/setup/enginecombobox.py
@@ -45,6 +45,9 @@ class EngineComboBox(Gtk.ComboBox):
@@ -203,7 +203,7 @@ index 0ac7368..578098c 100644
renderer = Gtk.CellRendererPixbuf()
renderer.set_property("xalign", 0)
-@@ -58,21 +61,51 @@ class EngineComboBox(Gtk.ComboBox):
+@@ -58,20 +61,51 @@ class EngineComboBox(Gtk.ComboBox):
self.pack_start(renderer, True)
self.set_cell_data_func(renderer, self.__name_cell_data_cb, None)
@@ -248,7 +248,6 @@ index 0ac7368..578098c 100644
- self.__model.set(iter1, 0, 0)
- langs = {}
- for e in engines:
-- print e.get_language()
- l = IBus.get_language_name(e.get_language())
- if l == None:
- l = ""
@@ -268,7 +267,7 @@ index 0ac7368..578098c 100644
keys = langs.keys()
keys.sort(locale.strcoll)
loc = locale.getlocale()[0]
-@@ -90,29 +123,86 @@ class EngineComboBox(Gtk.ComboBox):
+@@ -89,29 +123,86 @@ class EngineComboBox(Gtk.ComboBox):
keys.remove(IBus.get_language_name("Other"))
keys += [IBus.get_language_name("Other")]
for l in keys:
@@ -363,7 +362,7 @@ index 0ac7368..578098c 100644
else:
renderer.set_property("visible", True)
renderer.set_property("sensitive", True)
-@@ -125,7 +215,8 @@ class EngineComboBox(Gtk.ComboBox):
+@@ -124,7 +215,8 @@ class EngineComboBox(Gtk.ComboBox):
renderer.set_property("pixbuf", pixbuf)
def __name_cell_data_cb(self, celllayout, renderer, model, iter, data):
@@ -373,7 +372,7 @@ index 0ac7368..578098c 100644
if isinstance (engine, str) or isinstance (engine, unicode):
renderer.set_property("sensitive", False)
-@@ -133,8 +224,15 @@ class EngineComboBox(Gtk.ComboBox):
+@@ -132,8 +224,15 @@ class EngineComboBox(Gtk.ComboBox):
renderer.set_property("weight", Pango.Weight.NORMAL)
elif isinstance(engine, int):
renderer.set_property("sensitive", True)
@@ -391,7 +390,7 @@ index 0ac7368..578098c 100644
else:
renderer.set_property("sensitive", True)
renderer.set_property("text", engine.get_longname())
-@@ -150,10 +248,18 @@ class EngineComboBox(Gtk.ComboBox):
+@@ -149,10 +248,18 @@ class EngineComboBox(Gtk.ComboBox):
if i == 0 or i == -1:
return None
iter = self.get_active_iter()
@@ -412,7 +411,7 @@ index 0ac7368..578098c 100644
return self.get_property("active-engine")
diff --git a/setup/main.py b/setup/main.py
-index 7612407..1cb3e60 100644
+index b7833e3..408e655 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -209,6 +209,7 @@ class Setup(object):
@@ -424,5 +423,5 @@ index 7612407..1cb3e60 100644
engine_names = values.get("preload_engines", [])
--
-1.7.10
+1.7.10.4
diff --git a/ibus.spec b/ibus.spec
index 9553882..e585dc6 100644
--- a/ibus.spec
+++ b/ibus.spec
@@ -29,8 +29,8 @@
%define gnome_icon_theme_legacy_version 2.91.6
Name: ibus
-Version: 1.4.99.20120428
-Release: 3%{?dist}
+Version: 1.4.99.20120712
+Release: 1%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
Group: System Environment/Libraries
@@ -48,10 +48,10 @@ Patch3: ibus-xx-setup-frequent-lang.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=658420
Patch92: ibus-xx-g-s-disable-preedit.patch
Patch93: ibus-771115-property-compatible.patch
-# Apply GNOME Alt+Tab UI to IME switcher UI.
-Patch94: ibus-xx-branding-switcher-ui.patch
# Hide no nused properties in f17.
-Patch95: ibus-xx-no-use.diff
+Patch94: ibus-xx-no-use.diff
+# Workaround since f18 vala is old.
+Patch95: ibus-xx-f18-build.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -119,6 +119,10 @@ Requires: gnome-icon-theme-symbolic
Requires(post): desktop-file-utils
Requires(postun): desktop-file-utils
+%if %with_dconf
+Requires(postun): dconf
+Requires(posttrans): dconf
+%endif
Requires(pre): GConf2
Requires(post): GConf2
@@ -213,6 +217,7 @@ cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c ||
%if %with_xkbfile
%patch1 -p1 -b .xkb
rm -f bindings/vala/ibus-1.0.vapi
+rm -f data/dconf/00-upstream-settings
%endif
%patch2 -p1 -b .preload-sys
%patch3 -p1 -b .setup-frequent-lang
@@ -221,8 +226,8 @@ rm -f bindings/vala/ibus-1.0.vapi
%patch93 -p1 -b .compat
%endif
-%patch94 -p1 -b .ime-ui
-%patch95 -p1 -b .no-used
+%patch94 -p1 -b .no-used
+%patch95 -p1 -b .f18
%build
%if %with_xkbfile
@@ -265,15 +270,15 @@ autoreconf -f -i
make -C ui/gtk3 maintainer-clean-generic
%endif
# make -C po update-gmo
-make %{?_smp_mflags}
+make USE_SYMBOL_ICON=TRUE %{?_smp_mflags}
%if %with_gjs
d=`basename %SOURCE2 .tar.gz`
cd $d
export PKG_CONFIG_PATH=..:/usr/lib64/pkgconfig:/usr/lib/pkgconfig
%configure \
- --with-gnome-shell-version="3.4,3.3.92,3.3.90,3.3.5,3.3.4,3.3.3,3.2" \
- --with-gjs-version="1.32,1.31.22,1.31.20,1.31.10,1.31.6,1.31.11,1.30"
+ --with-gnome-shell-version="3.5.3,3.4,3.3.92,3.3.90,3.3.5,3.3.4,3.3.3,3.2" \
+ --with-gjs-version="1.33.3,1.32,1.31.22,1.31.20,1.31.10,1.31.6,1.31.11,1.30"
make %{?_smp_mflags}
cd ..
%endif
@@ -361,6 +366,11 @@ if [ "$1" -eq 0 ]; then
%if %with_dconf
glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
+ # 'dconf update' sometimes does not update the db...
+ dconf update
+ if [ -f %{_sysconfdir}/dconf/db/ibus ] ; then
+ rm -f %{_sysconfdir}/dconf/db/ibus
+ fi
%endif
fi
@@ -368,6 +378,7 @@ fi
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%if %with_dconf
glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
+dconf update
%endif
%post libs -p /sbin/ldconfig
@@ -416,7 +427,7 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
# %{_sysconfdir}/xdg/autostart/ibus.desktop
%{_sysconfdir}/bash_completion.d/ibus.bash
%if %with_dconf
-%{_sysconfdir}/dconf/db/ibus
+%{_sysconfdir}/dconf/db/ibus.d
%{_sysconfdir}/dconf/profile/ibus
%else
%{_sysconfdir}/gconf/schemas/ibus.schemas
@@ -462,6 +473,10 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
%{_datadir}/gtk-doc/html/*
%changelog
+* Tue Jul 17 2012 Takao Fujiwara <tfujiwar at redhat.com> - 1.4.99.20120712-1
+- Bumped to 1.4.99.20120712
+- Removed ibus-xx-branding-switcher-ui.patch as upstreamed.
+
* Fri Jun 8 2012 Matthias Clasen <mclasen at redhat.com> - 1.4.99.20120428-3
- Rebuild against new libgnomekbd
diff --git a/sources b/sources
index fca7a92..c88a0e6 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,3 @@
-276f30a81b634feb9c4bcc3e564ac948 ibus-1.4.99.20120428.tar.gz
+0d884fafedf2ddfaa73a34a8eac7a1f0 ibus-1.4.99.20120712.tar.gz
2d2ad58e3e41429dbd883ba7e501c9b2 ibus-gjs-3.2.1.20111230.tar.gz
3fdef3e31c0354d927dc06df5dc02f9c ibus-gjs-3.4.1.20120518.tar.gz
More information about the scm-commits
mailing list