From 16eb651bf80aef0e79ef81b3a1c985815941efdf Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Mon, 10 Dec 2012 16:59:35 +0900 Subject: [PATCH] Resolves #869584 - Removed libgnomekbd dependency in f18. --- .gitignore | 1 + ibus-530711-preload-sys.patch | 10 +- ibus-541492-xkb.patch | 384 ++++++++++-------------------- ibus-xx-no-use.diff | 307 ++++++++++++++++++------ ibus-xx-setup-frequent-lang.patch | 2 +- ibus.spec | 27 ++- sources | 1 + 7 files changed, 386 insertions(+), 346 deletions(-) diff --git a/.gitignore b/.gitignore index c4e66f1..91e9fed 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ ibus-1.3.6.tar.gz /ibus-gjs-3.4.1.20120428.tar.gz /ibus-gjs-3.4.1.20120518.tar.gz /ibus-gjs-3.4.1.20120815.tar.gz +/ibus-po-1.4.99.20121207.tar.gz diff --git a/ibus-530711-preload-sys.patch b/ibus-530711-preload-sys.patch index f4b8fff..0870cc1 100644 --- a/ibus-530711-preload-sys.patch +++ b/ibus-530711-preload-sys.patch @@ -1,4 +1,4 @@ -From 456ea33621814aa08ca62e31f7cb1e770ebb3670 Mon Sep 17 00:00:00 2001 +From dfe858f7ba476aa878c5d60a7480a03def558463 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Tue, 27 Nov 2012 15:53:27 +0900 Subject: [PATCH] Reload preload engines until users customize the list. @@ -228,10 +228,10 @@ index 737b3e2..8ce5a16 100644 * @x: x coordinate. * @y: y coordinate. diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala -index 1aca443..1ec2579 100644 +index 63b0cde..c4c8f2c 100644 --- a/ui/gtk3/panel.vala +++ b/ui/gtk3/panel.vala -@@ -309,6 +309,8 @@ class Panel : IBus.PanelService { +@@ -313,6 +313,8 @@ class Panel : IBus.PanelService { if (m_config != null) { m_config.value_changed.connect(config_value_changed_cb); m_config.watch("general", "preload_engines"); @@ -240,7 +240,7 @@ index 1aca443..1ec2579 100644 m_config.watch("general", "engines_order"); m_config.watch("general", "switcher_delay_time"); m_config.watch("general/hotkey", "trigger_accel"); -@@ -417,7 +419,136 @@ class Panel : IBus.PanelService { +@@ -425,7 +427,136 @@ class Panel : IBus.PanelService { init_gkbd(); } @@ -377,7 +377,7 @@ index 1aca443..1ec2579 100644 } private void update_xkb_engines() { -@@ -580,6 +711,11 @@ class Panel : IBus.PanelService { +@@ -591,6 +722,11 @@ class Panel : IBus.PanelService { string section, string name, Variant variant) { diff --git a/ibus-541492-xkb.patch b/ibus-541492-xkb.patch index 3e26c70..e72ec44 100644 --- a/ibus-541492-xkb.patch +++ b/ibus-541492-xkb.patch @@ -1,6 +1,6 @@ -From 8ca5d79b3f919621df691f8acbec58b206b15aa2 Mon Sep 17 00:00:00 2001 +From 965f09a94744b6374656247ff091eb91b5bad0b2 Mon Sep 17 00:00:00 2001 From: fujiwarat -Date: Tue, 27 Nov 2012 15:53:14 +0900 +Date: Mon, 10 Dec 2012 16:24:34 +0900 Subject: [PATCH] Add ibus-xkb and libgnomekbd. --- @@ -11,7 +11,7 @@ Subject: [PATCH] Add ibus-xkb and libgnomekbd. data/ibus.schemas.in | 94 +++++++ engine/Makefile.am | 6 + engine/ibus-xkb/Makefile.am | 61 ++++ - engine/ibus-xkb/ibus-xkb-main.c | 177 ++++++++++++ + engine/ibus-xkb/ibus-xkb-main.c | 173 ++++++++++++ engine/ibus-xkb/xkblib.c | 327 ++++++++++++++++++++++ engine/ibus-xkb/xkblib.h | 41 +++ engine/main.vala | 86 ++++++ @@ -26,11 +26,9 @@ Subject: [PATCH] Add ibus-xkb and libgnomekbd. ui/gtk3/Makefile.am | 37 +++ ui/gtk3/gkbdlayout.vala.false | 63 +++++ ui/gtk3/gkbdlayout.vala.true | 108 +++++++ - ui/gtk3/keybindingmanager.vala | 14 +- - ui/gtk3/panel.vala | 353 ++++++++++++++++++++--- - ui/gtk3/switcher.vala | 49 ++-- - ui/gtk3/xkblayout.vala | 464 ++++++++++++++++++++++++++++++ - 26 files changed, 2626 insertions(+), 667 deletions(-) + ui/gtk3/panel.vala | 362 ++++++++++++++++++++++-- + ui/gtk3/xkblayout.vala | 465 ++++++++++++++++++++++++++++++ + 24 files changed, 2597 insertions(+), 639 deletions(-) create mode 100644 bindings/vala/Gkbd-3.0.metadata create mode 100644 bindings/vala/Xkl-1.0.metadata create mode 100644 engine/ibus-xkb/Makefile.am @@ -404,10 +402,10 @@ index 0000000..4a32e87 +-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..3878b5f +index 0000000..3dfd987 --- /dev/null +++ b/engine/ibus-xkb/ibus-xkb-main.c -@@ -0,0 +1,177 @@ +@@ -0,0 +1,173 @@ +/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ +/* vim:set et sts=4: */ +/* bus - The Input Bus @@ -547,10 +545,6 @@ index 0000000..3878b5f + ibus_xkb_init (xdisplay); + + if (layout) { -+ if (variant == NULL) { -+ variant = ibus_xkb_get_current_variant (); -+ } -+ + if (option == NULL) { + option = ibus_xkb_get_current_option (); + } @@ -2774,69 +2768,8 @@ index 0000000..2b78c69 + } + */ +} -diff --git a/ui/gtk3/keybindingmanager.vala b/ui/gtk3/keybindingmanager.vala -index 12d731d..0f6b7c9 100644 ---- a/ui/gtk3/keybindingmanager.vala -+++ b/ui/gtk3/keybindingmanager.vala -@@ -41,15 +41,18 @@ public class KeybindingManager : GLib.Object { - private class Keybinding { - public Keybinding(uint keysym, - Gdk.ModifierType modifiers, -- KeybindingHandlerFunc handler) { -+ KeybindingHandlerFunc handler, -+ bool reverse) { - this.keysym = keysym; - this.modifiers = modifiers; - this.handler = handler; -+ this.reverse = reverse; - } - - public uint keysym { get; set; } - public Gdk.ModifierType modifiers { get; set; } - public unowned KeybindingHandlerFunc handler { get; set; } -+ public bool reverse { get; set; } - } - - /** -@@ -57,7 +60,7 @@ public class KeybindingManager : GLib.Object { - * - * @param event passing on gdk event - */ -- public delegate void KeybindingHandlerFunc(Gdk.Event event); -+ public delegate void KeybindingHandlerFunc(Gdk.Event event, bool reverse); - - - private KeybindingManager() { -@@ -73,7 +76,8 @@ public class KeybindingManager : GLib.Object { - */ - public bool bind(uint keysym, - Gdk.ModifierType modifiers, -- KeybindingHandlerFunc handler) { -+ KeybindingHandlerFunc handler, -+ bool reverse) { - unowned X.Display display = Gdk.x11_get_default_xdisplay(); - - int keycode = display.keysym_to_keycode(keysym); -@@ -84,7 +88,7 @@ public class KeybindingManager : GLib.Object { - grab_keycode (Gdk.Display.get_default(), keysym, modifiers); - - // store binding -- Keybinding binding = new Keybinding(keysym, modifiers, handler); -+ Keybinding binding = new Keybinding(keysym, modifiers, handler, reverse); - m_bindings.append(binding); - - return true; -@@ -199,7 +203,7 @@ public class KeybindingManager : GLib.Object { - if (event.key.keyval != binding.keysym || - modifiers != binding.modifiers) - continue; -- binding.handler(event); -+ binding.handler(event, binding.reverse); - return; - } - } diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala -index c159693..1aca443 100644 +index c159693..63b0cde 100644 --- a/ui/gtk3/panel.vala +++ b/ui/gtk3/panel.vala @@ -21,6 +21,20 @@ @@ -2880,37 +2813,40 @@ index c159693..1aca443 100644 public Panel(IBus.Bus bus) { GLib.assert(bus.is_connected()); -@@ -60,7 +81,6 @@ class Panel : IBus.PanelService { +@@ -60,7 +81,8 @@ class Panel : IBus.PanelService { m_candidate_panel.page_down.connect((w) => this.page_down()); m_switcher = new Switcher(); - bind_switch_shortcut(); ++ // The initial shortcut is "space" ++ bind_switch_shortcut(null); if (m_switcher_delay_time >= 0) { m_switcher.set_popup_delay_time((uint) m_switcher_delay_time); -@@ -76,64 +96,129 @@ class Panel : IBus.PanelService { +@@ -76,64 +98,132 @@ class Panel : IBus.PanelService { ~Panel() { unbind_switch_shortcut(); -- } - -- private void bind_switch_shortcut() { -- var keybinding_manager = KeybindingManager.get_instance(); ++ + if (HAVE_IBUS_GKBD && m_gkbdlayout != null) { + m_gkbdlayout.changed.disconnect(gkbdlayout_changed_cb); + m_gkbdlayout.stop_listen(); + m_gkbdlayout = null; + } - -- var accelerator = ACCELERATOR_SWITCH_IME_FOREWARD; -+ m_xkblayout = null; -+ } + ++ m_xkblayout = null; + } + +- private void bind_switch_shortcut() { +- var keybinding_manager = KeybindingManager.get_instance(); + private void keybinding_manager_bind(KeybindingManager keybinding_manager, -+ string? accelerator, -+ bool reverse) { ++ string? accelerator) { + uint switch_keysym = 0; + Gdk.ModifierType switch_modifiers = 0; ++ Gdk.ModifierType reverse_modifier = Gdk.ModifierType.SHIFT_MASK; ++ Keybinding keybinding; + +- var accelerator = ACCELERATOR_SWITCH_IME_FOREWARD; Gtk.accelerator_parse(accelerator, - out m_switch_keysym, out m_switch_modifiers); + out switch_keysym, out switch_modifiers); @@ -2950,75 +2886,73 @@ index c159693..1aca443 100644 } - keybinding_manager.bind(m_switch_keysym, m_switch_modifiers, -- (e) => handle_engine_switch(e, false)); -+ Keybinding keybinding = new Keybinding(switch_keysym, -+ switch_modifiers, -+ reverse); ++ keybinding = new Keybinding(switch_keysym, ++ switch_modifiers, ++ false); + 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, _reverse) => handle_engine_switch(e, _reverse), -+ reverse); + (e) => handle_engine_switch(e, false)); + + // accelerator already has Shift mask +- if ((m_switch_modifiers & Gdk.ModifierType.SHIFT_MASK) != 0) ++ if ((switch_modifiers & reverse_modifier) != 0) { + return; ++ } + +- keybinding_manager.bind(m_switch_keysym, +- m_switch_modifiers | Gdk.ModifierType.SHIFT_MASK, ++ switch_modifiers |= reverse_modifier; ++ keybinding = new Keybinding(switch_keysym, ++ switch_modifiers, ++ true); ++ m_keybindings.append(keybinding); ++ ++ keybinding_manager.bind(switch_keysym, switch_modifiers, + (e) => handle_engine_switch(e, true)); ++ + } + + // ToDo: Customize the input method with ibus-setup -+ private void bind_switch_shortcut() { ++ private void bind_switch_shortcut(Variant ?variant) { + 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; ++ string[] accelerators = {}; ++ Variant var_trigger = variant; + -+ if (m_config != null) { -+ GLib.Variant variant = m_config.get_value("general/hotkey", -+ "trigger_accel"); -+ if (variant != null) { -+ ACCELERATOR_IME_HOTKEYS = variant.dup_strv(); -+ } ++ if (var_trigger == null && m_config != null) { ++ var_trigger = m_config.get_value("general/hotkey", ++ "trigger_accel"); + } + -+ if (ACCELERATOR_IME_HOTKEYS.length == 1 && -+ ACCELERATOR_IME_HOTKEYS[0] == ACCELERATOR_SWITCH_IME_FOREWARD) { ++ if (var_trigger != null) { ++ accelerators = var_trigger.dup_strv(); ++ } else { ++ accelerators += ACCELERATOR_SWITCH_IME_FOREWARD; ++ } ++ ++ if (accelerators.length == 1 && ++ accelerators[0] == ACCELERATOR_SWITCH_IME_FOREWARD) { + // FIXME: When us keyboard is used, Zenkaku_Hankaku does not work. + /* + if (locale[0:2] == "ja") { -+ ACCELERATOR_IME_HOTKEYS += "Zenkaku_Hankaku"; ++ accelerators += "Zenkaku_Hankaku"; + } + */ + if (locale[0:2] == "ko") { -+ ACCELERATOR_IME_HOTKEYS += "Hangul"; -+ ACCELERATOR_IME_HOTKEYS += "Alt_R"; ++ accelerators += "Hangul"; ++ accelerators += "Alt_R"; + } + } + + var keybinding_manager = KeybindingManager.get_instance(); + -+ foreach (var accelerator in ACCELERATOR_IME_HOTKEYS) { -+ keybinding_manager_bind(keybinding_manager, accelerator, false); -+ } -+ -+ ACCELERATOR_IME_HOTKEYS = {}; -+ ACCELERATOR_IME_HOTKEYS += ACCELERATOR_SWITCH_IME_BACKWARD; -+ -+ if (m_config != null) { -+ GLib.Variant variant = m_config.get_value("general/hotkey", -+ "trigger_accel_backward"); -+ if (variant != null) { -+ ACCELERATOR_IME_HOTKEYS = variant.dup_strv(); -+ } -+ } - -- keybinding_manager.bind(m_switch_keysym, -- m_switch_modifiers | Gdk.ModifierType.SHIFT_MASK, -- (e) => handle_engine_switch(e, true)); -+ foreach (var accelerator in ACCELERATOR_IME_HOTKEYS) { -+ keybinding_manager_bind(keybinding_manager, accelerator, true); ++ foreach (var accelerator in accelerators) { ++ keybinding_manager_bind(keybinding_manager, accelerator); + } } @@ -3028,44 +2962,40 @@ index c159693..1aca443 100644 - if (m_switch_keysym == 0 && m_switch_modifiers == 0) - return; + unowned GLib.List keybindings = m_keybindings; ++ ++ while (keybindings != null) { ++ Keybinding keybinding = keybindings.data; - keybinding_manager.unbind(m_switch_keysym, m_switch_modifiers); - keybinding_manager.unbind(m_switch_keysym, - m_switch_modifiers | Gdk.ModifierType.SHIFT_MASK); -+ while (keybindings != null) { -+ Keybinding keybinding = keybindings.data; ++ keybinding_manager.unbind(keybinding.keysym, ++ keybinding.modifiers); ++ keybindings = keybindings.next; ++ } - m_switch_keysym = 0; - m_switch_modifiers = 0; -+ keybinding_manager.unbind(keybinding.keysym, -+ keybinding.modifiers); -+ -+ // Need to get keybindings.next before GList.remove is called. -+ keybindings = keybindings.next; -+ m_keybindings.remove(keybinding); -+ } ++ m_keybindings = null; } private void set_custom_font() { -@@ -220,13 +305,17 @@ class Panel : IBus.PanelService { - } - - m_config = config; -+ bind_switch_shortcut(); - if (m_config != null) { - m_config.value_changed.connect(config_value_changed_cb); +@@ -225,10 +315,14 @@ class Panel : IBus.PanelService { m_config.watch("general", "preload_engines"); m_config.watch("general", "engines_order"); m_config.watch("general", "switcher_delay_time"); + m_config.watch("general/hotkey", "trigger_accel"); -+ m_config.watch("general/hotkey", "trigger_accel_backward"); m_config.watch("panel", "custom_font"); m_config.watch("panel", "use_custom_font"); + init_engines_order(); update_engines(m_config.get_value("general", "preload_engines"), m_config.get_value("general", "engines_order")); ++ unbind_switch_shortcut(); ++ bind_switch_shortcut(null); set_switcher_delay_time(null); -@@ -282,6 +371,194 @@ class Panel : IBus.PanelService { + } else { + update_engines(null, null); +@@ -282,6 +376,200 @@ class Panel : IBus.PanelService { } } @@ -3110,8 +3040,11 @@ index c159693..1aca443 100644 + } + + m_xkblayout = new XKBLayout(m_config); ++ string session = Environment.get_variable("DESKTOP_SESSION"); + -+ if (HAVE_IBUS_GKBD) { ++ if (HAVE_IBUS_GKBD && ++ session != null && session.length >= 5 && ++ session[0:5] == "gnome") { + init_gkbd(); + } + @@ -3203,7 +3136,10 @@ index c159693..1aca443 100644 + } + + private void set_xkb_group_layout(string layout) { -+ int[] retval = m_xkblayout.set_layout(layout); ++ int[] retval = m_xkblayout.set_layout(layout, ++ "default", ++ "default", ++ true); + if (retval[0] >= 0) { + /* If an XKB keymap is added into the XKB group, + * this._gkbdlayout.lock_group will be called after @@ -3246,7 +3182,7 @@ index c159693..1aca443 100644 + init_engines_order(); + } + -+ if (HAVE_IBUS_GKBD) { ++ if (HAVE_IBUS_GKBD && m_gkbdlayout != null) { + if (set_gkbd_layout(layout)) { + return; + } @@ -3260,7 +3196,7 @@ index c159693..1aca443 100644 private void switch_engine(int i, bool force = false) { GLib.assert(i >= 0 && i < m_engines.length); -@@ -296,7 +573,7 @@ class Panel : IBus.PanelService { +@@ -296,7 +584,7 @@ class Panel : IBus.PanelService { return; } // set xkb layout @@ -3269,133 +3205,58 @@ index c159693..1aca443 100644 } private void config_value_changed_cb(IBus.Config config, -@@ -308,6 +585,13 @@ class Panel : IBus.PanelService { +@@ -308,6 +596,12 @@ class Panel : IBus.PanelService { return; } -+ if (section == "general/hotkey" && -+ name.length >= 13 && name[0:13] == "trigger_accel") { ++ if (section == "general/hotkey" && name == "trigger_accel") { + unbind_switch_shortcut(); -+ bind_switch_shortcut(); ++ bind_switch_shortcut(variant); + return; + } + if (section == "panel" && (name == "custom_font" || name == "use_custom_font")) { set_custom_font(); -@@ -331,8 +615,7 @@ class Panel : IBus.PanelService { +@@ -316,6 +610,7 @@ class Panel : IBus.PanelService { + + if (section == "general" && name == "switcher_delay_time") { + set_switcher_delay_time(variant); ++ return; + } + } + +@@ -324,15 +619,22 @@ class Panel : IBus.PanelService { + if (m_engines.length <= 1) + return; + ++ uint keyval = event.key.keyval; ++ uint modifiers = KeybindingManager.MODIFIER_FILTER & event.key.state; ++ + uint primary_modifiers = + KeybindingManager.get_primary_modifier(event.key.state); + + bool pressed = KeybindingManager.primary_modifier_still_pressed( event, primary_modifiers); ++ ++ if (revert) { ++ modifiers &= ~Gdk.ModifierType.SHIFT_MASK; ++ } ++ if (pressed && m_switcher_delay_time >= 0) { int i = revert ? m_engines.length - 1 : 1; - i = m_switcher.run(m_switch_keysym, m_switch_modifiers, event, - m_engines, i); -+ i = m_switcher.run(m_keybindings, event, m_engines, i); ++ i = m_switcher.run(keyval, modifiers, event, m_engines, i); if (i < 0) { debug("switch cancelled"); } else { -diff --git a/ui/gtk3/switcher.vala b/ui/gtk3/switcher.vala -index c5286b1..8836cb2 100644 ---- a/ui/gtk3/switcher.vala -+++ b/ui/gtk3/switcher.vala -@@ -63,13 +63,26 @@ class Switcher : Gtk.Window { - public string longname { get; set; } - } - -+ private class Keybinding { -+ public Keybinding(uint keysym, -+ Gdk.ModifierType modifiers, -+ bool reverse) { -+ this.keysym = keysym; -+ this.modifiers = modifiers; -+ this.reverse = reverse; -+ } -+ -+ public uint keysym { get; set; } -+ public Gdk.ModifierType modifiers { get; set; } -+ public bool reverse { get; set; } -+ } -+ - private Gtk.Box m_box; - private Gtk.Label m_label; - private IBusEngineButton[] m_buttons = {}; - private IBus.EngineDesc[] m_engines; - private uint m_selected_engine; -- 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; -@@ -109,19 +122,17 @@ class Switcher : Gtk.Window { - grab_focus(); - } - -- 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); - -- 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); - - update_engines(engines); - /* Let gtk recalculate the window size. */ -@@ -328,27 +339,29 @@ class Switcher : Gtk.Window { - public override bool key_press_event(Gdk.EventKey e) { - bool retval = true; - Gdk.EventKey *pe = &e; -+ uint modifiers = KeybindingManager.MODIFIER_FILTER & pe->state; - - if (m_popup_delay_time > 0) { - restore_window_position("pressed"); - } - -- do { -- uint modifiers = KeybindingManager.MODIFIER_FILTER & pe->state; -+ for (unowned GLib.List keybindings = m_keybindings; -+ keybindings != null; -+ keybindings = keybindings.next) { -+ Keybinding keybinding = keybindings.data; - -- if ((modifiers != m_modifiers) && -- (modifiers != (m_modifiers | Gdk.ModifierType.SHIFT_MASK))) { -- break; -- } -- -- if (pe->keyval == m_keyval) { -- if (modifiers == m_modifiers) -+ if (pe->keyval == keybinding.keysym && -+ modifiers == (uint) keybinding.modifiers) { -+ if (!keybinding.reverse) { - next_engine(); -- else // modififers == m_modifiers | SHIFT_MASK -+ } else { - previous_engine(); -- break; -+ } -+ return true; - } -+ } - -+ 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..33e9d9d +index 0000000..2092a60 --- /dev/null +++ b/ui/gtk3/xkblayout.vala -@@ -0,0 +1,464 @@ +@@ -0,0 +1,465 @@ +/* vim:set et sts=4 sw=4: + * + * ibus - The Input Bus @@ -3646,7 +3507,8 @@ index 0000000..33e9d9d + + public int[] set_layout(string _layout="default", + string _variant="default", -+ string _option="default") { ++ string _option="default", ++ bool use_group_layout=false) { + assert (_layout != null); + + int xkb_group_id = 0; @@ -3709,7 +3571,7 @@ index 0000000..33e9d9d + layout = m_default_layout; + variant = m_default_variant; + } else { -+ if (HAVE_IBUS_GKBD) { ++ if (use_group_layout) { + if (variant == "default") { + variant = ""; + } diff --git a/ibus-xx-no-use.diff b/ibus-xx-no-use.diff index 6d4636c..d95bd4c 100644 --- a/ibus-xx-no-use.diff +++ b/ibus-xx-no-use.diff @@ -1,19 +1,39 @@ -From 907edb10fd53e91f05bb4327df201345525f4d90 Mon Sep 17 00:00:00 2001 +From fdec59545fb94f768c847730854ca03c5af2f652 Mon Sep 17 00:00:00 2001 From: fujiwarat -Date: Tue, 13 Nov 2012 22:38:19 +0900 +Date: Fri, 7 Dec 2012 17:59:49 +0900 Subject: [PATCH] Disabled to show non-used GUI. --- - setup/keyboardshortcut.py | 87 +++++++++++++++++++++++++---------------------- - setup/main.py | 23 +++++++------ - setup/setup.ui | 26 +++++++------- - 3 files changed, 72 insertions(+), 64 deletions(-) + setup/keyboardshortcut.py | 90 ++++++++++++++++++++++++----------------------- + setup/main.py | 45 +++++++++++++----------- + setup/setup.ui | 51 +++++++++++++++++---------- + 3 files changed, 103 insertions(+), 83 deletions(-) diff --git a/setup/keyboardshortcut.py b/setup/keyboardshortcut.py -index 3861d2f..efbdeb7 100644 +index 3861d2f..9349e42 100644 --- a/setup/keyboardshortcut.py +++ b/setup/keyboardshortcut.py -@@ -185,15 +185,17 @@ class KeyboardShortcutSelection(Gtk.VBox): +@@ -103,9 +103,8 @@ class KeyboardShortcutSelection(Gtk.VBox): + self.__modifier_buttons.append(("Hyper", + Gtk.CheckButton.new_with_mnemonic("_Hyper"), + Gdk.ModifierType.HYPER_MASK)) +- self.__modifier_buttons.append(("Capslock", +- Gtk.CheckButton.new_with_mnemonic("Capsloc_k"), +- Gdk.ModifierType.LOCK_MASK)) ++ # is not parsed by gtk_accelerator_parse() ++ # FIXME: Need to check if ibus gtk panel can enable . + self.__modifier_buttons.append(("Release", + Gtk.CheckButton.new_with_mnemonic("_Release"), + Gdk.ModifierType.RELEASE_MASK)) +@@ -119,7 +118,6 @@ class KeyboardShortcutSelection(Gtk.VBox): + table.attach(self.__modifier_buttons[4][1], 0, 1, 1, 2) + table.attach(self.__modifier_buttons[5][1], 1, 2, 1, 2) + table.attach(self.__modifier_buttons[6][1], 2, 3, 1, 2) +- table.attach(self.__modifier_buttons[7][1], 3, 4, 1, 2) + hbox.pack_start(table, True, True, 4) + self.pack_start(hbox, False, True, 4) + +@@ -185,19 +183,20 @@ class KeyboardShortcutSelection(Gtk.VBox): modifiers.append(name) if keycode.startswith("_"): keycode = keycode[1:] @@ -29,20 +49,18 @@ index 3861d2f..efbdeb7 100644 + (keyval, state) = Gtk.accelerator_parse(shortcut) + if keyval == 0 and state == 0: + return -+ keys = shortcut.split('>') for name, button, mask in self.__modifier_buttons: - if name in mods: + if state & mask: button.set_active(True) else: button.set_active(False) -@@ -247,54 +249,59 @@ class KeyboardShortcutSelection(Gtk.VBox): - self.__update_add_and_apply_buttons() +- self.__keycode_entry.set_text(keys[-1]) ++ self.__keycode_entry.set_text(shortcut.rsplit('>', 1)[-1]) - def __keycode_button_clicked_cb(self, button): -- out = [] - dlg = Gtk.MessageDialog(parent = self.get_toplevel(), buttons = Gtk.ButtonsType.CLOSE) -+ out = [dlg] + def __get_selected_shortcut(self): + model = self.__shortcut_view.get_model() +@@ -252,49 +251,52 @@ class KeyboardShortcutSelection(Gtk.VBox): message = _("Please press a key (or a key combination).\nThe dialog will be closed when the key is released.") dlg.set_markup(message) dlg.set_title(_("Please press a key (or a key combination)")) @@ -57,8 +75,7 @@ index 3861d2f..efbdeb7 100644 - dlg.connect("key-release-event", __key_release_event, None) + sw = Gtk.ScrolledWindow() + -+ def __accel_edited_cb(c, path, keyval, state, keycode, out): -+ dlg = out[0] ++ def __accel_edited_cb(c, path, keyval, state, keycode): + out.append(keyval) + out.append(state) + out.append(keycode) @@ -72,7 +89,7 @@ index 3861d2f..efbdeb7 100644 + column = Gtk.TreeViewColumn() + renderer = Gtk.CellRendererAccel(accel_mode=Gtk.CellRendererAccelMode.OTHER, + editable=True) -+ renderer.connect('accel-edited', __accel_edited_cb, out) ++ renderer.connect('accel-edited', __accel_edited_cb) + column.pack_start(renderer, True) + column.add_attribute(renderer, 'accel-mods', 0) + column.add_attribute(renderer, 'accel-key', 1) @@ -85,7 +102,7 @@ index 3861d2f..efbdeb7 100644 id = dlg.run() dlg.destroy() - if id != Gtk.ResponseType.OK or not out: -+ if id != Gtk.ResponseType.OK or len(out) == 1: ++ if id != Gtk.ResponseType.OK or len(out) < 3: return - keyevent = out[len(out) - 1] - state = keyevent.state & (Gdk.ModifierType.CONTROL_MASK | \ @@ -110,9 +127,9 @@ index 3861d2f..efbdeb7 100644 - state = state | Gdk.ModifierType.RELEASE_MASK - elif keyevent.keyval in (Gdk.KEY_Hyper_L, Gdk.KEY_Hyper_R) and state == Gdk.ModifierType.HYPER_MASK: - state = state | Gdk.ModifierType.RELEASE_MASK -+ keyval = out[1] -+ state = out[2] -+ keycode = out[3] ++ keyval = out[0] ++ state = out[1] ++ keycode = out[2] for name, button, mask in self.__modifier_buttons: if state & mask: @@ -126,58 +143,66 @@ index 3861d2f..efbdeb7 100644 + keycode, + state) + shortcut = shortcut.replace('', '') -+ keys = shortcut.split('>') -+ self.__keycode_entry.set_text(keys[-1]) ++ self.__keycode_entry.set_text(shortcut.rsplit('>', 1)[-1]) def __add_button_clicked_cb(self, button): shortcut = self.__get_shortcut_from_buttons() diff --git a/setup/main.py b/setup/main.py -index 46209b6..1b98e17 100644 +index 46209b6..aa8e935 100644 --- a/setup/main.py +++ b/setup/main.py -@@ -93,21 +93,23 @@ class Setup(object): +@@ -92,22 +92,24 @@ class Setup(object): + self.__init_ui() def __init_hotkey(self): - default_values = { +- default_values = { - "trigger" : (N_("trigger"), ["Control+space"]), - "enable_unconditional" : (N_("enable"), []), - "disable_unconditional" : (N_("disable"), []) -+ 'trigger_accel' : ('next_engine', ['space']), -+ 'trigger_accel_backward' : ('prev_engine', ['space']), - } - - values = dict(self.__config.get_values("general/hotkey")) - - for name, (label, shortcuts) in default_values.items(): - shortcuts = values.get(name, shortcuts) +- } +- +- values = dict(self.__config.get_values("general/hotkey")) +- +- for name, (label, shortcuts) in default_values.items(): +- shortcuts = values.get(name, shortcuts) - button = self.__builder.get_object("button_%s" % name) - entry = self.__builder.get_object("entry_%s" % name) -+ button = self.__builder.get_object("button_%s" % label) -+ entry = self.__builder.get_object("entry_%s" % label) - entry.set_text("; ".join(shortcuts)) +- entry.set_text("; ".join(shortcuts)) - entry.set_tooltip_text("\n".join(shortcuts)) -+ text = '\n'.join(shortcuts) -+ text = "Use ';' separated values\n" + text -+ entry.set_tooltip_text(text) - button.connect("clicked", self.__shortcut_button_clicked_cb, +- button.connect("clicked", self.__shortcut_button_clicked_cb, - label, "general/hotkey", name, entry) -+ name, "general/hotkey", label, entry) -+ button.set_tooltip_text("Save the left entry string") ++ name = 'trigger_accel' ++ label = 'switch_engine' ++ variant = self.__config.get_value('general/hotkey', name) ++ if variant != None: ++ shortcuts = variant.dup_strv() ++ else: ++ shortcuts = ['space'] ++ ++ button = self.__builder.get_object("button_%s" % label) ++ entry = self.__builder.get_object("entry_%s" % label) ++ entry.set_text("; ".join(shortcuts)) ++ tooltip = "\n".join(shortcuts) ++ tooltip += "\n" + \ ++ _("Use shortcut with shift to switch to the previous input method") ++ ++ entry.set_tooltip_text(tooltip) ++ button.connect("clicked", self.__shortcut_button_clicked_cb, ++ name, "general/hotkey", label, entry) def __init_panel(self): values = dict(self.__config.get_values("panel")) -@@ -449,7 +451,9 @@ class Setup(object): +@@ -449,7 +451,8 @@ class Setup(object): def __shortcut_button_clicked_cb(self, button, name, section, _name, entry): buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK) - title = _("Select keyboard shortcut for %s") % _(name) + title = _("Select keyboard shortcut for %s") % \ -+ _("next engine") if name == 'next_engine' else \ -+ _("previous engine") ++ _("switching input methods") dialog = keyboardshortcut.KeyboardShortcutSelectionDialog(buttons = buttons, title = title) text = entry.get_text() if text: -@@ -462,12 +466,11 @@ class Setup(object): +@@ -462,11 +465,13 @@ class Setup(object): dialog.destroy() if id != Gtk.ResponseType.OK: return @@ -185,21 +210,26 @@ index 46209b6..1b98e17 100644 + self.__config.set_value(section, name, GLib.Variant.new_strv(shortcuts)) text = "; ".join(shortcuts) entry.set_text(text) - entry.set_tooltip_text(text) - +- entry.set_tooltip_text(text) - ++ tooltip = "\n".join(shortcuts) ++ tooltip += "\n" + \ ++ _("Use shortcut with shift to switch to the previous input method") ++ entry.set_tooltip_text(tooltip) + def __item_started_column_toggled_cb(self, cell, path_str, model): - # get toggled iter diff --git a/setup/setup.ui b/setup/setup.ui -index 2026172..fb4340d 100644 +index 2026172..aa41453 100644 --- a/setup/setup.ui +++ b/setup/setup.ui -@@ -122,7 +122,6 @@ +@@ -121,8 +121,7 @@ + - True +- True - False ++ True False The shortcut keys for switching to previous input method in the list 0 @@ -220,23 +250,61 @@ index 2026172..fb4340d 100644 -@@ -223,7 +223,6 @@ +@@ -180,7 +180,7 @@ + False + 6 - +- ++ True -- False True False - -@@ -238,7 +237,6 @@ +@@ -192,7 +192,7 @@ + + + +- ++ ... False True +@@ -213,17 +213,17 @@ + 2 + 3 + 4 ++ GTK_FILL + + + + +- True ++ True + False + 6 + + +- True - False ++ True + True + False + +@@ -237,8 +237,7 @@ + + ... + False +- True +- False ++ True True False False -@@ -260,7 +258,7 @@ +@@ -256,11 +255,12 @@ + 2 + 4 + 5 ++ GTK_FILL + @@ -245,7 +313,7 @@ index 2026172..fb4340d 100644 False The shortcut keys for turning input method on or off 0 -@@ -273,7 +271,7 @@ +@@ -273,7 +273,7 @@ @@ -254,7 +322,7 @@ index 2026172..fb4340d 100644 False 0 Enable: -@@ -287,7 +285,7 @@ +@@ -287,7 +287,7 @@ @@ -263,7 +331,12 @@ index 2026172..fb4340d 100644 False 6 -@@ -328,7 +326,7 @@ +@@ -324,11 +324,12 @@ + 2 + 1 + 2 ++ GTK_FILL + @@ -272,7 +345,7 @@ index 2026172..fb4340d 100644 False 0 Disable: -@@ -342,7 +340,7 @@ +@@ -342,7 +343,7 @@ @@ -281,7 +354,28 @@ index 2026172..fb4340d 100644 False 6 -@@ -452,7 +450,7 @@ +@@ -379,6 +380,7 @@ + 2 + 2 + 3 ++ GTK_FILL + + + +@@ -431,6 +433,7 @@ + + + GTK_FILL ++ GTK_FILL + + + +@@ -448,11 +451,12 @@ + + 1 + 2 ++ GTK_FILL + @@ -290,7 +384,20 @@ index 2026172..fb4340d 100644 False Set the behavior of ibus how to show or hide language bar 0 -@@ -481,7 +479,7 @@ +@@ -463,6 +467,7 @@ + 1 + 2 + GTK_FILL ++ GTK_FILL + + + +@@ -477,11 +482,12 @@ + 2 + 3 + GTK_FILL ++ GTK_FILL + @@ -299,16 +406,30 @@ index 2026172..fb4340d 100644 False model_panel_show_mode -@@ -521,7 +519,7 @@ - - Show icon on system tray - False -- True -+ True - True - False - Show icon on system tray -@@ -540,7 +538,7 @@ +@@ -496,6 +502,7 @@ + 2 + 1 + 2 ++ GTK_FILL + + + +@@ -515,6 +522,7 @@ + 2 + 2 + 3 ++ GTK_FILL + + + +@@ -534,13 +542,14 @@ + 3 + 4 + GTK_FILL ++ GTK_FILL + + + Show input method name on language bar False @@ -317,7 +438,39 @@ index 2026172..fb4340d 100644 True False Show input method's name on language bar when check the checkbox -@@ -1001,7 +999,7 @@ You may use up/down buttons to change it.</i></small> +@@ -553,6 +562,7 @@ + 4 + 5 + GTK_FILL ++ GTK_FILL + + + +@@ -572,6 +582,7 @@ + 5 + 6 + GTK_FILL ++ GTK_FILL + + + +@@ -590,6 +601,7 @@ + 6 + 7 + GTK_FILL ++ GTK_FILL + + + +@@ -605,6 +617,7 @@ + 2 + 6 + 7 ++ GTK_FILL + + + +@@ -1001,7 +1014,7 @@ You may use up/down buttons to change it.</i></small> diff --git a/ibus-xx-setup-frequent-lang.patch b/ibus-xx-setup-frequent-lang.patch index ca70048..beddad3 100644 --- a/ibus-xx-setup-frequent-lang.patch +++ b/ibus-xx-setup-frequent-lang.patch @@ -1,4 +1,4 @@ -From d3ce0467bb7825cc97da9646254bc09f58119fda Mon Sep 17 00:00:00 2001 +From 58d4c946db3396897f36f71d33e939dfbbf0ebed Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Tue, 27 Nov 2012 15:53:34 +0900 Subject: [PATCH] Enable ibus-setup to show the frequently used languages diff --git a/ibus.spec b/ibus.spec index 3585ca7..d583ac9 100644 --- a/ibus.spec +++ b/ibus.spec @@ -11,6 +11,12 @@ %global with_gjs 1 %endif +%if (0%{?fedora} > 17 || 0%{?rhel} > 6) +%global with_gkbd 0 +%else +%global with_gkbd 1 +%endif + %global ibus_gjs_version 3.4.1.20120815 %global ibus_api_version 1.0 @@ -31,7 +37,7 @@ Name: ibus Version: 1.4.99.20121109 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Intelligent Input Bus for Linux OS License: LGPLv2+ Group: System Environment/Libraries @@ -39,8 +45,13 @@ URL: http://code.google.com/p/ibus/ Source0: http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz Source1: %{name}-xinput %if %with_gjs +# ibus-gjs Source2: http://fujiwara.fedorapeople.org/ibus/gnome-shell/%{name}-gjs-%{ibus_gjs_version}.tar.gz %endif +%if (0%{?fedora} < 19 && 0%{?rhel} < 7) +# Upstreamed translations. +Source3: http://fujiwara.fedorapeople.org/ibus/po/%{name}-po-1.4.99.20121207.tar.gz +%endif # Upstreamed patches. Patch0: %{name}-HEAD.patch # https://bugzilla.redhat.com/show_bug.cgi?id=810211 @@ -85,6 +96,8 @@ BuildRequires: intltool BuildRequires: iso-codes-devel %if %with_xkbfile BuildRequires: libxkbfile-devel +%endif +%if %with_gkbd BuildRequires: libgnomekbd-devel %endif %if %with_gjs @@ -115,7 +128,9 @@ Requires: im-chooser %endif Requires: dconf Requires: notify-python +%if %with_gkbd Requires: libgnomekbd +%endif Requires: librsvg2 Requires: gnome-icon-theme-legacy >= %{gnome_icon_theme_legacy_version} %if (0%{?fedora} <= 17 && 0%{?rhel} < 7) @@ -213,7 +228,10 @@ The ibus-devel-docs package contains developer documentation for ibus %prep %setup -q %if %with_gjs -zcat %SOURCE2 | tar xf - +gzip -dc %SOURCE2 | tar xf - +%endif +%if (0%{?fedora} < 19 && 0%{?rhel} < 7) +gzip -dc %SOURCE3 | tar xf - %endif # home [dot] corp [dot] redhat [dot] com/wiki/rpmdiff-multilib @@ -272,6 +290,8 @@ autoreconf -f -i %endif %if %with_xkbfile --with-xkb-command=ibus-xkb \ +%endif +%if %with_gkbd --enable-libgnomekbd \ %endif --enable-dconf \ @@ -463,6 +483,9 @@ fi %{_datadir}/gtk-doc/html/* %changelog +* Fri Dec 07 2012 Takao Fujiwara - 1.4.99.20121109-8 +- Resolves #869584 - Removed libgnomekbd dependency in f18. + * Fri Nov 30 2012 Takao Fujiwara - 1.4.99.20121109-7 - Set time stamp of ibus/_config.py diff --git a/sources b/sources index 65c440b..aa61f95 100644 --- a/sources +++ b/sources @@ -1,3 +1,4 @@ be482479357210283e91a47f43a0a0fe ibus-1.4.99.20121109.tar.gz 2d2ad58e3e41429dbd883ba7e501c9b2 ibus-gjs-3.2.1.20111230.tar.gz 8acf4ac4d1a7dfb9a0af9e755a8e7dba ibus-gjs-3.4.1.20120815.tar.gz +e2a13c45eea2cdb86572bbccec7a2e16 ibus-po-1.4.99.20121207.tar.gz