- Update patch for RH bug #157400.

- Update patch for RH bug #157505.
This commit is contained in:
Matthew Barnes 2006-07-13 16:08:52 +00:00
parent fcc44a1635
commit e1b66c3780
3 changed files with 229 additions and 3 deletions

View File

@ -0,0 +1,112 @@
--- evolution-2.7.4/widgets/text/e-text.h.cal 2006-07-13 10:15:56.000000000 -0400
+++ evolution-2.7.4/widgets/text/e-text.h 2006-07-13 10:18:20.000000000 -0400
@@ -109,6 +109,7 @@
const gchar *text; /* Text to display --- from the ETextModel */
gint preedit_len; /* preedit length to display */
+ gint preedit_pos; /* preedit cursor position */
PangoLayout *layout;
int num_lines; /* Number of lines of text */
--- evolution-2.7.4/widgets/text/e-text.c.cal 2006-07-13 10:15:51.000000000 -0400
+++ evolution-2.7.4/widgets/text/e-text.c 2006-07-13 10:18:20.000000000 -0400
@@ -132,6 +132,7 @@
static void reset_layout_attrs (EText *text);
+static void update_im_cursor_position (EText *text);
#if 0
/* GtkEditable Methods */
static void e_text_editable_do_insert_text (GtkEditable *editable,
@@ -325,6 +326,8 @@
pango_layout_set_attributes (text->layout, attrs);
pango_attr_list_unref (attrs);
}
+
+ update_im_cursor_position (text);
}
if (preedit_string)
@@ -3723,6 +3726,7 @@
text->model = e_text_model_new ();
text->text = e_text_model_get_text (text->model);
text->preedit_len = 0;
+ text->preedit_pos = 0;
text->layout = NULL;
text->revert = NULL;
@@ -3840,17 +3844,71 @@
}
}
+/*
+ * Fetch cursor location into Strong or Weak positions so as to
+ * display the preedit candidate selection window in the right place
+ */
+static void
+e_text_get_cursor_locations (EText *text,
+ GdkRectangle *strong_pos,
+ GdkRectangle *weak_pos)
+{
+ double x1, y1;
+ PangoRectangle pango_strong_pos;
+ PangoRectangle pango_weak_pos;
+ int cx, cy;
+ gint index;
+
+ gnome_canvas_item_get_bounds (GNOME_CANVAS_ITEM (text), &x1, &y1, NULL, NULL);
+
+ gnome_canvas_get_scroll_offsets (GNOME_CANVAS (GNOME_CANVAS_ITEM (text)->canvas), &cx, &cy);
+
+ index = g_utf8_offset_to_pointer (text->text, text->selection_start) - text->text;
+
+ pango_layout_get_cursor_pos (text->layout, index + text->preedit_pos,
+ strong_pos ? &pango_strong_pos : NULL,
+ weak_pos ? &pango_weak_pos : NULL);
+
+ if (strong_pos) {
+ strong_pos->x = x1 - cx - text->xofs_edit + pango_strong_pos.x / PANGO_SCALE;
+ strong_pos->y = y1 - cy - text->yofs_edit + pango_strong_pos.y / PANGO_SCALE;
+ strong_pos->width = 0;
+ strong_pos->height = pango_strong_pos.height / PANGO_SCALE;
+ }
+
+ if (weak_pos) {
+ weak_pos->x = x1 - cx - text->xofs_edit + pango_weak_pos.x / PANGO_SCALE;
+ weak_pos->y = y1 - cy - text->yofs_edit + pango_weak_pos.y / PANGO_SCALE;
+ weak_pos->width = 0;
+ weak_pos->height = pango_weak_pos.height / PANGO_SCALE;
+ }
+}
+
+/* Update IM's cursor position to display candidate selection window */
+static void
+update_im_cursor_position (EText *text)
+{
+ GdkRectangle area;
+
+ e_text_get_cursor_locations (text, &area, NULL);
+
+ gtk_im_context_set_cursor_location (text->im_context, &area);
+}
+
static void
e_text_preedit_changed_cb (GtkIMContext *context,
- EText *etext)
+ EText *etext)
{
gchar *preedit_string = NULL;
+ gint cursor_pos;
gtk_im_context_get_preedit_string (context, &preedit_string,
- NULL, NULL);
+ NULL, &cursor_pos);
+ cursor_pos = CLAMP (cursor_pos, 0, g_utf8_strlen (preedit_string, -1));
etext->preedit_len = strlen (preedit_string);
- g_free (preedit_string);
+ etext->preedit_pos = g_utf8_offset_to_pointer (preedit_string, cursor_pos) - preedit_string;
+ g_free (preedit_string);
g_signal_emit (etext, e_text_signals[E_TEXT_KEYPRESS], 0, 0, 0);
}

View File

@ -0,0 +1,110 @@
--- evolution-2.7.4/widgets/table/e-cell-text.c.task 2006-07-13 10:56:19.000000000 -0400
+++ evolution-2.7.4/widgets/table/e-cell-text.c 2006-07-13 10:56:27.000000000 -0400
@@ -199,6 +199,7 @@
gboolean im_context_signals_registered;
guint16 preedit_length; /* length of preedit string, in bytes */
+ gint preedit_pos; /* position of preedit cursor */
ECellActions actions;
};
@@ -222,6 +223,7 @@
static void _insert (ECellTextView *text_view, char *string, int value);
static void _delete_selection (ECellTextView *text_view);
static PangoAttrList* build_attr_list (ECellTextView *text_view, int row, int text_length);
+static void update_im_cursor_location (ECellTextView *tv);
static ECellClass *parent_class;
@@ -560,6 +562,9 @@
if (preedit_attrs)
pango_attr_list_unref (preedit_attrs);
pango_attr_list_unref (attrs);
+
+ update_im_cursor_location (text_view);
+
return layout;
}
@@ -1863,6 +1868,66 @@
/* IM Context Callbacks */
static void
+e_cell_text_get_cursor_locations (ECellTextView *tv,
+ GdkRectangle *strong_pos,
+ GdkRectangle *weak_pos)
+{
+ GdkRectangle area;
+ CellEdit *edit=tv->edit;
+ ECellView *cell_view = (ECellView *)tv;
+ ETableItem *item = E_TABLE_ITEM ((cell_view)->e_table_item_view);
+ GnomeCanvasItem *parent_item = GNOME_CANVAS_ITEM (item)->parent;
+ PangoRectangle pango_strong_pos;
+ PangoRectangle pango_weak_pos;
+ gint x, y, col, row;
+ gdouble x1,y1;
+ gint cx, cy;
+ gint index;
+
+ row = edit->row;
+ col = edit->view_col;
+
+ e_table_item_get_cell_geometry (item, &row, &col,
+ &x, &y, NULL, &area.height);
+
+ gnome_canvas_item_get_bounds (GNOME_CANVAS_ITEM (parent_item), &x1, &y1, NULL, NULL);
+
+ gnome_canvas_get_scroll_offsets (GNOME_CANVAS (GNOME_CANVAS_ITEM (parent_item)->canvas), &cx, &cy);
+
+ index = edit->selection_end + edit->preedit_pos;
+
+ pango_layout_get_cursor_pos (edit->layout,
+ index,
+ strong_pos ? &pango_strong_pos : NULL,
+ weak_pos ? &pango_weak_pos : NULL);
+
+ if (strong_pos) {
+ strong_pos->x = x + x1 - cx - edit->xofs_edit + pango_strong_pos.x / PANGO_SCALE;
+ strong_pos->y = y + y1 - cy - edit->yofs_edit + pango_strong_pos.y / PANGO_SCALE;
+ strong_pos->width = 0;
+ strong_pos->height = pango_strong_pos.height / PANGO_SCALE;
+ }
+
+ if (weak_pos) {
+ weak_pos->x = x + x1 - cx - edit->xofs_edit + pango_weak_pos.x / PANGO_SCALE;
+ weak_pos->y = y + y1 - cy - edit->yofs_edit + pango_weak_pos.y / PANGO_SCALE;
+ weak_pos->width = 0;
+ weak_pos->height = pango_weak_pos.height / PANGO_SCALE;
+ }
+}
+
+static void
+update_im_cursor_location (ECellTextView *tv)
+{
+ CellEdit *edit=tv->edit;
+ GdkRectangle area;
+
+ e_cell_text_get_cursor_locations (tv, &area, NULL);
+
+ gtk_im_context_set_cursor_location (edit->im_context, &area);
+}
+
+static void
e_cell_text_preedit_changed_cb (GtkIMContext *context,
ECellTextView *tv)
{
@@ -1871,10 +1936,12 @@
CellEdit *edit=tv->edit;
gtk_im_context_get_preedit_string (edit->im_context, &preedit_string,
NULL, &cursor_pos);
-
+
edit->preedit_length = strlen (preedit_string);
- cursor_pos = CLAMP (cursor_pos, 0, g_utf8_strlen (preedit_string, -1));
+ cursor_pos = CLAMP (cursor_pos, 0, g_utf8_strlen (preedit_string, -1));
+ edit->preedit_pos = g_utf8_offset_to_pointer (preedit_string, cursor_pos) - preedit_string;
g_free (preedit_string);
+
ect_queue_redraw (tv, edit->view_col, edit->row);
}

View File

@ -47,7 +47,7 @@
Name: evolution Name: evolution
Version: 2.7.4 Version: 2.7.4
Release: 1 Release: 2
License: GPL License: GPL
Group: Applications/Productivity Group: Applications/Productivity
Summary: GNOME's next-generation groupware suite Summary: GNOME's next-generation groupware suite
@ -116,10 +116,10 @@ Patch809: evolution-2.6.0-prototypes.patch
Patch900: evolution-2.7.2.1-quit-resize-crash.patch Patch900: evolution-2.7.2.1-quit-resize-crash.patch
# RH bug #157400 / Gnome.org bug #303877 # RH bug #157400 / Gnome.org bug #303877
Patch901: evolution-2.7.3-candidate-window-position-task.patch Patch901: evolution-2.7.4-candidate-window-position-task.patch
# RH bug #157505 / Gnome.org bug #303878 # RH bug #157505 / Gnome.org bug #303878
Patch902: evolution-2.7.3-candidate-window-position-calendar.patch Patch902: evolution-2.7.4-candidate-window-position-calendar.patch
# RH bug #190359 / Gnome.org bug #211058 # RH bug #190359 / Gnome.org bug #211058
Patch903: evolution-2.7.3-filter-datespec.patch Patch903: evolution-2.7.3-filter-datespec.patch
@ -677,6 +677,10 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/evolution/%{evo_major}/libmenus.so %{_libdir}/evolution/%{evo_major}/libmenus.so
%changelog %changelog
* Thu Jul 13 2006 Matthew Barnes <mbarnes@redhat.com> - 2.7.4-2
- Update patch for RH bug #157400.
- Update patch for RH bug #157505.
* Wed Jul 12 2006 Matthew Barnes <mbarnes@redhat.com> - 2.7.4-1 * Wed Jul 12 2006 Matthew Barnes <mbarnes@redhat.com> - 2.7.4-1
- Update to 2.7.4 - Update to 2.7.4
- Remove evo-calendar-print-with-pango-7.patch (fixed upstream). - Remove evo-calendar-print-with-pango-7.patch (fixed upstream).