Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tsutsui/a47fcdf22f238072b53d to your computer and use it in GitHub Desktop.
Save tsutsui/a47fcdf22f238072b53d to your computer and use it in GitHub Desktop.
pkgsrc/inputmethod/ibus-mozc patch to make IME off by default.
? inputmethod/mozc-server/patches/patch-unix_ibus_property__handler.cc
Index: inputmethod/ibus-mozc/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/inputmethod/ibus-mozc/Makefile,v
retrieving revision 1.17
diff -u -p -d -r1.17 Makefile
--- inputmethod/ibus-mozc/Makefile 12 Feb 2014 23:18:04 -0000 1.17
+++ inputmethod/ibus-mozc/Makefile 4 May 2014 04:55:55 -0000
@@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.17 2014/02/12 23:18:04 tron Exp $
PKGNAME= ibus-${DISTNAME}
-PKGREVISION= 2
+PKGREVISION= 3
INSTALLATION_DIRS+= libexec share/ibus share/ibus/component \
share/ibus-mozc
Index: inputmethod/mozc-server/distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/inputmethod/mozc-server/distinfo,v
retrieving revision 1.6
diff -u -p -d -r1.6 distinfo
--- inputmethod/mozc-server/distinfo 20 Jan 2014 10:39:29 -0000 1.6
+++ inputmethod/mozc-server/distinfo 4 May 2014 04:55:55 -0000
@@ -48,3 +48,4 @@ SHA1 (patch-session_session__converter__
SHA1 (patch-session_session__test.cc) = a256caec45a45f4eaab0555ecc18cea09c417d95
SHA1 (patch-unix_ibus_gen__mozc__xml.py) = 9d7e1da07854c2244a22ffe5034fabb25d16d266
SHA1 (patch-unix_ibus_mozc__engine.cc) = 2ce0a680a0fad1abdc646737b6b5a4c3a9e87e6e
+SHA1 (patch-unix_ibus_property__handler.cc) = 22bca38ae6bcffc45893c26623e9c3bf6395b4c6
--- /dev/null 2014-05-04 04:55:25.000000000 +0000
+++ inputmethod/mozc-server/patches/patch-unix_ibus_property__handler.cc 2014-04-06 19:30:23.000000000 +0000
@@ -0,0 +1,55 @@
+$NetBSD$
+
+Make IME off by default on ibus 1.5.x.
+
+--- unix/ibus/property_handler.cc.orig 2014-01-06 07:10:26.000000000 +0000
++++ unix/ibus/property_handler.cc
+@@ -85,9 +85,29 @@ PropertyHandler::PropertyHandler(Message
+ client_(client),
+ translator_(translator),
+ original_composition_mode_(kMozcEngineInitialCompositionMode),
++#if IBUS_CHECK_VERSION(1, 5, 0)
++ is_activated_(false),
++#else
+ is_activated_(true),
++#endif
+ is_disabled_(false) {
+
++ commands::KeyEvent key;
++ if (is_activated_) {
++ key.set_special_key(mozc::commands::KeyEvent::ON);
++ } else {
++ key.set_special_key(mozc::commands::KeyEvent::OFF);
++ }
++ key.set_activated(is_activated_);
++ key.set_mode(original_composition_mode_);
++ commands::Output output;
++ if (client_->SendKey(key, &output)) {
++ original_composition_mode_ = output.status().mode();
++ is_activated_ = output.status().activated();
++ } else {
++ LOG(ERROR) << "SendKey failed";
++ }
++
+ AppendCompositionPropertyToPanel();
+ AppendToolPropertyToPanel();
+
+@@ -132,6 +152,9 @@ void PropertyHandler::AppendCompositionP
+ IBusPropList *sub_prop_list = ibus_prop_list_new();
+
+ // Create items for the radio menu.
++ const commands::CompositionMode initial_mode = is_activated_ ?
++ original_composition_mode_ :
++ kMozcEnginePropertyIMEOffState->composition_mode;
+ string icon_path_for_panel;
+ const char *mode_symbol = NULL;
+ for (size_t i = 0; i < kMozcEnginePropertiesSize; ++i) {
+@@ -139,7 +162,7 @@ void PropertyHandler::AppendCompositionP
+ IBusText *label = ibus_text_new_from_string(
+ translator_->MaybeTranslate(entry.label).c_str());
+ IBusPropState state = PROP_STATE_UNCHECKED;
+- if (entry.composition_mode == kMozcEngineInitialCompositionMode) {
++ if (entry.composition_mode == initial_mode) {
+ state = PROP_STATE_CHECKED;
+ icon_path_for_panel = GetIconPath(entry.icon);
+ mode_symbol = entry.label_for_panel;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment