updated on Tue Jan 17 12:00:36 UTC 2012
[aur-mirror.git] / ibus-3beol / 00_2011.11.20.0.git23abee8.patch
blob05f1567acd75e6ee892664226ff2a77775d16db0
1 diff -ruN ibus-ibus-533dfc2/bus/ibusimpl.c ibus-ibus-23abee8/bus/ibusimpl.c
2 --- ibus-ibus-533dfc2/bus/ibusimpl.c 2011-09-24 00:11:24.000000000 +0900
3 +++ ibus-ibus-23abee8/bus/ibusimpl.c 2011-11-21 11:06:21.000000000 +0900
4 @@ -1044,18 +1044,19 @@
7 /**
8 - * bus_ibus_impl_context_request_next_engine_in_menu:
9 + * bus_ibus_impl_context_request_rotate_engine_in_menu:
11 - * Process the "next_engine_in_menu" hotkey.
12 + * Process the "next_engine_in_menu" or "previous_engine" hotkey.
14 static void
15 -bus_ibus_impl_context_request_next_engine_in_menu (BusIBusImpl *ibus,
16 - BusInputContext *context)
17 +bus_ibus_impl_context_request_rotate_engine_in_menu (BusIBusImpl *ibus,
18 + BusInputContext *context,
19 + gboolean is_next)
21 BusEngineProxy *engine;
22 IBusEngineDesc *desc;
23 IBusEngineDesc *next_desc = NULL;
24 - GList *p;
25 + GList *p = NULL;
27 engine = bus_input_context_get_engine (context);
28 if (engine == NULL) {
29 @@ -1071,12 +1072,45 @@
31 p = g_list_find (ibus->register_engine_list, desc);
32 if (p != NULL) {
33 - p = p->next;
34 + if (is_next) {
35 + p = p->next;
36 + } else {
37 + p = p->prev;
38 + }
39 + }
41 + /* Rotate register_engine_list and engine_list. */
42 + if (p == NULL && g_list_find (ibus->register_engine_list, desc) != NULL) {
43 + if (is_next) {
44 + p = ibus->engine_list;
45 + } else {
46 + p = g_list_last (ibus->engine_list);
47 + }
50 if (p == NULL) {
51 p = g_list_find (ibus->engine_list, desc);
52 if (p != NULL) {
53 - p = p->next;
54 + if (is_next) {
55 + p = p->next;
56 + } else {
57 + p = p->prev;
58 + }
59 + }
60 + }
62 + /* Rerotate register_engine_list and engine_list. */
63 + if (p == NULL && g_list_find (ibus->engine_list, desc) != NULL) {
64 + if (is_next) {
65 + p = ibus->register_engine_list;
66 + if (p == NULL) {
67 + p = ibus->engine_list;
68 + }
69 + } else {
70 + p = g_list_last (ibus->register_engine_list);
71 + if (p == NULL) {
72 + p = g_list_last (ibus->engine_list);
73 + }
77 @@ -1126,12 +1160,9 @@
81 - /*
82 - * If the previous engine name is not found, switch to the next engine
83 - * in the menu. This behavior is better than doing nothing.
84 - */
85 if (!engine_name) {
86 - bus_ibus_impl_context_request_next_engine_in_menu (ibus, context);
87 + bus_ibus_impl_context_request_rotate_engine_in_menu (ibus, context,
88 + FALSE);
89 return;
92 @@ -2066,25 +2097,26 @@
93 else {
94 bus_input_context_enable (context);
96 - return (enabled != bus_input_context_is_enabled (context));
97 + return TRUE;
99 if (event == enable_unconditional) {
100 gboolean enabled = bus_input_context_is_enabled (context);
101 if (!enabled) {
102 bus_input_context_enable (context);
104 - return bus_input_context_is_enabled (context);
105 + return TRUE;
107 if (event == disable_unconditional) {
108 gboolean enabled = bus_input_context_is_enabled (context);
109 if (enabled) {
110 bus_input_context_disable (context);
112 - return !bus_input_context_is_enabled (context);
113 + return TRUE;
115 if (event == next) {
116 if (bus_input_context_is_enabled (context)) {
117 - bus_ibus_impl_context_request_next_engine_in_menu (ibus, context);
118 + bus_ibus_impl_context_request_rotate_engine_in_menu (ibus, context,
119 + TRUE);
121 else {
122 bus_input_context_enable (context);
123 diff -ruN ibus-ibus-533dfc2/client/gtk2/ibusimcontext.c ibus-ibus-23abee8/client/gtk2/ibusimcontext.c
124 --- ibus-ibus-533dfc2/client/gtk2/ibusimcontext.c 2011-09-24 00:11:24.000000000 +0900
125 +++ ibus-ibus-23abee8/client/gtk2/ibusimcontext.c 2011-11-21 11:06:21.000000000 +0900
126 @@ -734,6 +734,19 @@
127 if (ibusimcontext->has_focus)
128 return;
130 + /* don't set focus on password entry */
131 + if (ibusimcontext->client_window != NULL) {
132 + GtkWidget *widget;
134 + gdk_window_get_user_data (ibusimcontext->client_window,
135 + (gpointer *)&widget);
137 + if (GTK_IS_ENTRY (widget) &&
138 + !gtk_entry_get_visibility (GTK_ENTRY (widget))) {
139 + return;
143 if (_focus_im_context != NULL) {
144 g_assert (_focus_im_context != context);
145 gtk_im_context_focus_out (_focus_im_context);
146 diff -ruN ibus-ibus-533dfc2/client/gtk3/ibusimcontext.c ibus-ibus-23abee8/client/gtk3/ibusimcontext.c
147 --- ibus-ibus-533dfc2/client/gtk3/ibusimcontext.c 2011-09-24 00:11:24.000000000 +0900
148 +++ ibus-ibus-23abee8/client/gtk3/ibusimcontext.c 2011-11-21 11:06:21.000000000 +0900
149 @@ -734,6 +734,19 @@
150 if (ibusimcontext->has_focus)
151 return;
153 + /* don't set focus on password entry */
154 + if (ibusimcontext->client_window != NULL) {
155 + GtkWidget *widget;
157 + gdk_window_get_user_data (ibusimcontext->client_window,
158 + (gpointer *)&widget);
160 + if (GTK_IS_ENTRY (widget) &&
161 + !gtk_entry_get_visibility (GTK_ENTRY (widget))) {
162 + return;
166 if (_focus_im_context != NULL) {
167 g_assert (_focus_im_context != context);
168 gtk_im_context_focus_out (_focus_im_context);
169 diff -ruN ibus-ibus-533dfc2/client/x11/main.c ibus-ibus-23abee8/client/x11/main.c
170 --- ibus-ibus-533dfc2/client/x11/main.c 2011-09-24 00:11:24.000000000 +0900
171 +++ ibus-ibus-23abee8/client/x11/main.c 2011-11-21 11:06:21.000000000 +0900
172 @@ -116,6 +116,8 @@
174 static IBusBus *_bus = NULL;
176 +static gboolean _use_sync_mode = FALSE;
178 static void
179 _xim_preedit_start (XIMS xims, const X11IC *x11ic)
181 @@ -443,6 +445,31 @@
185 +static void
186 +_process_key_event_done (GObject *object,
187 + GAsyncResult *res,
188 + gpointer user_data)
190 + IBusInputContext *context = (IBusInputContext *)object;
191 + IMForwardEventStruct *pfe = (IMForwardEventStruct*) user_data;
193 + GError *error = NULL;
194 + gboolean retval = ibus_input_context_process_key_event_async_finish (
195 + context,
196 + res,
197 + &error);
199 + if (error != NULL) {
200 + g_warning ("Process Key Event failed: %s.", error->message);
201 + g_error_free (error);
204 + if (retval == FALSE) {
205 + IMForwardEvent (_xims, (XPointer) pfe);
207 + g_slice_free (IMForwardEventStruct, pfe);
210 static int
211 xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
213 @@ -469,30 +496,57 @@
214 if (event.type == GDK_KEY_RELEASE) {
215 event.state |= IBUS_RELEASE_MASK;
217 - retval = ibus_input_context_process_key_event (x11ic->context,
218 - event.keyval,
219 - event.hardware_keycode - 8,
220 - event.state);
221 - if (retval) {
222 - if (! x11ic->has_preedit_area) {
223 - _xim_set_cursor_location (x11ic);
225 + if (_use_sync_mode) {
226 + retval = ibus_input_context_process_key_event (
227 + x11ic->context,
228 + event.keyval,
229 + event.hardware_keycode - 8,
230 + event.state);
231 + if (retval) {
232 + if (! x11ic->has_preedit_area) {
233 + _xim_set_cursor_location (x11ic);
235 + return 1;
237 - return 1;
240 - IMForwardEventStruct fe;
241 - memset (&fe, 0, sizeof (fe));
242 + IMForwardEventStruct fe;
243 + memset (&fe, 0, sizeof (fe));
245 - fe.major_code = XIM_FORWARD_EVENT;
246 - fe.icid = x11ic->icid;
247 - fe.connect_id = x11ic->connect_id;
248 - fe.sync_bit = 0;
249 - fe.serial_number = 0L;
250 - fe.event = call_data->event;
251 + fe.major_code = XIM_FORWARD_EVENT;
252 + fe.icid = x11ic->icid;
253 + fe.connect_id = x11ic->connect_id;
254 + fe.sync_bit = 0;
255 + fe.serial_number = 0L;
256 + fe.event = call_data->event;
258 - IMForwardEvent (_xims, (XPointer) &fe);
259 + IMForwardEvent (_xims, (XPointer) &fe);
261 - return 1;
262 + retval = 1;
264 + else {
265 + IMForwardEventStruct *pfe;
267 + pfe = g_slice_new0 (IMForwardEventStruct);
268 + pfe->major_code = XIM_FORWARD_EVENT;
269 + pfe->icid = x11ic->icid;
270 + pfe->connect_id = x11ic->connect_id;
271 + pfe->sync_bit = 0;
272 + pfe->serial_number = 0L;
273 + pfe->event = call_data->event;
275 + ibus_input_context_process_key_event_async (
276 + x11ic->context,
277 + event.keyval,
278 + event.hardware_keycode - 8,
279 + event.state,
280 + -1,
281 + NULL,
282 + _process_key_event_done,
283 + pfe);
284 + retval = 1;
286 + return retval;
290 @@ -897,6 +951,25 @@
291 _xim_preedit_end (_xims, x11ic);
294 +static gboolean
295 +_get_boolean_env(const gchar *name,
296 + gboolean defval)
298 + const gchar *value = g_getenv (name);
300 + if (value == NULL)
301 + return defval;
303 + if (g_strcmp0 (value, "") == 0 ||
304 + g_strcmp0 (value, "0") == 0 ||
305 + g_strcmp0 (value, "false") == 0 ||
306 + g_strcmp0 (value, "False") == 0 ||
307 + g_strcmp0 (value, "FALSE") == 0)
308 + return FALSE;
310 + return TRUE;
313 static void
314 _init_ibus (void)
316 @@ -909,6 +982,8 @@
318 g_signal_connect (_bus, "disconnected",
319 G_CALLBACK (_bus_disconnected_cb), NULL);
321 + _use_sync_mode = _get_boolean_env ("IBUS_ENABLE_SYNC_MODE", FALSE);
324 static void
325 diff -ruN ibus-ibus-533dfc2/ibus/_config.py.in ibus-ibus-23abee8/ibus/_config.py.in
326 --- ibus-ibus-533dfc2/ibus/_config.py.in 2011-09-24 00:11:24.000000000 +0900
327 +++ ibus-ibus-23abee8/ibus/_config.py.in 2011-11-21 11:06:21.000000000 +0900
328 @@ -45,10 +45,14 @@
330 def get_ICON_KEYBOARD():
331 import gtk
332 - theme = gtk.icon_theme_get_default()
333 icon = '@IBUS_ICON_KEYBOARD@'
334 + fallback_icon = 'ibus-keyboard'
335 + settings = gtk.settings_get_default()
336 + if settings.get_property('gtk-icon-theme-name') != 'gnome':
337 + return fallback_icon
338 + theme = gtk.icon_theme_get_default()
339 if not theme.lookup_icon(icon, 18, 0):
340 - icon = 'ibus-keyboard'
341 + return fallback_icon
342 return icon
344 ISOCODES_PREFIX='@ISOCODES_PREFIX@'
345 diff -ruN ibus-ibus-533dfc2/src/ibus.h ibus-ibus-23abee8/src/ibus.h
346 --- ibus-ibus-533dfc2/src/ibus.h 2011-09-24 00:11:24.000000000 +0900
347 +++ ibus-ibus-23abee8/src/ibus.h 2011-11-21 11:06:21.000000000 +0900
348 @@ -52,6 +52,7 @@
349 #include <ibusconfig.h>
350 #include <ibusconfigservice.h>
351 #include <ibuspanelservice.h>
352 +#include <ibusutil.h>
354 #undef __IBUS_H_INSIDE__
356 diff -ruN ibus-ibus-533dfc2/ui/gtk/main.py ibus-ibus-23abee8/ui/gtk/main.py
357 --- ibus-ibus-533dfc2/ui/gtk/main.py 2011-09-24 00:11:24.000000000 +0900
358 +++ ibus-ibus-23abee8/ui/gtk/main.py 2011-11-21 11:06:21.000000000 +0900
359 @@ -86,6 +86,9 @@
360 pass
362 def launch_panel(replace):
363 + settings = gtk.settings_get_default()
364 + if settings.get_property('gtk-fallback-icon-theme') == None:
365 + settings.set_property('gtk-fallback-icon-theme', 'gnome')
366 # gtk.settings_get_default().props.gtk_theme_name = "/home/phuang/.themes/aud-Default/gtk-2.0/gtkrc"
367 # gtk.rc_parse("./themes/default/gtkrc")
368 UIApplication(replace).run()
369 diff -ruN ibus-ibus-533dfc2/ui/gtk/panel.py ibus-ibus-23abee8/ui/gtk/panel.py
370 --- ibus-ibus-533dfc2/ui/gtk/panel.py 2011-09-24 00:11:24.000000000 +0900
371 +++ ibus-ibus-23abee8/ui/gtk/panel.py 2011-11-21 11:06:21.000000000 +0900
372 @@ -477,7 +477,7 @@
373 menu = gtk.Menu()
374 item = gtk.ImageMenuItem(_("No input window"))
375 size = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
376 - item.set_image(_icon.IconWidget("gtk-info", size[0]))
377 + item.set_image(_icon.IconWidget("gtk-dialog-info", size[0]))
378 menu.add(item)
379 menu.show_all()
380 else:
381 diff -ruN ibus-ibus-533dfc2/ui/gtk/toolitem.py ibus-ibus-23abee8/ui/gtk/toolitem.py
382 --- ibus-ibus-533dfc2/ui/gtk/toolitem.py 2011-09-24 00:11:24.000000000 +0900
383 +++ ibus-ibus-23abee8/ui/gtk/toolitem.py 2011-11-21 11:06:21.000000000 +0900
384 @@ -73,11 +73,9 @@
385 self.set_icon_name(self._prop.icon)
387 if self._prop.visible:
388 - self.set_no_show_all(False)
389 - self.show_all()
390 + self.show()
391 else:
392 - self.set_no_show_all(True)
393 - self.hide_all()
394 + self.hide()
396 def do_clicked(self):
397 self.emit("property-activate", self._prop.key, self._prop.state)
398 @@ -128,11 +126,9 @@
399 self.set_active(self._prop.state == ibus.PROP_STATE_CHECKED)
400 self.set_sensitive(self._prop.sensitive)
401 if self._prop.visible:
402 - self.set_no_show_all(False)
403 - self.show_all()
404 + self.show()
405 else:
406 - self.set_no_show_all(True)
407 - self.hide_all()
408 + self.hide()
410 def do_toggled(self):
411 # Do not send property-activate to engine in case the event is