[evolution-patches] im fix
- From: Radek Doulík <rodo ximian com>
- To: Patches <evolution-patches ximian com>
- Cc: Larry Ewing <lewing ximian com>
- Subject: [evolution-patches] im fix
- Date: 24 Apr 2003 19:42:59 +0200
Attached patch tries to reset IM context properly and calls IM in
key_press handler before everything else. It should fix input for
languages which need preedit. We have to show preedit string at some
point in future as well, but I think this fix should be enough for now
to make IM work.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.1783
diff -u -p -r1.1783 ChangeLog
--- ChangeLog 17 Apr 2003 15:10:19 -0000 1.1783
+++ ChangeLog 24 Apr 2003 17:41:08 -0000
@@ -1,3 +1,43 @@
+2003-04-24 Radek Doulik <rodo ximian com>
+
+ * htmlengine.c (html_engine_freeze): call gtk_html_im_reset when
+ freezing (count == 0)
+
+ * htmlcursor.c: call gtk_html_im_reset whenever we move cursor
+
+ * gtkhtml.c (gtk_html_im_reset): new function, resets im context
+ if need_im_reset is TRUE
+ (key_press_event): call im context first, set need_im_reset
+
+2003-04-23 Radek Doulik <rodo ximian com>
+
+ * htmltextslave.c (get_words_width): fix len calculation, we are
+ incrementing the space now so we have to substract 1 here
+
+ * htmlclueflow.c (layout_line): set current object y to let object
+ know on what line it lives
+
+2003-04-21 Radek Doulik <rodo ximian com>
+
+ * htmlclueflow.c (html_clueflow_get_line_offset): go forward
+ instead of backward from head of line when calculating line offset
+
+ * htmltext.c (html_text_text_line_length): modify line_offset only
+ if != -1
+
+2003-04-18 Radek Doulik <rodo ximian com>
+
+ * htmltext.c (min_word_width): renamed to express the
+ functionality better
+ (min_word_width_calc_tabs): renamed as well, fix the
+ calculation. the minimal word width is the width of word idx (with
+ optional non-breaking prefix) on begin of line
+
+ * htmltextslave.c (get_words_width): locate the right word, do not
+ stay at first space
+ (get_words_width): don't substract tabs, they are already included
+ in len and width has already one space width for each of them
+
2003-04-16 Larry Ewing <lewing ximian com>
* htmlembedded.c (copy): comment out debug wanring.
Index: gtkhtml-private.h
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml-private.h,v
retrieving revision 1.37
diff -u -p -r1.37 gtkhtml-private.h
--- gtkhtml-private.h 18 Mar 2003 19:53:38 -0000 1.37
+++ gtkhtml-private.h 24 Apr 2003 17:41:08 -0000
@@ -75,5 +75,6 @@ void gtk_html_editor_event
GtkHTMLEditorEventType event,
GValue *args);
void gtk_html_api_set_language (GtkHTML *html);
+void gtk_html_im_reset (GtkHTML *html);
#endif /* _GTKHTML_PRIVATE_H */
Index: gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.505
diff -u -p -r1.505 gtkhtml.c
--- gtkhtml.c 16 Apr 2003 17:51:55 -0000 1.505
+++ gtkhtml.c 24 Apr 2003 17:41:08 -0000
@@ -786,6 +786,15 @@ style_set (GtkWidget *widget, GtkStyle
html_engine_schedule_update (engine);
}
+void
+gtk_html_im_reset (GtkHTML *html)
+{
+ if (html->priv->need_im_reset) {
+ html->priv->need_im_reset = FALSE;
+ gtk_im_context_reset (html->priv->im_context);
+ }
+}
+
static gint
key_press_event (GtkWidget *widget, GdkEventKey *event)
{
@@ -797,24 +806,23 @@ key_press_event (GtkWidget *widget, GdkE
html->priv->update_styles = FALSE;
html->priv->event_time = event->time;
+ if (html_engine_get_editable (html->engine)) {
+ if (gtk_im_context_filter_keypress (html->priv->im_context, event)) {
+ html_engine_reset_blinking_cursor (html->engine);
+ html->priv->need_im_reset = TRUE;
+ return TRUE;
+ }
+ }
+
if (html_class->use_emacs_bindings && html_class->emacs_bindings && !html->binding_handled)
gtk_binding_set_activate (html_class->emacs_bindings, event->keyval, event->state, GTK_OBJECT (widget));
if (!html->binding_handled)
- gtk_bindings_activate (GTK_OBJECT (widget), event->keyval, event->state);
+ GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
retval = html->binding_handled;
update = html->priv->update_styles;
- if (!html->binding_handled && html_engine_get_editable (html->engine)) {
- if (gtk_im_context_filter_keypress (html->priv->im_context, event)) {
- html_engine_reset_blinking_cursor (html->engine);
- /* entry->need_im_reset = TRUE; */
- retval = TRUE;
- update = FALSE;
- }
- }
-
if (retval && update)
gtk_html_update_styles (html);
@@ -2712,7 +2720,6 @@ static void
gtk_html_im_commit_cb (GtkIMContext *context, const gchar *str, GtkHTML *html)
{
html_engine_paste_text (html->engine, str, -1);
- html->priv->need_im_reset = TRUE;
}
static void
Index: htmlcursor.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlcursor.c,v
retrieving revision 1.64
diff -u -p -r1.64 htmlcursor.c
--- htmlcursor.c 16 Dec 2002 15:06:31 -0000 1.64
+++ htmlcursor.c 24 Apr 2003 17:41:15 -0000
@@ -27,6 +27,7 @@
#include <config.h>
#include <glib.h>
+#include "gtkhtml-private.h"
#include "htmlclue.h"
#include "htmlengine.h"
#include "htmlengine-edit.h"
@@ -153,6 +154,8 @@ html_cursor_home (HTMLCursor *cursor,
g_return_if_fail (cursor != NULL);
g_return_if_fail (engine != NULL);
+ gtk_html_im_reset (engine->widget);
+
if (engine->clue == NULL) {
cursor->object = NULL;
cursor->offset = 0;
@@ -238,6 +241,8 @@ html_cursor_forward (HTMLCursor *cursor,
g_return_val_if_fail (cursor != NULL, FALSE);
g_return_val_if_fail (engine != NULL, FALSE);
+ gtk_html_im_reset (engine->widget);
+
if (engine->need_spell_check)
html_engine_spell_check_range (engine, engine->cursor, engine->cursor);
@@ -303,6 +308,8 @@ html_cursor_backward (HTMLCursor *cursor
g_return_val_if_fail (cursor != NULL, FALSE);
g_return_val_if_fail (engine != NULL, FALSE);
+ gtk_html_im_reset (engine->widget);
+
if (engine->need_spell_check)
html_engine_spell_check_range (engine, engine->cursor, engine->cursor);
@@ -327,6 +334,8 @@ html_cursor_up (HTMLCursor *cursor,
gint orig_y;
gboolean new_line;
+ gtk_html_im_reset (engine->widget);
+
if (cursor->object == NULL) {
g_warning ("The cursor is in a NULL position: going home.");
html_cursor_home (cursor, engine);
@@ -413,6 +422,8 @@ html_cursor_down (HTMLCursor *cursor,
gint orig_y;
gboolean new_line;
+ gtk_html_im_reset (engine->widget);
+
if (cursor->object == NULL) {
g_warning ("The cursor is in a NULL position: going home.");
html_cursor_home (cursor, engine);
@@ -505,6 +516,8 @@ html_cursor_jump_to (HTMLCursor *cursor,
g_return_val_if_fail (cursor != NULL, FALSE);
g_return_val_if_fail (object != NULL, FALSE);
+ gtk_html_im_reset (engine->widget);
+
if (engine->need_spell_check)
html_engine_spell_check_range (engine, engine->cursor, engine->cursor);
@@ -542,6 +555,8 @@ html_cursor_beginning_of_document (HTMLC
g_return_if_fail (engine != NULL);
g_return_if_fail (HTML_IS_ENGINE (engine));
+ gtk_html_im_reset (engine->widget);
+
if (engine->need_spell_check)
html_engine_spell_check_range (engine, engine->cursor, engine->cursor);
@@ -557,6 +572,8 @@ html_cursor_end_of_document (HTMLCursor
g_return_if_fail (engine != NULL);
g_return_if_fail (HTML_IS_ENGINE (engine));
+ gtk_html_im_reset (engine->widget);
+
if (engine->need_spell_check)
html_engine_spell_check_range (engine, engine->cursor, engine->cursor);
@@ -575,6 +592,8 @@ html_cursor_end_of_line (HTMLCursor *cur
g_return_val_if_fail (engine != NULL, FALSE);
g_return_val_if_fail (HTML_IS_ENGINE (engine), FALSE);
+ gtk_html_im_reset (engine->widget);
+
cursor->have_target_x = FALSE;
if (engine->need_spell_check)
@@ -611,6 +630,8 @@ html_cursor_beginning_of_line (HTMLCurso
g_return_val_if_fail (engine != NULL, FALSE);
g_return_val_if_fail (HTML_IS_ENGINE (engine), FALSE);
+ gtk_html_im_reset (engine->widget);
+
cursor->have_target_x = FALSE;
if (engine->need_spell_check)
@@ -663,6 +684,8 @@ html_cursor_jump_to_position (HTMLCursor
g_return_if_fail (cursor != NULL);
g_return_if_fail (position >= 0);
+ gtk_html_im_reset (engine->widget);
+
if (engine->need_spell_check)
html_engine_spell_check_range (engine, engine->cursor, engine->cursor);
@@ -766,6 +789,8 @@ html_cursor_beginning_of_paragraph (HTML
gboolean rv = FALSE;
gint level, new_level;
+ gtk_html_im_reset (engine->widget);
+
level = html_object_get_parent_level (cursor->object);
flow = cursor->object->parent;
@@ -802,6 +827,8 @@ html_cursor_end_of_paragraph (HTMLCursor
HTMLObject *flow;
gboolean rv = FALSE;
gint level, new_level;
+
+ gtk_html_im_reset (engine->widget);
level = html_object_get_parent_level (cursor->object);
flow = cursor->object->parent;
Index: htmlengine.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine.c,v
retrieving revision 1.536
diff -u -p -r1.536 htmlengine.c
--- htmlengine.c 15 Apr 2003 06:40:06 -0000 1.536
+++ htmlengine.c 24 Apr 2003 17:41:16 -0000
@@ -4781,6 +4781,9 @@ html_engine_freeze (HTMLEngine *engine)
g_return_if_fail (engine != NULL);
g_return_if_fail (HTML_IS_ENGINE (engine));
+ if (engine->freeze_count == 0)
+ gtk_html_im_reset (engine->widget);
+
html_engine_flush_draw_queue (engine);
/* printf ("html_engine_freeze %d\n", engine->freeze_count); */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]