Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff -ru ibus.orig/bus/ibusimpl.c ibus/bus/ibusimpl.c
--- ibus.orig/bus/ibusimpl.c 2010-06-22 02:49:56.000000000 +0900
+++ ibus/bus/ibusimpl.c 2010-06-22 02:46:55.000000000 +0900
@@ -192,6 +192,30 @@
}
static void
+bus_ibus_impl_set_enable (BusIBusImpl *ibus,
+ GValue *value)
+{
+ GQuark hotkey = g_quark_from_static_string ("enable");
+ bus_ibus_impl_set_hotkey (ibus, hotkey, value);
+}
+
+static void
+bus_ibus_impl_set_disable (BusIBusImpl *ibus,
+ GValue *value)
+{
+ GQuark hotkey = g_quark_from_static_string ("disable");
+ bus_ibus_impl_set_hotkey (ibus, hotkey, value);
+}
+
+static void
+bus_ibus_impl_set_vi_collaboration (BusIBusImpl *ibus,
+ GValue *value)
+{
+ GQuark hotkey = g_quark_from_static_string ("vi_collaboration");
+ bus_ibus_impl_set_hotkey (ibus, hotkey, value);
+}
+
+static void
bus_ibus_impl_set_next_engine_in_menu (BusIBusImpl *ibus,
GValue *value)
{
@@ -400,6 +424,9 @@
{ "general/hotkey", "next_engine_in_menu", bus_ibus_impl_set_next_engine_in_menu },
/* Only for backward compatibility, shall be removed later. */
{ "general/hotkey", "prev_engine", bus_ibus_impl_set_previous_engine },
+ { "general/hotkey", "enable", bus_ibus_impl_set_enable },
+ { "general/hotkey", "disable", bus_ibus_impl_set_disable },
+ { "general/hotkey", "vi_collaboration", bus_ibus_impl_set_vi_collaboration },
{ "general/hotkey", "previous_engine", bus_ibus_impl_set_previous_engine },
{ "general", "preload_engines", bus_ibus_impl_set_preload_engines },
{ "general", "use_system_keyboard_layout", bus_ibus_impl_set_use_sys_layout },
@@ -449,6 +476,9 @@
{ "general/hotkey", "next_engine_in_menu", bus_ibus_impl_set_next_engine_in_menu },
/* Only for backward compatibility, shall be removed later. */
{ "general/hotkey", "prev_engine", bus_ibus_impl_set_previous_engine },
+ { "general/hotkey", "enable", bus_ibus_impl_set_enable },
+ { "general/hotkey", "disable", bus_ibus_impl_set_disable },
+ { "general/hotkey", "vi_collaboration", bus_ibus_impl_set_vi_collaboration },
{ "general/hotkey", "previous_engine", bus_ibus_impl_set_previous_engine },
{ "general", "preload_engines", bus_ibus_impl_set_preload_engines },
{ "general", "use_system_keyboard_layout", bus_ibus_impl_set_use_sys_layout },
@@ -1791,11 +1821,17 @@
static GQuark trigger = 0;
static GQuark next = 0;
static GQuark previous = 0;
+ static GQuark enable = 0;
+ static GQuark disable = 0;
+ static GQuark vi_collaboration = 0;
if (trigger == 0) {
trigger = g_quark_from_static_string ("trigger");
next = g_quark_from_static_string ("next-engine-in-menu");
previous = g_quark_from_static_string ("previous-engine");
+ enable = g_quark_from_static_string ("enable");
+ disable = g_quark_from_static_string ("disable");
+ vi_collaboration = g_quark_from_static_string ("vi_collaboration");
}
GQuark event = ibus_hotkey_profile_filter_key_event (ibus->hotkey_profile,
diff -ru ibus.orig/bus/inputcontext.c ibus/bus/inputcontext.c
--- ibus.orig/bus/inputcontext.c 2010-06-22 02:49:56.000000000 +0900
+++ ibus/bus/inputcontext.c 2010-06-22 02:19:45.000000000 +0900
@@ -1979,6 +1979,24 @@
if (context->engine != NULL) {
bus_input_context_unset_engine (context);
}
+ else if (event == enable){
+ if(!context->enabled){
+ bus_input_context_enable (context);
+ }
+ retval = TRUE;
+ }
+ else if (event == disable){
+ if(context->enabled){
+ bus_input_context_disable (context);
+ }
+ retval = TRUE;
+ }
+ else if (event == vi_collaboration){
+ if(context->enabled){
+ bus_input_context_disable (context);
+ }
+ retval = FALSE;
+ }
if (engine == NULL) {
bus_input_context_disable (context);
diff -ru ibus.orig/ibus/common.py ibus/ibus/common.py
--- ibus.orig/ibus/common.py 2010-06-22 02:49:56.000000000 +0900
+++ ibus/ibus/common.py 2010-06-22 02:19:45.000000000 +0900
@@ -39,9 +39,15 @@
"CONFIG_GENERAL_SHORTCUT_TRIGGER",
"CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE",
"CONFIG_GENERAL_SHORTCUT_PREV_ENGINE",
+ "CONFIG_GENERAL_SHORTCUT_ENABLE",
+ "CONFIG_GENERAL_SHORTCUT_DISABLE",
+ "CONFIG_GENERAL_SHORTCUT_VI_COLLABORATION",
"CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT",
"CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT",
"CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT",
+ "CONFIG_GENERAL_SHORTCUT_ENABLE_DEFAULT",
+ "CONFIG_GENERAL_SHORTCUT_DISABLE_DEFAULT",
+ "CONFIG_GENERAL_SHORTCUT_VI_COLLABORATION_DEFAULT",
"main",
"main_quit",
"main_iteration",
@@ -153,6 +159,12 @@
CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT = []
CONFIG_GENERAL_SHORTCUT_PREV_ENGINE = "/general/keyboard_shortcut_prev_engine"
CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT = []
+CONFIG_GENERAL_SHORTCUT_ENABLE = "/general/keyboard_shortcut_enable"
+CONFIG_GENERAL_SHORTCUT_ENABLE_DEFAULT = []
+CONFIG_GENERAL_SHORTCUT_DISABLE = "/general/keyboard_shortcut_disable"
+CONFIG_GENERAL_SHORTCUT_DISABLE_DEFAULT = []
+CONFIG_GENERAL_SHORTCUT_VI_COLLABORATION = "/general/keyboard_shortcut_vi_collaboration"
+CONFIG_GENERAL_SHORTCUT_VI_COLLABORATION_DEFAULT = []
__mainloop = None
diff -ru ibus.orig/setup/main.py ibus/setup/main.py
--- ibus.orig/setup/main.py 2010-06-22 02:49:56.000000000 +0900
+++ ibus/setup/main.py 2010-06-22 02:19:45.000000000 +0900
@@ -127,6 +127,39 @@
button.connect("clicked", self.__shortcut_button_clicked_cb,
N_("previous input method"), "general/hotkey", "prev_engine", entry)
+ # enable
+ shortcuts = self.__config.get_value(
+ "general/hotkey", "enable",
+ ibus.CONFIG_GENERAL_SHORTCUT_ENABLE_DEFAULT)
+ button = self.__builder.get_object("button_enable")
+ entry = self.__builder.get_object("entry_enable")
+ entry.set_text("; ".join(shortcuts))
+ entry.set_tooltip_text("\n".join(shortcuts))
+ button.connect("clicked", self.__shortcut_button_clicked_cb,
+ N_("enable"), "general/hotkey", "enable", entry)
+
+ # disable
+ shortcuts = self.__config.get_value(
+ "general/hotkey", "disable",
+ ibus.CONFIG_GENERAL_SHORTCUT_DISABLE_DEFAULT)
+ button = self.__builder.get_object("button_disable")
+ entry = self.__builder.get_object("entry_disable")
+ entry.set_text("; ".join(shortcuts))
+ entry.set_tooltip_text("\n".join(shortcuts))
+ button.connect("clicked", self.__shortcut_button_clicked_cb,
+ N_("disable"), "general/hotkey", "disable", entry)
+
+ # vi_collaboration
+ shortcuts = self.__config.get_value(
+ "general/hotkey", "vi_collaboration",
+ ibus.CONFIG_GENERAL_SHORTCUT_VI_COLLABORATION_DEFAULT)
+ button = self.__builder.get_object("button_vi_collaboration")
+ entry = self.__builder.get_object("entry_vi_collaboration")
+ entry.set_text("; ".join(shortcuts))
+ entry.set_tooltip_text("\n".join(shortcuts))
+ button.connect("clicked", self.__shortcut_button_clicked_cb,
+ N_("vi_collaboration"), "general/hotkey", "vi_collaboration", entry)
+
# lookup table orientation
self.__combobox_lookup_table_orientation = self.__builder.get_object("combobox_lookup_table_orientation")
self.__combobox_lookup_table_orientation.set_active(
diff -ru ibus.orig/setup/setup.ui ibus/setup/setup.ui
--- ibus.orig/setup/setup.ui 2010-06-22 02:49:56.000000000 +0900
+++ ibus/setup/setup.ui 2010-06-22 02:19:45.000000000 +0900
@@ -96,7 +96,7 @@
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">6</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -246,6 +246,153 @@
<property name="bottom_attach">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Enable:</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label18">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Disable:</property>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label19">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Vi Collaboration:</property>
+ </object>
+ <packing>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox10">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkEntry" id="entry_enable">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="invisible_char">&#x25CF;</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_enable">
+ <property name="label" translatable="yes">...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox11">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkEntry" id="entry_disable">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="invisible_char">&#x25CF;</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_disable">
+ <property name="label" translatable="yes">...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox12">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkEntry" id="entry_vi_collaboration">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="invisible_char">&#x25CF;</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_vi_collaboration">
+ <property name="label" translatable="yes">...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ </packing>
+ </child>
</object>
</child>
</object>
@kokutoto

This comment has been minimized.

Copy link
Owner Author

@kokutoto kokutoto commented Oct 14, 2010

iBusの有効/無効に個別のホットキーを割り当てるseparate hotkey patchを作りました(ついでにvi協調機能付き)
http://d.hatena.ne.jp/kokutoto/20100622/p1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment