From db31e528307a958d02b7d718baf339b634e067e8 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Tue, 17 Jul 2012 19:27:02 +0900 Subject: [PATCH] Bumped to 1.4.99.20120712 --- .gitignore | 1 + ibus-530711-preload-sys.patch | 41 +- ibus-541492-xkb.patch | 1432 ++++++++++++++++------------ 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, 1241 insertions(+), 942 deletions(-) delete mode 100644 ibus-xx-branding-switcher-ui.patch create mode 100644 ibus-xx-f18-build.patch 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 -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 /desktop/ibus/general/preload_engines ibus 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 @@ True - vertical + False - + @@ -179,27 +179,28 @@ index e37cb32..fec1646 100644 + + + False ++ True + 0 + + + + True + False - -@@ -752,7 +767,7 @@ - - +@@ -842,7 +858,7 @@ + True + True - 0 + 1 -@@ -791,7 +806,7 @@ You may use up/down buttons to change it.</i></small> - +@@ -889,7 +905,7 @@ You may use up/down buttons to change it.</i></small> False + True - 1 + 2 @@ -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 -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 @@ + + + ++ /schemas/desktop/ibus/general/use_xmodmap ++ /desktop/ibus/general/use_xmodmap ++ ibus ++ bool ++ true ++ ++ Use xmodmap ++ Run xmodmap if .xmodmap/.Xmodmap exists. ++ ++ ++ ++ /schemas/desktop/ibus/general/xkb_latin_layouts ++ /desktop/ibus/general/xkb_latin_layouts ++ ibus ++ list ++ string ++ [ara,bg,cz,dev,gr,gur,in,jp(kana),mal,mkd,ru,ua] ++ ++ Latin layout which have no ASCII ++ us layout is appended to the latin layouts. variant is not needed. ++ ++ ++ ++ /schemas/desktop/ibus/general/load_xkb_layouts ++ /desktop/ibus/general/load_xkb_layouts ++ ibus ++ list ++ string ++ [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 ++] ++ ++ XKB layout list which is shown on ibus-setup ++ XKB layout list which is shown on ibus-setup. ++ The format is "layout" or "layout(variant)". ++ ++ ++ + /schemas/desktop/ibus/general/hotkey/trigger + /desktop/ibus/general/hotkey/trigger + ibus +@@ -34,6 +80,62 @@ [Control+space,Zenkaku_Hankaku,Alt+Kanji,Alt+grave,Hangul,Alt+Release+Alt_R] Trigger shortcut keys @@ -197,95 +260,98 @@ index 53ba05c..5e6c2d7 100644 The shortcut keys for turning input method on or off -@@ -203,6 +259,52 @@ - - - -+ /schemas/desktop/ibus/general/use_xmodmap -+ /desktop/ibus/general/use_xmodmap -+ ibus -+ bool -+ true -+ -+ Use xmodmap -+ Run xmodmap if .xmodmap/.Xmodmap exists. -+ -+ -+ -+ /schemas/desktop/ibus/general/xkb_latin_layouts -+ /desktop/ibus/general/xkb_latin_layouts -+ ibus -+ list -+ string -+ [ara,bg,cz,dev,gr,gur,in,jp(kana),mal,mkd,ru,ua] -+ -+ Latin layout which have no ASCII -+ us layout is appended to the latin layouts. variant is not needed. -+ -+ -+ -+ /schemas/desktop/ibus/general/load_xkb_layouts -+ /desktop/ibus/general/load_xkb_layouts -+ ibus -+ list -+ string -+ [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 -+] -+ -+ XKB layout list which is shown on ibus-setup -+ XKB layout list which is shown on ibus-setup. -+ The format is "layout" or "layout(variant)". -+ -+ -+ - /schemas/desktop/ibus/panel/use_custom_font - /desktop/ibus/panel/use_custom_font - ibus 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-@IBUS_API_VERSION@.la ++SUBDIRS = ++ +if ENABLE_XKB -+libexec_PROGRAMS += ibus-xkb -+ibus_xkb_SOURCES = \ -+ ibus-xkb-main.c \ -+ xkblib.h \ -+ xkblib.c \ -+ $(NULL) -+ibus_xkb_CFLAGS = \ -+ @XKB_CFLAGS@ \ -+ @X11_CFLAGS@ \ -+ @GLIB2_CFLAGS@ \ -+ $(NULL) -+ibus_xkb_LDADD = \ -+ @XKB_LIBS@ \ -+ @X11_LIBS@ \ -+ @GLIB2_LIBS@ \ -+ $(libibus) \ -+ $(NULL) ++SUBDIRS += ibus-xkb +endif + - CLEANFILES = \ - simple.xml \ - $(NULL) -diff --git a/engine/ibus-xkb-main.c b/engine/ibus-xkb-main.c + 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 ++# Copyright (c) 2012 Red Hat, Inc. ++# ++# This library is free software; you can redistribute it and/or ++# modify it under the terms of the GNU Lesser General Public ++# License as published by the Free Software Foundation; either ++# version 2 of the License, or (at your option) any later version. ++# ++# This library is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU Lesser General Public License for more details. ++# ++# You should have received a copy of the GNU Lesser General Public ++# License along with this program; if not, write to the ++# Free Software Foundation, Inc., 59 Temple Place, Suite 330, ++# Boston, MA 02111-1307 USA ++ ++libibus = $(top_builddir)/src/libibus-@IBUS_API_VERSION@.la ++ ++INCLUDES = \ ++ -I$(top_srcdir)/src \ ++ -I$(top_builddir)/src \ ++ $(NULL) ++ ++AM_CFLAGS = \ ++ $(INCLUDES) \ ++ -DG_LOG_DOMAIN=\"IBUS\" \ ++ -DIBUS_DISABLE_DEPRECATED \ ++ -Wno-unused-variable \ ++ -Wno-unused-but-set-variable \ ++ -Wno-unused-function \ ++ $(NULL) ++ ++AM_LDADD = \ ++ $(NULL) ++ ++libexec_PROGRAMS = ibus-xkb ++ ++ibus_xkb_SOURCES = \ ++ ibus-xkb-main.c \ ++ xkblib.h \ ++ xkblib.c \ ++ $(NULL) ++ibus_xkb_CFLAGS = \ ++ @XKB_CFLAGS@ \ ++ @X11_CFLAGS@ \ ++ @GLIB2_CFLAGS@ \ ++ $(NULL) ++ibus_xkb_LDADD = \ ++ @XKB_LIBS@ \ ++ @X11_LIBS@ \ ++ @GLIB2_LIBS@ \ ++ $(libibus) \ ++ $(NULL) ++ ++$(libibus): ++ $(MAKE) -C $(top_builddir)/src ++ ++-include $(top_srcdir)/git.mk +diff --git a/engine/ibus-xkb/ibus-xkb-main.c b/engine/ibus-xkb/ibus-xkb-main.c new file mode 100644 index 0000000..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,6 +464,386 @@ index 0000000..2529e4d + + return 0; +} +diff --git a/engine/ibus-xkb/xkblib.c b/engine/ibus-xkb/xkblib.c +new file mode 100644 +index 0000000..bb25455 +--- /dev/null ++++ b/engine/ibus-xkb/xkblib.c +@@ -0,0 +1,327 @@ ++/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ ++/* vim:set et sts=4: */ ++/* bus - The Input Bus ++ * Copyright (C) 2012 Takao Fujiwara ++ * Copyright (C) 2012 Peng Huang ++ * Copyright (C) 2012 Red Hat, Inc. ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ */ ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++ ++#include ++#include ++#include ++#include ++#include /* for XKBrules.h */ ++#include ++#include ++#include ++ ++#include "xkblib.h" ++ ++#ifndef XKB_RULES_XML_FILE ++#define XKB_RULES_XML_FILE "/usr/share/X11/xkb/rules/evdev.xml" ++#endif ++ ++static gchar **default_layouts; ++static gchar **default_variants; ++static gchar **default_options; ++static int default_layout_group; ++ ++static Display * ++get_xdisplay (Display *xdisplay) ++{ ++ static Display *saved_xdisplay = NULL; ++ if (xdisplay != NULL) { ++ saved_xdisplay = xdisplay; ++ } ++ return saved_xdisplay; ++} ++ ++static void ++init_xkb_default_layouts (Display *xdisplay) ++{ ++ XkbStateRec state; ++ Atom xkb_rules_name, type; ++ int format; ++ unsigned long l, nitems, bytes_after; ++ unsigned char *prop = NULL; ++ ++ xkb_rules_name = XInternAtom (xdisplay, "_XKB_RULES_NAMES", TRUE); ++ if (xkb_rules_name == None) { ++ g_warning ("Could not get XKB rules atom"); ++ return; ++ } ++ if (XGetWindowProperty (xdisplay, ++ XDefaultRootWindow (xdisplay), ++ xkb_rules_name, ++ 0, 1024, FALSE, XA_STRING, ++ &type, &format, &nitems, &bytes_after, &prop) != Success) { ++ g_warning ("Could not get X property"); ++ return; ++ } ++ if (nitems < 3) { ++ g_warning ("Could not get group layout from X property"); ++ return; ++ } ++ for (l = 0; l < 2; l++) { ++ prop += strlen ((const char *) prop) + 1; ++ } ++ if (prop == NULL || *prop == '\0') { ++ g_warning ("No layouts form X property"); ++ return; ++ } ++ default_layouts = g_strsplit ((gchar *) prop, ",", -1); ++ prop += strlen ((const char *) prop) + 1; ++ default_variants = g_strsplit ((gchar *) prop, ",", -1); ++ prop += strlen ((const char *) prop) + 1; ++ default_options = g_strsplit ((gchar *) prop, ",", -1); ++ ++ if (XkbGetState (xdisplay, XkbUseCoreKbd, &state) != Success) { ++ g_warning ("Could not get state"); ++ return; ++ } ++ default_layout_group = state.group; ++} ++ ++static Bool ++set_xkb_rules (Display *xdisplay, ++ const char *rules_file, const char *model, ++ const char *all_layouts, const char *all_variants, ++ const char *all_options) ++{ ++ gchar *rules_path; ++ XkbRF_RulesPtr rules; ++ XkbRF_VarDefsRec rdefs; ++ XkbComponentNamesRec rnames; ++ XkbDescPtr xkb; ++ ++ rules_path = g_strdup ("./rules/evdev"); ++ rules = XkbRF_Load (rules_path, "C", TRUE, TRUE); ++ if (rules == NULL) { ++ g_return_val_if_fail (XKB_RULES_XML_FILE != NULL, FALSE); ++ ++ g_free (rules_path); ++ if (g_str_has_suffix (XKB_RULES_XML_FILE, ".xml")) { ++ rules_path = g_strndup (XKB_RULES_XML_FILE, ++ strlen (XKB_RULES_XML_FILE) - 4); ++ } else { ++ rules_path = g_strdup (XKB_RULES_XML_FILE); ++ } ++ rules = XkbRF_Load (rules_path, "C", TRUE, TRUE); ++ } ++ g_return_val_if_fail (rules != NULL, FALSE); ++ ++ memset (&rdefs, 0, sizeof (XkbRF_VarDefsRec)); ++ memset (&rnames, 0, sizeof (XkbComponentNamesRec)); ++ rdefs.model = model ? g_strdup (model) : NULL; ++ rdefs.layout = all_layouts ? g_strdup (all_layouts) : NULL; ++ rdefs.variant = all_variants ? g_strdup (all_variants) : NULL; ++ rdefs.options = all_options ? g_strdup (all_options) : NULL; ++ XkbRF_GetComponents (rules, &rdefs, &rnames); ++ xkb = XkbGetKeyboardByName (xdisplay, XkbUseCoreKbd, &rnames, ++ XkbGBN_AllComponentsMask, ++ XkbGBN_AllComponentsMask & ++ (~XkbGBN_GeometryMask), True); ++ if (!xkb) { ++ g_warning ("Cannot load new keyboard description."); ++ return FALSE; ++ } ++ XkbRF_SetNamesProp (xdisplay, rules_path, &rdefs); ++ g_free (rules_path); ++ g_free (rdefs.model); ++ g_free (rdefs.layout); ++ g_free (rdefs.variant); ++ g_free (rdefs.options); ++ ++ return TRUE; ++} ++ ++static Bool ++update_xkb_properties (Display *xdisplay, ++ const char *rules_file, const char *model, ++ const char *all_layouts, const char *all_variants, ++ const char *all_options) ++{ ++ int len; ++ char *pval; ++ char *next; ++ Atom rules_atom; ++ Window root_window; ++ ++ len = (rules_file ? strlen (rules_file) : 0); ++ len += (model ? strlen (model) : 0); ++ len += (all_layouts ? strlen (all_layouts) : 0); ++ len += (all_variants ? strlen (all_variants) : 0); ++ len += (all_options ? strlen (all_options) : 0); ++ ++ if (len < 1) { ++ return TRUE; ++ } ++ len += 5; /* trailing NULs */ ++ ++ rules_atom = XInternAtom (xdisplay, _XKB_RF_NAMES_PROP_ATOM, False); ++ root_window = XDefaultRootWindow (xdisplay); ++ pval = next = g_new0 (char, len + 1); ++ if (!pval) { ++ return TRUE; ++ } ++ ++ if (rules_file) { ++ strcpy (next, rules_file); ++ next += strlen (rules_file); ++ } ++ *next++ = '\0'; ++ if (model) { ++ strcpy (next, model); ++ next += strlen (model); ++ } ++ *next++ = '\0'; ++ if (all_layouts) { ++ strcpy (next, all_layouts); ++ next += strlen (all_layouts); ++ } ++ *next++ = '\0'; ++ if (all_variants) { ++ strcpy (next, all_variants); ++ next += strlen (all_variants); ++ } ++ *next++ = '\0'; ++ if (all_options) { ++ strcpy (next, all_options); ++ next += strlen (all_options); ++ } ++ *next++ = '\0'; ++ if ((next - pval) != len) { ++ g_free (pval); ++ return TRUE; ++ } ++ ++ XChangeProperty (xdisplay, root_window, ++ rules_atom, XA_STRING, 8, PropModeReplace, ++ (unsigned char *) pval, len); ++ XSync(xdisplay, False); ++ ++ return TRUE; ++} ++ ++void ++ibus_xkb_init (Display *xdisplay) ++{ ++ get_xdisplay (xdisplay); ++ init_xkb_default_layouts (xdisplay); ++} ++ ++void ++ibus_xkb_finit (void) ++{ ++ g_strfreev (default_layouts); ++ default_layouts = NULL; ++ g_strfreev (default_variants); ++ default_variants = NULL; ++ g_strfreev (default_options); ++ default_options = NULL; ++} ++ ++gchar * ++ibus_xkb_get_current_layout (void) ++{ ++ if (default_layouts == NULL) { ++ g_warning ("Your system seems not to support XKB."); ++ return NULL; ++ } ++ ++ return g_strjoinv (",", (gchar **) default_layouts); ++} ++ ++gchar * ++ibus_xkb_get_current_variant (void) ++{ ++ if (default_variants == NULL) { ++ return NULL; ++ } ++ ++ return g_strjoinv (",", (gchar **) default_variants); ++} ++ ++gchar * ++ibus_xkb_get_current_option (void) ++{ ++ if (default_options == NULL) { ++ return NULL; ++ } ++ ++ return g_strjoinv (",", (gchar **) default_options); ++} ++ ++gboolean ++ibus_xkb_set_layout (const char *layouts, ++ const char *variants, ++ const char *options) ++{ ++ Display *xdisplay; ++ gboolean retval; ++ gchar *layouts_line; ++ ++ if (default_layouts == NULL) { ++ g_warning ("Your system seems not to support XKB."); ++ return FALSE; ++ } ++ ++ if (layouts == NULL || g_strcmp0 (layouts, "default") == 0) { ++ layouts_line = g_strjoinv (",", (gchar **) default_layouts); ++ } else { ++ layouts_line = g_strdup (layouts); ++ } ++ ++ xdisplay = get_xdisplay (NULL); ++ retval = set_xkb_rules (xdisplay, ++ "evdev", "evdev", ++ layouts_line, variants, options); ++ update_xkb_properties (xdisplay, ++ "evdev", "evdev", ++ layouts_line, variants, options); ++ g_free (layouts_line); ++ ++ return retval; ++} ++ ++int ++ibus_xkb_get_current_group (void) ++{ ++ Display *xdisplay = get_xdisplay (NULL); ++ XkbStateRec state; ++ ++ if (default_layouts == NULL) { ++ g_warning ("Your system seems not to support XKB."); ++ return 0; ++ } ++ ++ if (xdisplay == NULL) { ++ g_warning ("ibus-xkb is not initialized."); ++ return 0; ++ } ++ ++ if (XkbGetState (xdisplay, XkbUseCoreKbd, &state) != Success) { ++ g_warning ("Could not get state"); ++ return 0; ++ } ++ ++ return state.group; ++} +diff --git a/engine/ibus-xkb/xkblib.h b/engine/ibus-xkb/xkblib.h +new file mode 100644 +index 0000000..36597c3 +--- /dev/null ++++ b/engine/ibus-xkb/xkblib.h +@@ -0,0 +1,41 @@ ++/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ ++/* vim:set et sts=4: */ ++/* bus - The Input Bus ++ * Copyright (C) 2012 Takao Fujiwara ++ * Copyright (C) 2012 Peng Huang ++ * Copyright (C) 2012 Red Hat, Inc. ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ */ ++#ifndef __XKBLIB_H_ ++#define __XKBLIB_H_ ++ ++#include ++ ++G_BEGIN_DECLS ++ ++void ibus_xkb_init (Display *xdisplay); ++void ibus_xkb_finit (void); ++gchar *ibus_xkb_get_current_layout (void); ++gchar *ibus_xkb_get_current_variant (void); ++gchar *ibus_xkb_get_current_option (void); ++gboolean ibus_xkb_set_layout (const char *layouts, ++ const char *variants, ++ const char *options); ++int ibus_xkb_get_current_group (void); ++ ++G_END_DECLS ++#endif diff --git a/engine/main.vala b/engine/main.vala index e1fd129..377fa2f 100644 --- a/engine/main.vala @@ -1042,386 +1488,6 @@ index 25db578..7de949a 100644 - + -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 -+ * Copyright (C) 2012 Peng Huang -+ * Copyright (C) 2012 Red Hat, Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the -+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -+ * Boston, MA 02111-1307, USA. -+ */ -+#ifdef HAVE_CONFIG_H -+#include -+#endif -+ -+#include -+#include -+#include -+#include -+#include /* for XKBrules.h */ -+#include -+#include -+#include -+ -+#include "xkblib.h" -+ -+#ifndef XKB_RULES_XML_FILE -+#define XKB_RULES_XML_FILE "/usr/share/X11/xkb/rules/evdev.xml" -+#endif -+ -+static gchar **default_layouts; -+static gchar **default_variants; -+static gchar **default_options; -+static int default_layout_group; -+ -+static Display * -+get_xdisplay (Display *xdisplay) -+{ -+ static Display *saved_xdisplay = NULL; -+ if (xdisplay != NULL) { -+ saved_xdisplay = xdisplay; -+ } -+ return saved_xdisplay; -+} -+ -+static void -+init_xkb_default_layouts (Display *xdisplay) -+{ -+ XkbStateRec state; -+ Atom xkb_rules_name, type; -+ int format; -+ unsigned long l, nitems, bytes_after; -+ unsigned char *prop = NULL; -+ -+ xkb_rules_name = XInternAtom (xdisplay, "_XKB_RULES_NAMES", TRUE); -+ if (xkb_rules_name == None) { -+ g_warning ("Could not get XKB rules atom"); -+ return; -+ } -+ if (XGetWindowProperty (xdisplay, -+ XDefaultRootWindow (xdisplay), -+ xkb_rules_name, -+ 0, 1024, FALSE, XA_STRING, -+ &type, &format, &nitems, &bytes_after, &prop) != Success) { -+ g_warning ("Could not get X property"); -+ return; -+ } -+ if (nitems < 3) { -+ g_warning ("Could not get group layout from X property"); -+ return; -+ } -+ for (l = 0; l < 2; l++) { -+ prop += strlen ((const char *) prop) + 1; -+ } -+ if (prop == NULL || *prop == '\0') { -+ g_warning ("No layouts form X property"); -+ return; -+ } -+ default_layouts = g_strsplit ((gchar *) prop, ",", -1); -+ prop += strlen ((const char *) prop) + 1; -+ default_variants = g_strsplit ((gchar *) prop, ",", -1); -+ prop += strlen ((const char *) prop) + 1; -+ default_options = g_strsplit ((gchar *) prop, ",", -1); -+ -+ if (XkbGetState (xdisplay, XkbUseCoreKbd, &state) != Success) { -+ g_warning ("Could not get state"); -+ return; -+ } -+ default_layout_group = state.group; -+} -+ -+static Bool -+set_xkb_rules (Display *xdisplay, -+ const char *rules_file, const char *model, -+ const char *all_layouts, const char *all_variants, -+ const char *all_options) -+{ -+ gchar *rules_path; -+ XkbRF_RulesPtr rules; -+ XkbRF_VarDefsRec rdefs; -+ XkbComponentNamesRec rnames; -+ XkbDescPtr xkb; -+ -+ rules_path = g_strdup ("./rules/evdev"); -+ rules = XkbRF_Load (rules_path, "C", TRUE, TRUE); -+ if (rules == NULL) { -+ g_return_val_if_fail (XKB_RULES_XML_FILE != NULL, FALSE); -+ -+ g_free (rules_path); -+ if (g_str_has_suffix (XKB_RULES_XML_FILE, ".xml")) { -+ rules_path = g_strndup (XKB_RULES_XML_FILE, -+ strlen (XKB_RULES_XML_FILE) - 4); -+ } else { -+ rules_path = g_strdup (XKB_RULES_XML_FILE); -+ } -+ rules = XkbRF_Load (rules_path, "C", TRUE, TRUE); -+ } -+ g_return_val_if_fail (rules != NULL, FALSE); -+ -+ memset (&rdefs, 0, sizeof (XkbRF_VarDefsRec)); -+ memset (&rnames, 0, sizeof (XkbComponentNamesRec)); -+ rdefs.model = model ? g_strdup (model) : NULL; -+ rdefs.layout = all_layouts ? g_strdup (all_layouts) : NULL; -+ rdefs.variant = all_variants ? g_strdup (all_variants) : NULL; -+ rdefs.options = all_options ? g_strdup (all_options) : NULL; -+ XkbRF_GetComponents (rules, &rdefs, &rnames); -+ xkb = XkbGetKeyboardByName (xdisplay, XkbUseCoreKbd, &rnames, -+ XkbGBN_AllComponentsMask, -+ XkbGBN_AllComponentsMask & -+ (~XkbGBN_GeometryMask), True); -+ if (!xkb) { -+ g_warning ("Cannot load new keyboard description."); -+ return FALSE; -+ } -+ XkbRF_SetNamesProp (xdisplay, rules_path, &rdefs); -+ g_free (rules_path); -+ g_free (rdefs.model); -+ g_free (rdefs.layout); -+ g_free (rdefs.variant); -+ g_free (rdefs.options); -+ -+ return TRUE; -+} -+ -+static Bool -+update_xkb_properties (Display *xdisplay, -+ const char *rules_file, const char *model, -+ const char *all_layouts, const char *all_variants, -+ const char *all_options) -+{ -+ int len; -+ char *pval; -+ char *next; -+ Atom rules_atom; -+ Window root_window; -+ -+ len = (rules_file ? strlen (rules_file) : 0); -+ len += (model ? strlen (model) : 0); -+ len += (all_layouts ? strlen (all_layouts) : 0); -+ len += (all_variants ? strlen (all_variants) : 0); -+ len += (all_options ? strlen (all_options) : 0); -+ -+ if (len < 1) { -+ return TRUE; -+ } -+ len += 5; /* trailing NULs */ -+ -+ rules_atom = XInternAtom (xdisplay, _XKB_RF_NAMES_PROP_ATOM, False); -+ root_window = XDefaultRootWindow (xdisplay); -+ pval = next = g_new0 (char, len + 1); -+ if (!pval) { -+ return TRUE; -+ } -+ -+ if (rules_file) { -+ strcpy (next, rules_file); -+ next += strlen (rules_file); -+ } -+ *next++ = '\0'; -+ if (model) { -+ strcpy (next, model); -+ next += strlen (model); -+ } -+ *next++ = '\0'; -+ if (all_layouts) { -+ strcpy (next, all_layouts); -+ next += strlen (all_layouts); -+ } -+ *next++ = '\0'; -+ if (all_variants) { -+ strcpy (next, all_variants); -+ next += strlen (all_variants); -+ } -+ *next++ = '\0'; -+ if (all_options) { -+ strcpy (next, all_options); -+ next += strlen (all_options); -+ } -+ *next++ = '\0'; -+ if ((next - pval) != len) { -+ g_free (pval); -+ return TRUE; -+ } -+ -+ XChangeProperty (xdisplay, root_window, -+ rules_atom, XA_STRING, 8, PropModeReplace, -+ (unsigned char *) pval, len); -+ XSync(xdisplay, False); -+ -+ return TRUE; -+} -+ -+void -+ibus_xkb_init (Display *xdisplay) -+{ -+ get_xdisplay (xdisplay); -+ init_xkb_default_layouts (xdisplay); -+} -+ -+void -+ibus_xkb_finit (void) -+{ -+ g_strfreev (default_layouts); -+ default_layouts = NULL; -+ g_strfreev (default_variants); -+ default_variants = NULL; -+ g_strfreev (default_options); -+ default_options = NULL; -+} -+ -+gchar * -+ibus_xkb_get_current_layout (void) -+{ -+ if (default_layouts == NULL) { -+ g_warning ("Your system seems not to support XKB."); -+ return NULL; -+ } -+ -+ return g_strjoinv (",", (gchar **) default_layouts); -+} -+ -+gchar * -+ibus_xkb_get_current_variant (void) -+{ -+ if (default_variants == NULL) { -+ return NULL; -+ } -+ -+ return g_strjoinv (",", (gchar **) default_variants); -+} -+ -+gchar * -+ibus_xkb_get_current_option (void) -+{ -+ if (default_options == NULL) { -+ return NULL; -+ } -+ -+ return g_strjoinv (",", (gchar **) default_options); -+} -+ -+gboolean -+ibus_xkb_set_layout (const char *layouts, -+ const char *variants, -+ const char *options) -+{ -+ Display *xdisplay; -+ gboolean retval; -+ gchar *layouts_line; -+ -+ if (default_layouts == NULL) { -+ g_warning ("Your system seems not to support XKB."); -+ return FALSE; -+ } -+ -+ if (layouts == NULL || g_strcmp0 (layouts, "default") == 0) { -+ layouts_line = g_strjoinv (",", (gchar **) default_layouts); -+ } else { -+ layouts_line = g_strdup (layouts); -+ } -+ -+ xdisplay = get_xdisplay (NULL); -+ retval = set_xkb_rules (xdisplay, -+ "evdev", "evdev", -+ layouts_line, variants, options); -+ update_xkb_properties (xdisplay, -+ "evdev", "evdev", -+ layouts_line, variants, options); -+ g_free (layouts_line); -+ -+ return retval; -+} -+ -+int -+ibus_xkb_get_current_group (void) -+{ -+ Display *xdisplay = get_xdisplay (NULL); -+ XkbStateRec state; -+ -+ if (default_layouts == NULL) { -+ g_warning ("Your system seems not to support XKB."); -+ return 0; -+ } -+ -+ if (xdisplay == NULL) { -+ g_warning ("ibus-xkb is not initialized."); -+ return 0; -+ } -+ -+ if (XkbGetState (xdisplay, XkbUseCoreKbd, &state) != Success) { -+ g_warning ("Could not get state"); -+ return 0; -+ } -+ -+ return state.group; -+} -diff --git a/engine/xkblib.h b/engine/xkblib.h -new file mode 100644 -index 0000000..36597c3 ---- /dev/null -+++ b/engine/xkblib.h -@@ -0,0 +1,41 @@ -+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ -+/* vim:set et sts=4: */ -+/* bus - The Input Bus -+ * Copyright (C) 2012 Takao Fujiwara -+ * Copyright (C) 2012 Peng Huang -+ * Copyright (C) 2012 Red Hat, Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the -+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -+ * Boston, MA 02111-1307, USA. -+ */ -+#ifndef __XKBLIB_H_ -+#define __XKBLIB_H_ -+ -+#include -+ -+G_BEGIN_DECLS -+ -+void ibus_xkb_init (Display *xdisplay); -+void ibus_xkb_finit (void); -+gchar *ibus_xkb_get_current_layout (void); -+gchar *ibus_xkb_get_current_variant (void); -+gchar *ibus_xkb_get_current_option (void); -+gboolean ibus_xkb_set_layout (const char *layouts, -+ const char *variants, -+ const char *options); -+int ibus_xkb_get_current_group (void); -+ -+G_END_DECLS -+#endif diff --git a/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 = "space"; - private const string ACCELERATOR_SWITCH_IME_BACKWARD = "space"; -+ private string[] ACCELERATOR_IME_HOTKEYS = {}; + +- private uint m_switch_keysym = 0; +- private Gdk.ModifierType m_switch_modifiers = 0; ++ private GLib.List m_keybindings = new GLib.List(); public Panel(IBus.Bus bus) { GLib.assert(bus.is_connected()); -@@ -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 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 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) 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 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 +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 -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-branding-switcher-ui.patch b/ibus-xx-branding-switcher-ui.patch deleted file mode 100644 index 5b7ae3b..0000000 --- a/ibus-xx-branding-switcher-ui.patch +++ /dev/null @@ -1,213 +0,0 @@ -diff --git a/ui/gtk3/switcher.vala b/ui/gtk3/switcher.vala -index 52b0577..7821221 100644 ---- a/ui/gtk3/switcher.vala -+++ b/ui/gtk3/switcher.vala -@@ -24,6 +24,8 @@ using IBus; - using GLib; - using Gtk; - using Gdk; -+using Pango; -+using Atk; - - class Switcher : Gtk.Window { - private class Keybinding { -@@ -53,6 +55,7 @@ class Switcher : Gtk.Window { - Gdk.ModifierType.BUTTON5_MASK); - - private Gtk.Box m_box; -+ private Gtk.Label m_label; - private Gtk.Button[] m_buttons = {}; - private IBus.EngineDesc[] m_engines; - private uint m_selected_engine; -@@ -60,6 +63,8 @@ class Switcher : Gtk.Window { - private GLib.MainLoop m_loop; - private unowned GLib.List m_keybindings; - private int m_result; -+ private int m_default_font_size = 16; -+ private const int m_desc_label_max_len = 20; - - public Switcher() { - GLib.Object( -@@ -71,8 +76,23 @@ class Switcher : Gtk.Window { - modal : true, - focus_visible : true - ); -- m_box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); -- add(m_box); -+ Gtk.Box vbox = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); -+ add(vbox); -+ Gtk.Alignment align = new Gtk.Alignment(0.5f, 0.5f, 0.0f, 0.0f); -+ vbox.pack_start(align, true, true, 0); -+ m_box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0); -+ align.add(m_box); -+ m_label = new Gtk.Label(""); -+ -+ /* Set the accessible role of the label to a status bar so it -+ * will emit name changed events that can be used by screen -+ * readers. -+ */ -+ Atk.Object obj = m_label.get_accessible(); -+ obj.set_role (Atk.Role.STATUSBAR); -+ -+ m_label.set_padding(3, 3); -+ vbox.pack_end(m_label, false, false, 0); - - grab_focus(); - } -@@ -88,6 +108,7 @@ class Switcher : Gtk.Window { - update_engines(engines); - m_result = 0; - m_selected_engine = index; -+ m_label.set_text(m_buttons[index].get_data("longname")); - m_buttons[index].grab_focus(); - m_keybindings = (GLib.List) keybindings; - -@@ -168,6 +189,35 @@ class Switcher : Gtk.Window { - return m_result; - } - -+ private Gtk.Button ime_button_new(IBus.EngineDesc engine) { -+ var language = engine.get_language(); -+ var symbol = engine.get_symbol(); -+ var id = language; -+ -+ if (id.length > 2) { -+ id = id[0:2]; -+ } -+ if (symbol.length != 0) { -+ id = symbol; -+ } -+ -+ var button = new Gtk.Button(); -+ Gtk.Alignment align = new Gtk.Alignment(0.5f, 0.5f, 0.0f, 0.0f); -+ button.add(align); -+ Gtk.Box box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); -+ align.add(box); -+ -+ Gtk.Label label = new Gtk.Label(id); -+ string id_font = "%d".printf(m_default_font_size); -+ string markup = "%s".printf(id_font, id); -+ -+ label.set_markup(markup); -+ box.pack_start(label, false, false, 0); -+ -+ return button; -+ } -+ -+ /* Based on metacity/src/ui/tabpopup.c:meta_ui_tab_popup_new */ - private void update_engines(IBus.EngineDesc[] engines) { - foreach (var button in m_buttons) { - button.destroy(); -@@ -179,28 +229,15 @@ class Switcher : Gtk.Window { - return; - } - -- int width, height; -- Gtk.icon_size_lookup(Gtk.IconSize.MENU, out width, out height); - m_engines = engines; -+ int max_label_width = 0; -+ - for (int i = 0; i < m_engines.length; i++) { - var index = i; - var engine = m_engines[i]; -+ var button = ime_button_new(engine); - var longname = engine.get_longname(); -- var language = engine.get_language(); -- var symbol = engine.get_symbol(); -- var id = language; -- -- if (id.length > 2) { -- id = id[0:2]; -- } -- if (symbol.length != 0) { -- id = symbol; -- } -- var label = "%-15s %s".printf(longname, id); -- var button = new Gtk.Button.with_label(label); -- button.set_image(new IconWidget(engine.get_icon(), width)); - button.set_relief(Gtk.ReliefStyle.NONE); -- button.set_alignment(1.0f, 0.0f); - button.show(); - - button.enter_notify_event.connect((e) => { -@@ -216,12 +253,40 @@ class Switcher : Gtk.Window { - return true; - }); - -+ if (longname.length > m_desc_label_max_len) { -+ longname = longname[0:m_desc_label_max_len]; -+ } -+ -+ button.set_data("longname", longname); -+ m_label.set_label(longname); -+ -+ int width; -+ m_label.get_preferred_width(null, out width); -+ max_label_width = int.max(max_label_width, width); -+ - m_box.pack_start(button, true, true); - m_buttons += button; - } - -- // Cause window recalculate the perferred size. -- resize(1, 1); -+ m_label.set_text(m_buttons[0].get_data("longname")); -+ m_label.set_ellipsize(Pango.EllipsizeMode.END); -+ -+ Gdk.Display display = Gdk.Display.get_default(); -+ Gdk.Screen screen = (display != null) ? -+ display.get_default_screen() : null; -+ int screen_width = 0; -+ -+ if (screen != null) { -+ screen_width = screen.get_width(); -+ } -+ -+ if (screen_width > 0 && max_label_width > (screen_width / 4)) { -+ max_label_width = screen_width / 4; -+ } -+ -+ /* add random padding */ -+ max_label_width += 20; -+ set_default_size(max_label_width, -1); - } - - private void next_engine() { -@@ -229,6 +294,7 @@ class Switcher : Gtk.Window { - m_selected_engine = 0; - else - m_selected_engine ++; -+ m_label.set_text(m_buttons[m_selected_engine].get_data("longname")); - set_focus(m_buttons[m_selected_engine]); - } - -@@ -237,6 +303,7 @@ class Switcher : Gtk.Window { - m_selected_engine = m_engines.length - 1; - else - m_selected_engine --; -+ m_label.set_text(m_buttons[m_selected_engine].get_data("longname")); - set_focus(m_buttons[m_selected_engine]); - } - -@@ -267,18 +334,18 @@ class Switcher : Gtk.Window { - - switch (pe->keyval) { - case 0x08fb: /* leftarrow */ -- case 0xff51: /* Down */ -+ case 0xff51: /* Left */ -+ previous_engine(); - break; - case 0x08fc: /* uparrow */ - case 0xff52: /* Up */ -- previous_engine(); - break; - case 0x08fd: /* rightarrow */ - case 0xff53: /* Right */ -+ next_engine(); - break; - case 0x08fe: /* downarrow */ - case 0xff54: /* Down */ -- next_engine(); - break; - default: - debug("0x%04x", pe->keyval); 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 -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 +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 @@ 6 - True + True + False The shortcut keys for switching to next input method in the list 0 - Next input method: -@@ -116,7 +116,7 @@ +@@ -121,7 +121,7 @@ - True + True False + False The shortcut keys for switching to previous input method in the list - 0 -@@ -137,7 +137,7 @@ +@@ -144,7 +144,7 @@ True True @@ -112,8 +126,8 @@ + - 0 -@@ -145,7 +145,9 @@ + True +@@ -154,7 +154,9 @@ @@ -121,10 +135,10 @@ + + gtk-apply + True + False True True - False -@@ -160,11 +162,12 @@ +@@ -172,11 +174,12 @@ 1 2 @@ -135,96 +149,99 @@ - True + True + False 6 - -@@ -199,7 +202,7 @@ +@@ -217,7 +220,7 @@ - True + True + False 6 - -@@ -248,7 +251,7 @@ +@@ -273,7 +276,7 @@ - True + True + False 0 Enable: - -@@ -261,7 +264,7 @@ +@@ -287,7 +290,7 @@ - True + True + False 6 - -@@ -296,7 +299,7 @@ +@@ -328,7 +331,7 @@ - True + True + False 0 Disable: - -@@ -309,7 +312,7 @@ +@@ -342,7 +345,7 @@ - True + True + False 6 - -@@ -406,7 +409,7 @@ +@@ -452,7 +455,7 @@ - True + True + False Set the behavior of ibus how to show or hide language bar 0 - Show language panel: -@@ -433,7 +436,7 @@ +@@ -481,7 +484,7 @@ - True + True + False model_panel_show_mode - -@@ -470,7 +473,7 @@ - +@@ -521,7 +524,7 @@ Show icon on system tray + False - True + True True False Show icon on system tray -@@ -486,7 +489,7 @@ - +@@ -540,7 +543,7 @@ Show input method name on language bar + False - True + True True False Show input method's name on language bar when check the checkbox -@@ -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> - True + True + False 0 none - +-- +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 -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 /desktop/ibus/panel/custom_font ibus 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 - 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 - 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