[ibus-libpinyin] Update ibus-libpinyin-1.7.x-head.patch

Peng Wu pwu at fedoraproject.org
Mon Oct 14 04:32:27 UTC 2013


commit 201a5dc8eccbd367b93df779eb4d0d1b42251135
Author: Peng Wu <alexepico at gmail.com>
Date:   Mon Oct 14 11:30:09 2013 +0800

    Update ibus-libpinyin-1.7.x-head.patch

 ibus-libpinyin-1.7.x-head.patch |  266 ++++++++++++++++++++++++++++++++++++++-
 ibus-libpinyin.spec             |   10 ++-
 2 files changed, 272 insertions(+), 4 deletions(-)
---
diff --git a/ibus-libpinyin-1.7.x-head.patch b/ibus-libpinyin-1.7.x-head.patch
index 4a7e7c4..bda2cf5 100644
--- a/ibus-libpinyin-1.7.x-head.patch
+++ b/ibus-libpinyin-1.7.x-head.patch
@@ -1,7 +1,7 @@
 From 9ef836117508d9c0c938f57a5ffa5ffca7eb2e7b Mon Sep 17 00:00:00 2001
 From: Peng Wu <alexepico at gmail.com>
 Date: Fri, 26 Jul 2013 13:03:44 +0800
-Subject: [PATCH 1/2] Update the symbol of the ibus indicator
+Subject: [PATCH 1/4] Update the symbol of the ibus indicator
 
 ---
  src/PYPinyinProperties.cc | 14 +++++++++++++-
@@ -82,7 +82,7 @@ index 70c0808..13b9340 100644
 From c42d0a870697e95301deabe0bcb770a68649c81d Mon Sep 17 00:00:00 2001
 From: Peng Wu <alexepico at gmail.com>
 Date: Wed, 31 Jul 2013 10:53:14 +0800
-Subject: [PATCH 2/2] fixes lua 5.2 compile
+Subject: [PATCH 2/4] fixes lua 5.2 compile
 
 ---
  lua/lua-plugin-init.c | 8 ++++++++
@@ -131,3 +131,265 @@ index 9fd36fb..5ccb837 100644
 -- 
 1.8.3.1
 
+
+From cf8ab7d8e76ed70c182c7588cfe1ebbce8e5174b Mon Sep 17 00:00:00 2001
+From: Peng Wu <alexepico at gmail.com>
+Date: Tue, 8 Oct 2013 10:45:35 +0800
+Subject: [PATCH 3/4] remove pyxdg depends
+
+---
+ setup/main2.py | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/setup/main2.py b/setup/main2.py
+index 2d7d412..f7dfcce 100644
+--- a/setup/main2.py
++++ b/setup/main2.py
+@@ -30,7 +30,6 @@ import sys
+ from gi.repository import GLib
+ from gi.repository import Gtk
+ from gi.repository import IBus
+-from xdg import BaseDirectory
+ 
+ import config
+ from dicttreeview import DictionaryTreeView
+@@ -373,7 +372,7 @@ class PreferencesDialog:
+ 
+     def __edit_lua_cb(self, widget):
+         import shutil
+-        path = os.path.join(BaseDirectory.xdg_config_home, "ibus", "libpinyin")
++        path = os.path.join(GLib.get_user_config_dir(), "ibus", "libpinyin")
+         os.path.exists(path) or os.makedirs(path)
+         path = os.path.join(path, "user.lua")
+         if not os.path.exists(path):
+-- 
+1.8.3.1
+
+
+From 69f50424ba5be49c4b31543df7bd7970361d4753 Mon Sep 17 00:00:00 2001
+From: Peng Wu <alexepico at gmail.com>
+Date: Thu, 10 Oct 2013 15:48:29 +0800
+Subject: [PATCH 4/4] support setContentType method
+
+---
+ src/PYEngine.cc          | 21 +++++++++++++++++++++
+ src/PYEngine.h           |  3 +++
+ src/PYPBopomofoEngine.cc | 22 ++++++++++++++++++++++
+ src/PYPBopomofoEngine.h  |  7 +++++++
+ src/PYPPinyinEngine.cc   | 22 ++++++++++++++++++++++
+ src/PYPPinyinEngine.h    |  7 +++++++
+ 6 files changed, 82 insertions(+)
+
+diff --git a/src/PYEngine.cc b/src/PYEngine.cc
+index 870c3ab..487ad6e 100644
+--- a/src/PYEngine.cc
++++ b/src/PYEngine.cc
+@@ -67,6 +67,12 @@ static gboolean ibus_pinyin_engine_process_key_event
+                                                  guint                   modifiers);
+ static void     ibus_pinyin_engine_focus_in     (IBusEngine             *engine);
+ static void     ibus_pinyin_engine_focus_out    (IBusEngine             *engine);
++#if IBUS_CHECK_VERSION (1, 5, 4)
++static void     ibus_pinyin_engine_set_content_type
++                                                (IBusEngine     *engine,
++                                                 guint           purpose,
++                                                 guint           hints);
++#endif
+ static void     ibus_pinyin_engine_reset        (IBusEngine             *engine);
+ static void     ibus_pinyin_engine_enable       (IBusEngine             *engine);
+ static void     ibus_pinyin_engine_disable      (IBusEngine             *engine);
+@@ -123,6 +129,10 @@ ibus_pinyin_engine_class_init (IBusPinyinEngineClass *klass)
+     engine_class->focus_in = ibus_pinyin_engine_focus_in;
+     engine_class->focus_out = ibus_pinyin_engine_focus_out;
+ 
++#if IBUS_CHECK_VERSION (1, 5, 4)
++    engine_class->set_content_type = ibus_pinyin_engine_set_content_type;
++#endif
++
+     engine_class->page_up = ibus_pinyin_engine_page_up;
+     engine_class->page_down = ibus_pinyin_engine_page_down;
+ 
+@@ -189,6 +199,17 @@ ibus_pinyin_engine_process_key_event (IBusEngine     *engine,
+     return pinyin->engine->processKeyEvent (keyval, keycode, modifiers);
+ }
+ 
++#if IBUS_CHECK_VERSION (1, 5, 4)
++static void
++ibus_pinyin_engine_set_content_type (IBusEngine     *engine,
++                                     guint purpose,
++                                     guint hints)
++{
++    IBusPinyinEngine *pinyin = (IBusPinyinEngine *) engine;
++    return pinyin->engine->setContentType (purpose, hints);
++}
++#endif
++
+ static void
+ ibus_pinyin_engine_property_activate (IBusEngine    *engine,
+                                       const gchar   *prop_name,
+diff --git a/src/PYEngine.h b/src/PYEngine.h
+index c5b0d9d..0866146 100644
+--- a/src/PYEngine.h
++++ b/src/PYEngine.h
+@@ -44,6 +44,9 @@ public:
+     virtual gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers) = 0;
+     virtual void focusIn (void) = 0;
+     virtual void focusOut (void) = 0;
++#if IBUS_CHECK_VERSION (1, 5, 4)
++    virtual void setContentType (guint purpose, guint hints) = 0;
++#endif
+     virtual void reset (void) = 0;
+     virtual void enable (void) = 0;
+     virtual void disable (void) = 0;
+diff --git a/src/PYPBopomofoEngine.cc b/src/PYPBopomofoEngine.cc
+index 9be5ad2..9d2666f 100644
+--- a/src/PYPBopomofoEngine.cc
++++ b/src/PYPBopomofoEngine.cc
+@@ -40,6 +40,10 @@ LibPinyinBopomofoEngine::LibPinyinBopomofoEngine (IBusEngine *engine)
+ {
+     gint i;
+ 
++#if IBUS_CHECK_VERSION (1, 5, 4)
++    m_input_purpose = IBUS_INPUT_PURPOSE_FREE_FORM;
++#endif
++
+     /* create editors */
+     m_editors[MODE_INIT].reset (new LibPinyinBopomofoEditor (m_props, LibPinyinBopomofoConfig::instance ()));
+     m_editors[MODE_PUNCT].reset (new PunctEditor (m_props, LibPinyinBopomofoConfig::instance ()));
+@@ -64,6 +68,11 @@ LibPinyinBopomofoEngine::processKeyEvent (guint keyval, guint keycode, guint mod
+ {
+     gboolean retval = FALSE;
+ 
++#if IBUS_CHECK_VERSION (1, 5, 4)
++    if (IBUS_INPUT_PURPOSE_PASSWORD == m_input_purpose)
++        return retval;
++#endif
++
+     /* check Shift or Ctrl + Release hotkey,
+      * and then ignore other Release key event */
+     if (modifiers & IBUS_RELEASE_MASK) {
+@@ -140,9 +149,22 @@ LibPinyinBopomofoEngine::focusIn (void)
+ void
+ LibPinyinBopomofoEngine::focusOut (void)
+ {
++
++#if IBUS_CHECK_VERSION (1, 5, 4)
++    m_input_purpose = IBUS_INPUT_PURPOSE_FREE_FORM;
++#endif
++
+     reset ();
+ }
+ 
++#if IBUS_CHECK_VERSION(1, 5, 4)
++void
++LibPinyinBopomofoEngine::setContentType (guint purpose, guint hints)
++{
++    m_input_purpose = (IBusInputPurpose) purpose;
++}
++#endif
++
+ void
+ LibPinyinBopomofoEngine::reset (void)
+ {
+diff --git a/src/PYPBopomofoEngine.h b/src/PYPBopomofoEngine.h
+index fc64842..85d1ff6 100644
+--- a/src/PYPBopomofoEngine.h
++++ b/src/PYPBopomofoEngine.h
+@@ -37,6 +37,9 @@ public:
+     gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers);
+     void focusIn (void);
+     void focusOut (void);
++#if IBUS_CHECK_VERSION (1, 5, 4)
++    void setContentType (guint purpose, guint hints);
++#endif
+     void reset (void);
+     void enable (void);
+     void disable (void);
+@@ -60,6 +63,10 @@ private:
+ private:
+     PinyinProperties m_props;
+ 
++#if IBUS_CHECK_VERSION (1, 5, 4)
++    IBusInputPurpose m_input_purpose;
++#endif
++
+     guint m_prev_pressed_key;
+ 
+     enum {
+diff --git a/src/PYPPinyinEngine.cc b/src/PYPPinyinEngine.cc
+index ce74be1..d28dc6f 100644
+--- a/src/PYPPinyinEngine.cc
++++ b/src/PYPPinyinEngine.cc
+@@ -50,6 +50,10 @@ LibPinyinPinyinEngine::LibPinyinPinyinEngine (IBusEngine *engine)
+ {
+     gint i;
+ 
++#if IBUS_CHECK_VERSION (1, 5, 4)
++    m_input_purpose = IBUS_INPUT_PURPOSE_FREE_FORM;
++#endif
++
+     m_double_pinyin = LibPinyinPinyinConfig::instance ().doublePinyin ();
+ 
+     if (m_double_pinyin)
+@@ -100,6 +104,11 @@ LibPinyinPinyinEngine::processKeyEvent (guint keyval, guint keycode, guint modif
+ {
+     gboolean retval = FALSE;
+ 
++#if IBUS_CHECK_VERSION (1, 5, 4)
++    if (IBUS_INPUT_PURPOSE_PASSWORD == m_input_purpose)
++        return retval;
++#endif
++
+     /* check Shift or Ctrl + Release hotkey,
+      * and then ignore other Release key event */
+     if (modifiers & IBUS_RELEASE_MASK) {
+@@ -222,9 +231,22 @@ LibPinyinPinyinEngine::focusIn (void)
+ void
+ LibPinyinPinyinEngine::focusOut (void)
+ {
++
++#if IBUS_CHECK_VERSION (1, 5, 4)
++    m_input_purpose = IBUS_INPUT_PURPOSE_FREE_FORM;
++#endif
++
+     reset ();
+ }
+ 
++#if IBUS_CHECK_VERSION(1, 5, 4)
++void
++LibPinyinPinyinEngine::setContentType (guint purpose, guint hints)
++{
++    m_input_purpose = (IBusInputPurpose) purpose;
++}
++#endif
++
+ void
+ LibPinyinPinyinEngine::reset (void)
+ {
+diff --git a/src/PYPPinyinEngine.h b/src/PYPPinyinEngine.h
+index a7e0e12..9954569 100644
+--- a/src/PYPPinyinEngine.h
++++ b/src/PYPPinyinEngine.h
+@@ -35,6 +35,9 @@ public:
+     gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers);
+     void focusIn (void);
+     void focusOut (void);
++#if IBUS_CHECK_VERSION (1, 5, 4)
++    void setContentType (guint purpose, guint hints);
++#endif
+     void reset (void);
+     void enable (void);
+     void disable (void);
+@@ -56,6 +59,10 @@ private:
+ private:
+     PinyinProperties m_props;
+ 
++#if IBUS_CHECK_VERSION (1, 5, 4)
++    IBusInputPurpose m_input_purpose;
++#endif
++
+     guint m_prev_pressed_key;
+ 
+     enum {
+-- 
+1.8.3.1
+
diff --git a/ibus-libpinyin.spec b/ibus-libpinyin.spec
index 9a462ea..f2d30a5 100644
--- a/ibus-libpinyin.spec
+++ b/ibus-libpinyin.spec
@@ -2,7 +2,7 @@
 
 Name:       ibus-libpinyin
 Version:    1.6.91
-Release:    4%{?dist}
+Release:    5%{?dist}
 Summary:    Intelligent Pinyin engine based on libpinyin for IBus
 License:    GPLv2+
 Group:      System Environment/Libraries
@@ -12,6 +12,7 @@ Source0:    http://downloads.sourceforge.net/libpinyin/ibus-libpinyin/%{name}-%{
 Patch0:     ibus-libpinyin-1.7.x-head.patch
 %endif
 
+Requires:       pygobject3
 BuildRequires:  gettext-devel
 BuildRequires:  intltool
 BuildRequires:  libtool
@@ -22,7 +23,7 @@ BuildRequires:  opencc-devel
 BuildRequires:  lua-devel
 BuildRequires:  python2-devel
 BuildRequires:  desktop-file-utils
-BuildRequires:  ibus-devel >= 1.3
+BuildRequires:  ibus-devel >= 1.5.4
 BuildRequires:  libpinyin-devel >= 0.9.91
 
 # Requires(post): sqlite
@@ -86,6 +87,11 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
 %{_datadir}/ibus/component/*
 
 %changelog
+* Mon Oct 14 2013 Peng Wu <pwu at redhat.com> - 1.6.91-5
+- Update ibus-libpinyin-1.7.x-head.patch
+- Support ibus input purpose feature, fixes bug 1016438.
+- Remove pyxdg depends, fixes bug 1016941.
+
 * Tue Oct  8 2013 Peng Wu <pwu at redhat.com> - 1.6.91-4
 - Write ibus system cache when install or uninstall
 


More information about the scm-commits mailing list