Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 603932 Details for
Bug 845956
ibus backward trigger key is not customized in ibus-setup
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch for ui/gtk3/panel.vala
ibus-845956-trigger-backward.patch (text/plain), 26.61 KB, created by
fujiwara
on 2012-08-13 09:18:21 UTC
(
hide
)
Description:
Patch for ui/gtk3/panel.vala
Filename:
MIME Type:
Creator:
fujiwara
Created:
2012-08-13 09:18:21 UTC
Size:
26.61 KB
patch
obsolete
>--- ibus-1.4.99.20120712/data/ibus.schemas.in.orig 2012-08-10 16:24:21.514224910 +0900 >+++ ibus-1.4.99.20120712/data/ibus.schemas.in 2012-08-13 17:28:34.212952257 +0900 >@@ -120,23 +120,15 @@ se,si,sk,sy,sy(ku),th,tj,tr,ua,uz,vn > </locale> > </schema> > <schema> >- <key>/schemas/desktop/ibus/general/hotkey/trigger_shift</key> >- <applyto>/desktop/ibus/general/hotkey/trigger_shift</applyto> >+ <key>/schemas/desktop/ibus/general/hotkey/trigger_accel_backward</key> >+ <applyto>/desktop/ibus/general/hotkey/trigger_accel_backward</applyto> > <owner>ibus</owner> > <type>list</type> > <list_type>string</list_type> >- <default>[]</default> >+ <default>[<Control><Shift>space]</default> > <locale name="C"> >- <short>This is used for gnome-shell to work shift + modifiers</short> >- <long>This is used for gnome-shell to work shift + modifiers >- Currently gnome-shell assigns the shift reverse by >- dconf key and the shift reverse works with modifiers. >- But ibus supports multiple trigger keys; >- <Control>space (with modifiers) >- Zenkaku_hankaku (without modifiers) >- I copy the modifier trigger keys here to set >- the shift reverse at the moment. >- </long> >+ <short>Trigger reverse shortcut keys for gtk_accelerator_parse</short> >+ <long>The reverse shortcut keys for turning input method on or off</long> > </locale> > </schema> > <schema> >--- ibus-1.4.99.20120712/setup/main.py.orig 2012-08-13 11:38:50.774627982 +0900 >+++ ibus-1.4.99.20120712/setup/main.py 2012-08-13 11:39:23.908233644 +0900 >@@ -83,7 +83,8 @@ class Setup(object): > } > ''' > default_values = { >- 'trigger_accel' : ('trigger', ['<Control>space']), >+ 'trigger_accel' : ('next_engine', ['<Control>space']), >+ 'trigger_accel_backward' : ('prev_engine', ['<Control><Shift>space']), > } > > values = dict(self.__config.get_values("general/hotkey")) >@@ -459,6 +460,8 @@ class Setup(object): > else: > shortcuts = [] > orig_list =['<Control>space'] >+ if name == 'trigger_accel_backward': >+ orig_list =['<Control><Shift>space'] > variant = self.__config.get_value(section, name) > if variant != None: > orig_list = variant.dup_strv()[0] >--- ibus-1.4.99.20120712/setup/setup.ui.orig 2012-08-13 11:38:38.302399995 +0900 >+++ ibus-1.4.99.20120712/setup/setup.ui 2012-08-13 11:54:07.814845796 +0900 >@@ -106,7 +106,7 @@ > <property name="row_spacing">6</property> > <child> > <object class="GtkLabel" id="label8"> >- <property name="no_show_all">True</property> >+ <property name="visible">True</property> > <property name="can_focus">False</property> > <property name="tooltip_text" translatable="yes">The shortcut keys for switching to next input method in the list</property> > <property name="xalign">0</property> >@@ -121,8 +121,7 @@ > </child> > <child> > <object class="GtkLabel" id="label9"> >- <property name="no_show_all">True</property> >- <property name="sensitive">False</property> >+ <property name="visible">True</property> > <property name="can_focus">False</property> > <property name="tooltip_text" translatable="yes">The shortcut keys for switching to previous input method in the list</property> > <property name="xalign">0</property> >@@ -137,14 +136,14 @@ > </child> > <child> > <object class="GtkHBox" id="hbox4"> >- <property name="visible">True</property> >+ <property name="no_show_all">True</property> > <property name="can_focus">False</property> > <property name="spacing">6</property> > <child> > <object class="GtkEntry" id="entry_trigger"> > <property name="visible">True</property> > <property name="can_focus">True</property> >- <!-- property name="editable">False</property --> >+ <property name="editable">False</property> > </object> > <packing> > <property name="expand">True</property> >@@ -154,9 +153,7 @@ > </child> > <child> > <object class="GtkButton" id="button_trigger"> >- <!-- property name="label" translatable="yes">...</property --> >- <property name="label">gtk-apply</property> >- <property name="use_stock">True</property> >+ <property name="label" translatable="yes">...</property> > <property name="use_action_appearance">False</property> > <property name="visible">True</property> > <property name="can_focus">True</property> >@@ -179,14 +176,14 @@ > </child> > <child> > <object class="GtkHBox" id="hbox5"> >- <property name="no_show_all">True</property> >+ <property name="visible">True</property> > <property name="can_focus">False</property> > <property name="spacing">6</property> > <child> > <object class="GtkEntry" id="entry_next_engine"> > <property name="visible">True</property> > <property name="can_focus">True</property> >- <property name="editable">False</property> >+ <!-- property name="editable">False</property --> > </object> > <packing> > <property name="expand">True</property> >@@ -196,7 +193,9 @@ > </child> > <child> > <object class="GtkButton" id="button_next_engine"> >- <property name="label" translatable="yes">...</property> >+ <!-- property name="label" translatable="yes">...</property --> >+ <property name="label">gtk-apply</property> >+ <property name="use_stock">True</property> > <property name="use_action_appearance">False</property> > <property name="visible">True</property> > <property name="can_focus">True</property> >@@ -220,15 +219,14 @@ > </child> > <child> > <object class="GtkHBox" id="hbox6"> >- <property name="no_show_all">True</property> >+ <property name="visible">True</property> > <property name="can_focus">False</property> > <property name="spacing">6</property> > <child> > <object class="GtkEntry" id="entry_prev_engine"> > <property name="visible">True</property> >- <property name="sensitive">False</property> > <property name="can_focus">True</property> >- <property name="editable">False</property> >+ <!-- property name="editable">False</property --> > </object> > <packing> > <property name="expand">True</property> >@@ -238,10 +236,11 @@ > </child> > <child> > <object class="GtkButton" id="button_prev_engine"> >- <property name="label" translatable="yes">...</property> >+ <!-- property name="label" translatable="yes">...</property --> >+ <property name="label">gtk-apply</property> >+ <property name="use_stock">True</property> > <property name="use_action_appearance">False</property> > <property name="visible">True</property> >- <property name="sensitive">False</property> > <property name="can_focus">True</property> > <property name="receives_default">False</property> > <property name="use_action_appearance">False</property> >@@ -263,7 +262,7 @@ > </child> > <child> > <object class="GtkLabel" id="label7"> >- <property name="visible">True</property> >+ <property name="no_show_all">True</property> > <property name="can_focus">False</property> > <property name="tooltip_text" translatable="yes">The shortcut keys for turning input method on or off</property> > <property name="xalign">0</property> >--- ibus-1.4.99.20120712/ui/gtk3/keybindingmanager.vala.orig 2012-08-13 02:11:03.465627987 +0900 >+++ ibus-1.4.99.20120712/ui/gtk3/keybindingmanager.vala 2012-08-13 02:12:47.017570168 +0900 >@@ -54,15 +54,18 @@ public class KeybindingManager : GLib.Ob > 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; } > } > > /** >@@ -70,7 +73,7 @@ public class KeybindingManager : GLib.Ob > * > * @param event passing on gdk event > */ >- public delegate void KeybindingHandlerFunc(Gdk.Event event); >+ public delegate void KeybindingHandlerFunc(Gdk.Event event, bool reverse); > > > private KeybindingManager() { >@@ -86,7 +89,8 @@ public class KeybindingManager : GLib.Ob > */ > 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); >@@ -97,7 +101,7 @@ public class KeybindingManager : GLib.Ob > 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; >@@ -211,7 +215,7 @@ public class KeybindingManager : GLib.Ob > if (event.key.keyval != binding.keysym || > modifiers != binding.modifiers) > continue; >- binding.handler(event); >+ binding.handler(event, binding.reverse); > return; > } > } >--- ibus-1.4.99.20120712/ui/gtk3/panel.vala.orig 2012-08-10 15:58:15.727121451 +0900 >+++ ibus-1.4.99.20120712/ui/gtk3/panel.vala 2012-08-13 10:32:47.933949837 +0900 >@@ -60,6 +60,7 @@ class Panel : IBus.PanelService { > private bool m_changed_xkb_option = false; > private GLib.Timer m_changed_layout_timer; > private const string ACCELERATOR_SWITCH_IME_FOREWARD = "<Control>space"; >+ private const string ACCELERATOR_SWITCH_IME_BACKWARD = "<Control><Shift>space"; > > private GLib.List<Keybinding> m_keybindings = new GLib.List<Keybinding>(); > >@@ -105,6 +106,48 @@ class Panel : IBus.PanelService { > m_xkblayout = null; > } > >+ private void keybinding_manager_bind(KeybindingManager keybinding_manager, >+ string? accelerator, >+ bool reverse) { >+ 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_20 >+ Gdk.Keymap.get_default().map_virtual_modifiers( >+ ref switch_modifiers); >+#else >+ 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 >+ switch_modifiers &= ~VIRTUAL_MODIFIERS; >+ } >+ >+ if (switch_keysym == 0 && switch_modifiers == 0) { >+ warning("Parse accelerator '%s' failed!", accelerator); >+ return; >+ } >+ >+ Keybinding keybinding = new Keybinding(switch_keysym, >+ switch_modifiers); >+ m_keybindings.append(keybinding); >+ >+ keybinding_manager.bind(switch_keysym, switch_modifiers, >+ (e, _reverse) => handle_engine_switch(e, _reverse), >+ reverse); >+ } >+ > // ToDo: Customize the input method with ibus-setup > private void bind_switch_shortcut() { > string locale = GLib.Intl.setlocale(GLib.LocaleCategory.ALL, >@@ -144,51 +187,25 @@ class Panel : IBus.PanelService { > var keybinding_manager = KeybindingManager.get_instance(); > > 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_20 >- Gdk.Keymap.get_default().map_virtual_modifiers( >- ref switch_modifiers); >-#else >- 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 >- switch_modifiers &= ~VIRTUAL_MODIFIERS; >- } >+ keybinding_manager_bind(keybinding_manager, accelerator, false); >+ } > >- if (switch_keysym == 0 && switch_modifiers == 0) { >- warning("Parse accelerator '%s' failed!", accelerator); >- continue; >- } >+ ACCELERATOR_IME_HOTKEYS = {}; >+ ACCELERATOR_IME_HOTKEYS += ACCELERATOR_SWITCH_IME_BACKWARD; > >- Keybinding keybinding = new Keybinding(switch_keysym, >- switch_modifiers); >- m_keybindings.append(keybinding); >- >- keybinding_manager.bind(switch_keysym, switch_modifiers, >- (e) => handle_engine_switch(e, false)); >- >- // accelerator already has Shift mask >- if ((switch_modifiers & Gdk.ModifierType.SHIFT_MASK) != 0) { >- continue; >+ if (m_config != null) { >+ GLib.Variant variant = m_config.get_value("general/hotkey", >+ "trigger_accel_backward"); >+ if (variant != null) { >+ ACCELERATOR_IME_HOTKEYS = {}; >+ for (int i = 0; i < variant.n_children(); i++) { >+ ACCELERATOR_IME_HOTKEYS += variant.get_child_value(i).dup_string(); >+ } > } >+ } > >- keybinding_manager.bind(switch_keysym, >- 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); > } > } > >--- ibus-1.4.99.20120712/ibus-gjs-3.4.1.20120518/js/ui/status/ibus/ibusPanel.js.orig 2012-08-13 18:12:26.931920729 +0900 >+++ ibus-1.4.99.20120712/ibus-gjs-3.4.1.20120518/js/ui/status/ibus/ibusPanel.js 2012-08-13 18:12:50.208397718 +0900 >@@ -43,20 +43,21 @@ const ICON_ENGINE = 'ibus-engine'; > const SCHEMA_HOTKEY = 'org.freedesktop.ibus.general.hotkey'; > const SECTION_HOTKEY = 'general/hotkey'; > const KEY_TRIGGER = 'trigger-accel'; >-const KEY_TRIGGER_SHIFT = 'trigger-shift'; >+const KEY_TRIGGER_BACKWARD = 'trigger-accel-backward'; > const KEY_TRIGGER_KO = 'trigger-ko'; > const LAYOUTS_MAX_LENGTH = 4; > const ACCELERATOR_SWITCH_IME_FOREWARD = '<Control>space'; > >-function Keybinding(accelerator, keysym, modifiers) { >- this._init(accelerator, keysym, modifiers); >+function Keybinding(accelerator, keysym, modifiers, reverse) { >+ this._init(accelerator, keysym, modifiers, reverse); > } > > Keybinding.prototype = { >- _init: function(accelerator, keysym, modifiers) { >+ _init: function(accelerator, keysym, modifiers, reverse) { > this.accelerator = accelerator; > this.keysym = keysym; > this.modifiers = modifiers; >+ this.reverse = reverse; > } > }; > >@@ -162,6 +163,12 @@ IBusPanel.prototype = { > Lang.bind(this, this._triggerKeyHandler), > 1, > null); >+ global.display.add_keybinding(KEY_TRIGGER_BACKWARD, >+ new Gio.Settings({ schema: SCHEMA_HOTKEY }), >+ Meta.KeyBindingFlags.NONE, >+ Lang.bind(this, this._triggerKeyHandler), >+ 2, >+ null); > this._initTriggerKeys(); > return true; > }, >@@ -297,10 +304,12 @@ IBusPanel.prototype = { > modifiers |= IBus.ModifierType.META_MASK; > } > else if (name == 'hyper') { >- modifiers |= IBus.ModifierType.HYPER_MASK; >+ // meta_display_devirtualize_modifiers is not available >+ modifiers |= IBus.ModifierType.MOD4_MASK; > } > else if (name == 'super') { >- modifiers |= IBus.ModifierType.SUPER_MASK; >+ // meta_display_devirtualize_modifiers is not available >+ modifiers |= IBus.ModifierType.MOD4_MASK; > } > accel = accel.substring(rindex + 1, accel.length); > >@@ -327,45 +336,27 @@ IBusPanel.prototype = { > let varTrigger = this._config.get_value('general/hotkey', > 'trigger_accel'); > let triggers = varTrigger ? varTrigger.dup_strv() : []; >- let triggersShift = []; > >- /* FIXME: ibus supports multiple trigger keys in 'trigger_accel' >- * to switch ibus engines and some trigger keys have modifiers >- * and other do not. >- * Currently meta_display_add_keybinding() assigns the >- * shift reverse by key. I created a new key 'trigger_shift' >- * and modifier trigger keys are copied to the value here. */ >- let updatedTriggersShift = false; > for (let i = 0; i < triggers.length; i++) { > let [keysym, modifiers] = this._accelerator_parse(triggers[i]); >- let keybinding = new Keybinding(triggers[i], keysym, modifiers); >+ let keybinding = new Keybinding(triggers[i], >+ keysym, >+ modifiers, >+ false); > this._keybindings.push(keybinding); >- >- if (modifiers != 0 && >- (modifiers & IBus.ModifierType.SHIFT_MASK) == 0) { >- let j = 0; >- for (j = 0; j < triggersShift.length; j++) { >- if (triggers[i] == triggersShift[j]) { >- break; >- } >- } >- >- if (j >= triggersShift.length) { >- triggersShift.push(triggers[i]); >- updatedTriggersShift = true; >- } >- } > } > >- if (updatedTriggersShift) { >- this._config.set_value('general/hotkey', 'trigger_shift', >- GLib.Variant.new_strv(triggersShift)); >- global.display.add_keybinding(KEY_TRIGGER_SHIFT, >- new Gio.Settings({ schema: SCHEMA_HOTKEY }), >- Meta.KeyBindingFlags.REVERSES, >- Lang.bind(this, this._triggerKeyHandler), >- 2, >- null); >+ let varTriggerBack = this._config.get_value('general/hotkey', >+ 'trigger_accel_backward'); >+ let triggersBack = varTriggerBack ? varTriggerBack.dup_strv() : []; >+ >+ for (let i = 0; i < triggersBack.length; i++) { >+ let [keysym, modifiers] = this._accelerator_parse(triggersBack[i]); >+ let keybinding = new Keybinding(triggers[i], >+ keysym, >+ modifiers, >+ true); >+ this._keybindings.push(keybinding); > } > > if (!(triggers.length == 1 && >@@ -389,7 +380,10 @@ IBusPanel.prototype = { > > for (let i = 0; i < ko_triggers.length; i++) { > let [keysym, modifiers] = this._accelerator_parse(ko_triggers[i]); >- let keybinding = new Keybinding(ko_triggers[i], keysym, modifiers); >+ let keybinding = new Keybinding(ko_triggers[i], >+ keysym, >+ modifiers, >+ false); > this._keybindings.push(keybinding); > } > >@@ -883,7 +877,6 @@ IBusPanel.prototype = { > }, > > _handleEngineSwitch: function(modifiers, mask) { >- let backwards = modifiers & Meta.VirtualModifier.SHIFT_MASK; > let switcher = new Switcher.Switcher(this, this._keybindings); > this._switcher = switcher; > /* FIXME: Need to get the keysym. >@@ -906,7 +899,7 @@ IBusPanel.prototype = { > } > }})); > >- if (!switcher.show(this._engines, backwards, mask)) { >+ if (!switcher.show(this._engines, mask)) { > switcher.destroy(); > this._switcher = null; > } >--- ibus-1.4.99.20120712/ibus-gjs-3.4.1.20120518/js/ui/status/ibus/switcher.js.orig 2012-08-13 18:13:04.097682347 +0900 >+++ ibus-1.4.99.20120712/ibus-gjs-3.4.1.20120518/js/ui/status/ibus/switcher.js 2012-08-13 18:13:19.220992260 +0900 >@@ -155,7 +155,7 @@ const Switcher = new Lang.Class({ > } > }, > >- show : function(engines, backward, mask) { >+ show : function(engines, mask) { > > if (engines.length <= 1) { > return false; >@@ -235,13 +235,12 @@ const Switcher = new Lang.Class({ > let eventState = event.get_state() > & IBus.ModifierType.MODIFIER_MASK > & ~ignoredModifiers; >- let backwards = eventState & IBus.ModifierType.SHIFT_MASK; >- eventState &= ~IBus.ModifierType.SHIFT_MASK; > let isTrigger = false; > > this._disableHover(); > >- for (let i = 0; i < this._keybindings.length; i++) { >+ let i = 0; >+ for (; i < this._keybindings.length; i++) { > if (this._keybindings[i].keysym == keysym && > this._keybindings[i].modifiers == eventState) { > isTrigger = true; >@@ -250,7 +249,8 @@ const Switcher = new Lang.Class({ > } > > if (isTrigger) { >- this._select(backwards ? this._previousApp() : this._nextApp()); >+ this._select(this._keybindings[i].reverse ? >+ this._previousApp() : this._nextApp()); > return true; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 845956
: 603932