[evolution-patches] libgal's e-text focus out should not clean im_context signal handlers. [need review]
- From: Yong Sun <Yong Sun Sun COM>
- To: evolution-patches ximian com
- Cc: sceri-evolution Sun COM
- Subject: [evolution-patches] libgal's e-text focus out should not clean im_context signal handlers. [need review]
- Date: Wed, 14 Jul 2004 15:25:20 -0700
Hi, guys,
Please help to review this little patch.
Invoke evolution on Japanese locales and open Mail composer. Switch
"To:" field, input 'Ctrl + Space' and change to Kanji-mode. Input 'a',
'Space', 'Space', 'i', then the preedit area is erase without determing
the former char 'a'. This is because when e-text dealing with the focus
out event, it will clean the im_context signal handlers, but when
Japanese IIIM candidate window shows, e-text will lose its focus.
This patch also fix an on-spot issue of e-text. While drawing the
cursor, notify the current cursor position to im_context.
Regards
Index: e-text.c
===================================================================
RCS file: /export/src/cvs/gal/gal/e-text/e-text.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- e-text.c 2003/11/06 04:30:50 1.4
+++ e-text.c 2004/07/14 21:58:52 1.5
@@ -1618,9 +1618,18 @@
} else {
if (text->show_cursor) {
PangoRectangle strong_pos, weak_pos;
- char *offs = g_utf8_offset_to_pointer (text->text,
text->selection_start);
+ GdkRectangle pixel_pos;
+ char *offs = g_utf8_offset_to_pointer (text->text,
text->selection_start);
pango_layout_get_cursor_pos (text->layout, offs - text->text +
text->preedit_len, &strong_pos, &weak_pos);
+
+ /* notify the location to gtk_im_context */
+ pixel_pos.x = PANGO_PIXELS (strong_pos.x);
+ pixel_pos.y = PANGO_PIXELS (strong_pos.y);
+ pixel_pos.width = PANGO_PIXELS (strong_pos.width);
+ pixel_pos.height = PANGO_PIXELS (strong_pos.height);
+ gtk_im_context_set_cursor_location(text->im_context, &pixel_pos);
+
draw_pango_rectangle (drawable, main_gc, xpos, ypos, strong_pos);
if (strong_pos.x != weak_pos.x ||
strong_pos.y != weak_pos.y ||
@@ -2190,13 +2199,6 @@
start_editing (text);
text->show_cursor = FALSE; /* so we'll redraw and the cursor will
be shown */
} else {
- if (text->im_context) {
- g_signal_handlers_disconnect_matched (text->im_context,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
- NULL, text);
- text->im_context_signals_registered = FALSE;
- }
e_text_stop_editing (text);
if (text->timeout_id) {
g_source_remove(text->timeout_id);
--
Yong Sun <Yong Sun Sun COM> x82126
Sun (China) ERI -- AGC
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]