1 |
naota 13/12/30 07:59:56 |
2 |
|
3 |
Added: ibus-pinyin-1.5.0-content-type-method.patch |
4 |
Log: |
5 |
Apply a patch to set content type method. |
6 |
|
7 |
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key F8551514) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 app-i18n/ibus-pinyin/files/ibus-pinyin-1.5.0-content-type-method.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-i18n/ibus-pinyin/files/ibus-pinyin-1.5.0-content-type-method.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-i18n/ibus-pinyin/files/ibus-pinyin-1.5.0-content-type-method.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: ibus-pinyin-1.5.0-content-type-method.patch |
16 |
=================================================================== |
17 |
From f1accaa9a18bd4a1c7234b40e16ad9889c25a461 Mon Sep 17 00:00:00 2001 |
18 |
From: Peng Wu <alexepico@×××××.com> |
19 |
Date: Wed, 6 Nov 2013 13:16:14 +0800 |
20 |
Subject: [PATCH] support setContentType method |
21 |
|
22 |
--- |
23 |
src/PYBopomofoEngine.cc | 22 ++++++++++++++++++++++ |
24 |
src/PYBopomofoEngine.h | 7 +++++++ |
25 |
src/PYEngine.cc | 21 +++++++++++++++++++++ |
26 |
src/PYEngine.h | 3 +++ |
27 |
src/PYPinyinEngine.cc | 22 ++++++++++++++++++++++ |
28 |
src/PYPinyinEngine.h | 7 +++++++ |
29 |
6 files changed, 82 insertions(+) |
30 |
|
31 |
diff --git a/src/PYBopomofoEngine.cc b/src/PYBopomofoEngine.cc |
32 |
index 581c4cf..4dfbc2c 100644 |
33 |
--- a/src/PYBopomofoEngine.cc |
34 |
+++ b/src/PYBopomofoEngine.cc |
35 |
@@ -42,6 +42,10 @@ BopomofoEngine::BopomofoEngine (IBusEngine *engine) |
36 |
{ |
37 |
gint i; |
38 |
|
39 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
40 |
+ m_input_purpose = IBUS_INPUT_PURPOSE_FREE_FORM; |
41 |
+#endif |
42 |
+ |
43 |
/* create editors */ |
44 |
m_editors[MODE_INIT].reset (new BopomofoEditor (m_props, BopomofoConfig::instance ())); |
45 |
m_editors[MODE_PUNCT].reset (new PunctEditor (m_props, BopomofoConfig::instance ())); |
46 |
@@ -72,6 +76,11 @@ BopomofoEngine::processKeyEvent (guint keyval, guint keycode, guint modifiers) |
47 |
{ |
48 |
gboolean retval = FALSE; |
49 |
|
50 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
51 |
+ if (IBUS_INPUT_PURPOSE_PASSWORD == m_input_purpose) |
52 |
+ return retval; |
53 |
+#endif |
54 |
+ |
55 |
/* check Shift + Release hotkey, |
56 |
* and then ignore other Release key event */ |
57 |
if (modifiers & IBUS_RELEASE_MASK) { |
58 |
@@ -139,9 +148,22 @@ BopomofoEngine::focusIn (void) |
59 |
void |
60 |
BopomofoEngine::focusOut (void) |
61 |
{ |
62 |
+ |
63 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
64 |
+ m_input_purpose = IBUS_INPUT_PURPOSE_FREE_FORM; |
65 |
+#endif |
66 |
+ |
67 |
reset (); |
68 |
} |
69 |
|
70 |
+#if IBUS_CHECK_VERSION(1, 5, 4) |
71 |
+void |
72 |
+BopomofoEngine::setContentType (guint purpose, guint hints) |
73 |
+{ |
74 |
+ m_input_purpose = (IBusInputPurpose) purpose; |
75 |
+} |
76 |
+#endif |
77 |
+ |
78 |
void |
79 |
BopomofoEngine::reset (void) |
80 |
{ |
81 |
diff --git a/src/PYBopomofoEngine.h b/src/PYBopomofoEngine.h |
82 |
index ce41ce8..14b6780 100644 |
83 |
--- a/src/PYBopomofoEngine.h |
84 |
+++ b/src/PYBopomofoEngine.h |
85 |
@@ -36,6 +36,9 @@ public: |
86 |
gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers); |
87 |
void focusIn (void); |
88 |
void focusOut (void); |
89 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
90 |
+ void setContentType (guint purpose, guint hints); |
91 |
+#endif |
92 |
void reset (void); |
93 |
void enable (void); |
94 |
void disable (void); |
95 |
@@ -59,6 +62,10 @@ private: |
96 |
private: |
97 |
PinyinProperties m_props; |
98 |
|
99 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
100 |
+ IBusInputPurpose m_input_purpose; |
101 |
+#endif |
102 |
+ |
103 |
guint m_prev_pressed_key; |
104 |
|
105 |
enum { |
106 |
diff --git a/src/PYEngine.cc b/src/PYEngine.cc |
107 |
index d9fa04a..da047b2 100644 |
108 |
--- a/src/PYEngine.cc |
109 |
+++ b/src/PYEngine.cc |
110 |
@@ -67,6 +67,12 @@ static gboolean ibus_pinyin_engine_process_key_event |
111 |
guint modifiers); |
112 |
static void ibus_pinyin_engine_focus_in (IBusEngine *engine); |
113 |
static void ibus_pinyin_engine_focus_out (IBusEngine *engine); |
114 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
115 |
+static void ibus_pinyin_engine_set_content_type |
116 |
+ (IBusEngine *engine, |
117 |
+ guint purpose, |
118 |
+ guint hints); |
119 |
+#endif |
120 |
static void ibus_pinyin_engine_reset (IBusEngine *engine); |
121 |
static void ibus_pinyin_engine_enable (IBusEngine *engine); |
122 |
static void ibus_pinyin_engine_disable (IBusEngine *engine); |
123 |
@@ -123,6 +129,10 @@ ibus_pinyin_engine_class_init (IBusPinyinEngineClass *klass) |
124 |
engine_class->focus_in = ibus_pinyin_engine_focus_in; |
125 |
engine_class->focus_out = ibus_pinyin_engine_focus_out; |
126 |
|
127 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
128 |
+ engine_class->set_content_type = ibus_pinyin_engine_set_content_type; |
129 |
+#endif |
130 |
+ |
131 |
engine_class->page_up = ibus_pinyin_engine_page_up; |
132 |
engine_class->page_down = ibus_pinyin_engine_page_down; |
133 |
|
134 |
@@ -182,6 +192,17 @@ ibus_pinyin_engine_process_key_event (IBusEngine *engine, |
135 |
return pinyin->engine->processKeyEvent (keyval, keycode, modifiers); |
136 |
} |
137 |
|
138 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
139 |
+static void |
140 |
+ibus_pinyin_engine_set_content_type (IBusEngine *engine, |
141 |
+ guint purpose, |
142 |
+ guint hints) |
143 |
+{ |
144 |
+ IBusPinyinEngine *pinyin = (IBusPinyinEngine *) engine; |
145 |
+ return pinyin->engine->setContentType (purpose, hints); |
146 |
+} |
147 |
+#endif |
148 |
+ |
149 |
static void |
150 |
ibus_pinyin_engine_property_activate (IBusEngine *engine, |
151 |
const gchar *prop_name, |
152 |
diff --git a/src/PYEngine.h b/src/PYEngine.h |
153 |
index b74e6e8..22e1b79 100644 |
154 |
--- a/src/PYEngine.h |
155 |
+++ b/src/PYEngine.h |
156 |
@@ -44,6 +44,9 @@ public: |
157 |
virtual gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers) = 0; |
158 |
virtual void focusIn (void) = 0; |
159 |
virtual void focusOut (void) = 0; |
160 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
161 |
+ virtual void setContentType (guint purpose, guint hints) = 0; |
162 |
+#endif |
163 |
virtual void reset (void) = 0; |
164 |
virtual void enable (void) = 0; |
165 |
virtual void disable (void) = 0; |
166 |
diff --git a/src/PYPinyinEngine.cc b/src/PYPinyinEngine.cc |
167 |
index 7aea261..570187b 100644 |
168 |
--- a/src/PYPinyinEngine.cc |
169 |
+++ b/src/PYPinyinEngine.cc |
170 |
@@ -45,6 +45,10 @@ PinyinEngine::PinyinEngine (IBusEngine *engine) |
171 |
{ |
172 |
gint i; |
173 |
|
174 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
175 |
+ m_input_purpose = IBUS_INPUT_PURPOSE_FREE_FORM; |
176 |
+#endif |
177 |
+ |
178 |
if (PinyinConfig::instance ().doublePinyin ()) |
179 |
m_editors[MODE_INIT].reset (new DoublePinyinEditor (m_props, PinyinConfig::instance ())); |
180 |
else |
181 |
@@ -82,6 +86,11 @@ PinyinEngine::processKeyEvent (guint keyval, guint keycode, guint modifiers) |
182 |
{ |
183 |
gboolean retval = FALSE; |
184 |
|
185 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
186 |
+ if (IBUS_INPUT_PURPOSE_PASSWORD == m_input_purpose) |
187 |
+ return retval; |
188 |
+#endif |
189 |
+ |
190 |
/* check Shift + Release hotkey, |
191 |
* and then ignore other Release key event */ |
192 |
if (modifiers & IBUS_RELEASE_MASK) { |
193 |
@@ -195,9 +204,22 @@ PinyinEngine::focusIn (void) |
194 |
void |
195 |
PinyinEngine::focusOut (void) |
196 |
{ |
197 |
+ |
198 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
199 |
+ m_input_purpose = IBUS_INPUT_PURPOSE_FREE_FORM; |
200 |
+#endif |
201 |
+ |
202 |
reset (); |
203 |
} |
204 |
|
205 |
+#if IBUS_CHECK_VERSION(1, 5, 4) |
206 |
+void |
207 |
+PinyinEngine::setContentType (guint purpose, guint hints) |
208 |
+{ |
209 |
+ m_input_purpose = (IBusInputPurpose) purpose; |
210 |
+} |
211 |
+#endif |
212 |
+ |
213 |
void |
214 |
PinyinEngine::reset (void) |
215 |
{ |
216 |
diff --git a/src/PYPinyinEngine.h b/src/PYPinyinEngine.h |
217 |
index fcce73e..de50269 100644 |
218 |
--- a/src/PYPinyinEngine.h |
219 |
+++ b/src/PYPinyinEngine.h |
220 |
@@ -35,6 +35,9 @@ public: |
221 |
gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers); |
222 |
void focusIn (void); |
223 |
void focusOut (void); |
224 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
225 |
+ void setContentType (guint purpose, guint hints); |
226 |
+#endif |
227 |
void reset (void); |
228 |
void enable (void); |
229 |
void disable (void); |
230 |
@@ -58,6 +61,10 @@ private: |
231 |
private: |
232 |
PinyinProperties m_props; |
233 |
|
234 |
+#if IBUS_CHECK_VERSION (1, 5, 4) |
235 |
+ IBusInputPurpose m_input_purpose; |
236 |
+#endif |
237 |
+ |
238 |
guint m_prev_pressed_key; |
239 |
|
240 |
enum { |
241 |
-- |
242 |
1.8.3.1 |