1 |
naota 13/12/30 08:17:38 |
2 |
|
3 |
Added: ibus-chewing-1.4.3-content-type.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-chewing/files/ibus-chewing-1.4.3-content-type.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-i18n/ibus-chewing/files/ibus-chewing-1.4.3-content-type.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-i18n/ibus-chewing/files/ibus-chewing-1.4.3-content-type.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: ibus-chewing-1.4.3-content-type.patch |
16 |
=================================================================== |
17 |
From eea7a170ba329a825644956ac390bb63c1a4e667 Mon Sep 17 00:00:00 2001 |
18 |
From: =?UTF-8?q?ChangZhuo=20Chen=20=28=E9=99=B3=E6=98=8C=E5=80=AC=29?= |
19 |
<czchen@×××××.com> |
20 |
Date: Sun, 15 Dec 2013 12:22:05 +0800 |
21 |
Subject: [PATCH] Skip key event when input purpose is password |
22 |
|
23 |
--- |
24 |
src/IBusChewingEngine-input-events.c | 16 ++++++++++++++++ |
25 |
src/IBusChewingEngine.gob | 15 +++++++++++++++ |
26 |
2 files changed, 31 insertions(+) |
27 |
|
28 |
diff --git a/src/IBusChewingEngine-input-events.c b/src/IBusChewingEngine-input-events.c |
29 |
index 974cf75..ef78c4c 100644 |
30 |
--- a/src/IBusChewingEngine-input-events.c |
31 |
+++ b/src/IBusChewingEngine-input-events.c |
32 |
@@ -29,6 +29,7 @@ gboolean ibus_chewing_engine_process_key_event(IBusEngine *engine, |
33 |
gboolean result=TRUE; |
34 |
|
35 |
IBusChewingEngine *self=IBUS_CHEWING_ENGINE(engine); |
36 |
+ if (ibus_chewing_engine_is_password(self)) return FALSE; |
37 |
guint kSym=ibus_chewing_engine_keycode_to_keysym(self,keysym, keycode, modifiers); |
38 |
|
39 |
if (modifiers & IBUS_RELEASE_MASK){ |
40 |
@@ -282,6 +283,7 @@ void ibus_chewing_engine_handle_Default(IBusChewingEngine *self, guint keyval, g |
41 |
void ibus_chewing_engine_candidate_clicked(IBusEngine *engine, guint index, guint button, guint state){ |
42 |
G_DEBUG_MSG(2,"***[I2] candidate_clicked(-, %u, %u, %u) ... proceed.", index, button, state); |
43 |
IBusChewingEngine *self=IBUS_CHEWING_ENGINE(engine); |
44 |
+ if (ibus_chewing_engine_is_password(self)) return; |
45 |
if (index >= chewing_get_candPerPage(self->context) || index <0) { |
46 |
G_DEBUG_MSG(3,"[I3] candidate_clicked() index out of ranged"); |
47 |
return; |
48 |
@@ -329,3 +331,17 @@ void ibus_chewing_engine_property_activate(IBusEngine *engine, const gchar *pro |
49 |
if (needRefresh) |
50 |
self_refresh_property(self,prop_name); |
51 |
} |
52 |
+ |
53 |
+#if IBUS_CHECK_VERSION(1, 5, 4) |
54 |
+void ibus_chewing_engine_set_content_type(IBusEngine *engine, guint purpose, guint hints){ |
55 |
+ G_DEBUG_MSG(5,"[I5] set_content_type(%d, %d)", purpose, hints); |
56 |
+ |
57 |
+ Self *self=SELF(engine); |
58 |
+ if (purpose == IBUS_INPUT_PURPOSE_PASSWORD || |
59 |
+ purpose == IBUS_INPUT_PURPOSE_PIN) { |
60 |
+ ibus_chewing_engine_set_status_flag(self, ENGINE_STATUS_IS_PASSWORD); |
61 |
+ } else { |
62 |
+ ibus_chewing_engine_clear_status_flag(self, ENGINE_STATUS_IS_PASSWORD); |
63 |
+ } |
64 |
+} |
65 |
+#endif |
66 |
diff --git a/src/IBusChewingEngine.gob b/src/IBusChewingEngine.gob |
67 |
index 8bb742a..68986ad 100644 |
68 |
--- a/src/IBusChewingEngine.gob |
69 |
+++ b/src/IBusChewingEngine.gob |
70 |
@@ -110,6 +110,7 @@ enum CHEWING_FLAG{ |
71 |
* @SHOW_CANDIDATE: Whether the candidate selection should be shown. Important for Plain Zhuyin. |
72 |
* @NEED_COMMIT: There's Something to commit. |
73 |
* @FORCE_COMMIT: The engine should commit |
74 |
+ * @IS_PASSWORD: Current input is password. |
75 |
* |
76 |
* Engine status show the current states of engine, |
77 |
* Thus this will change quite often. |
78 |
@@ -124,6 +125,7 @@ enum ENGINE_STATUS{ |
79 |
SHOW_CANDIDATE= 0x8, |
80 |
NEED_COMMIT= 0x10, |
81 |
FORCE_COMMIT= 0x20, |
82 |
+ IS_PASSWORD= 0x40, |
83 |
} Engine:Status; |
84 |
|
85 |
%h{ |
86 |
@@ -152,6 +154,7 @@ void ibus_chewing_engine_handle_Default(IBusChewingEngine *self, guint keyval, g |
87 |
gboolean ibus_chewing_engine_process_key_event(IBusEngine *engine, guint keysym, guint keycode, guint modifiers); |
88 |
void ibus_chewing_engine_candidate_clicked(IBusEngine *engine, guint index, guint button, guint state); |
89 |
void ibus_chewing_engine_property_activate(IBusEngine *engine, const gchar *prop_name, guint prop_state); |
90 |
+void ibus_chewing_engine_set_content_type(IBusEngine *engine, guint purpose, guint hints); |
91 |
|
92 |
%} |
93 |
|
94 |
@@ -268,6 +271,9 @@ class IBus:Chewing:Engine from IBus:Engine{ |
95 |
ibus_engine_class->property_activate= ibus_chewing_engine_property_activate; |
96 |
ibus_engine_class->process_key_event = ibus_chewing_engine_process_key_event; |
97 |
ibus_engine_class->candidate_clicked = ibus_chewing_engine_candidate_clicked; |
98 |
+#if IBUS_CHECK_VERSION(1, 5, 4) |
99 |
+ ibus_engine_class->set_content_type = ibus_chewing_engine_set_content_type; |
100 |
+#endif |
101 |
} |
102 |
|
103 |
private void load_setting(self){ |
104 |
@@ -633,6 +639,11 @@ class IBus:Chewing:Engine from IBus:Engine{ |
105 |
} |
106 |
} |
107 |
|
108 |
+ protected gboolean is_password(self){ |
109 |
+ G_DEBUG_MSG(5, "[I5] is_password = %d", self->chewingFlags & ENGINE_STATUS_IS_PASSWORD); |
110 |
+ return !!(self->_priv->statusFlags & ENGINE_STATUS_IS_PASSWORD); |
111 |
+ } |
112 |
+ |
113 |
/** |
114 |
* refresh_property_list: |
115 |
* @self: this instances. |
116 |
@@ -952,6 +963,7 @@ class IBus:Chewing:Engine from IBus:Engine{ |
117 |
override (IBus:Engine) void |
118 |
page_up(IBus:Engine *engine){ |
119 |
Self *self=SELF(engine); |
120 |
+ if (self_is_password(self)) return; |
121 |
chewing_handle_PageUp(self->context); |
122 |
self_update(self); |
123 |
} |
124 |
@@ -960,6 +972,7 @@ class IBus:Chewing:Engine from IBus:Engine{ |
125 |
override (IBus:Engine) void |
126 |
page_down(IBus:Engine *engine){ |
127 |
Self *self=SELF(engine); |
128 |
+ if (self_is_password(self)) return; |
129 |
chewing_handle_PageDown(self->context); |
130 |
self_update(self); |
131 |
} |
132 |
@@ -967,6 +980,7 @@ class IBus:Chewing:Engine from IBus:Engine{ |
133 |
override (IBus:Engine) void |
134 |
cursor_up(IBus:Engine *engine){ |
135 |
Self *self=SELF(engine); |
136 |
+ if (self_is_password(self)) return; |
137 |
chewing_handle_Up(self->context); |
138 |
self_update(self); |
139 |
} |
140 |
@@ -974,6 +988,7 @@ class IBus:Chewing:Engine from IBus:Engine{ |
141 |
override (IBus:Engine) void |
142 |
cursor_down(IBus:Engine *engine){ |
143 |
Self *self=SELF(engine); |
144 |
+ if (self_is_password(self)) return; |
145 |
chewing_handle_Down(self->context); |
146 |
self_update(self); |
147 |
} |
148 |
-- |
149 |
1.8.5.1 |