rpms/gtkhtml3/devel gtkhtml-3.15.92-cursor-position.patch, NONE, 1.1 gtkhtml3.spec, 1.100, 1.101
Matthew Barnes (mbarnes)
fedora-extras-commits at redhat.com
Thu Sep 13 16:11:12 UTC 2007
Author: mbarnes
Update of /cvs/pkgs/rpms/gtkhtml3/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv1485
Modified Files:
gtkhtml3.spec
Added Files:
gtkhtml-3.15.92-cursor-position.patch
Log Message:
* Thu Sep 13 2007 Matthew Barnes <mbarnes at redhat.com> - 3.15.92-2.fc8
- Add patch for GNOME bug #443850 (fix cursor position after typing halant).
gtkhtml-3.15.92-cursor-position.patch:
--- NEW FILE gtkhtml-3.15.92-cursor-position.patch ---
diff -up gtkhtml-3.15.92/src/gtkhtml.c.cursor-position gtkhtml-3.15.92/src/gtkhtml.c
--- gtkhtml-3.15.92/src/gtkhtml.c.cursor-position 2007-09-13 11:01:15.000000000 -0400
+++ gtkhtml-3.15.92/src/gtkhtml.c 2007-09-13 11:02:08.000000000 -0400
@@ -3221,9 +3221,9 @@ gtk_html_im_commit_cb (GtkIMContext *con
D_IM (printf ("IM delete last preedit %d + %d\n", html->priv->im_pre_pos, html->priv->im_pre_len);)
html_undo_freeze (html->engine->undo);
- html_cursor_jump_to_position_no_spell (html->engine->cursor, html->engine, html->priv->im_pre_pos);
+ html_cursor_exactly_jump_to_position_no_spell (html->engine->cursor, html->engine, html->priv->im_pre_pos);
html_engine_set_mark (html->engine);
- html_cursor_jump_to_position_no_spell (html->engine->cursor, html->engine, html->priv->im_pre_pos + html->priv->im_pre_len);
+ html_cursor_exactly_jump_to_position_no_spell (html->engine->cursor, html->engine, html->priv->im_pre_pos + html->priv->im_pre_len);
html_engine_delete (html->engine);
html->priv->im_pre_len = 0;
html_undo_thaw (html->engine->undo);
@@ -3283,9 +3283,9 @@ gtk_html_im_preedit_changed_cb (GtkIMCon
if (html->priv->im_pre_len > 0) {
D_IM (printf ("IM delete last preedit %d + %d\n", html->priv->im_pre_pos, html->priv->im_pre_len);)
- html_cursor_jump_to_position_no_spell (html->engine->cursor, html->engine, html->priv->im_pre_pos);
+ html_cursor_exactly_jump_to_position_no_spell (html->engine->cursor, html->engine, html->priv->im_pre_pos);
html_engine_set_mark (html->engine);
- html_cursor_jump_to_position_no_spell (html->engine->cursor, html->engine, html->priv->im_pre_pos + html->priv->im_pre_len);
+ html_cursor_exactly_jump_to_position_no_spell (html->engine->cursor, html->engine, html->priv->im_pre_pos + html->priv->im_pre_len);
html_engine_delete (html->engine);
deleted = html->priv->im_pre_len;
} else
@@ -3300,7 +3300,7 @@ gtk_html_im_preedit_changed_cb (GtkIMCon
cursor_pos = CLAMP (cursor_pos, 0, html->priv->im_pre_len);
html->priv->im_pre_pos = html->engine->cursor->position;
html_engine_paste_text_with_extra_attributes (html->engine, preedit_string, html->priv->im_pre_len, attrs);
- html_cursor_jump_to_position_no_spell (html->engine->cursor, html->engine, html->priv->im_pre_pos + cursor_pos);
+ html_cursor_exactly_jump_to_position_no_spell (html->engine->cursor, html->engine, html->priv->im_pre_pos + cursor_pos);
} else
html_engine_set_font_style (html->engine, 0, html->priv->im_orig_style);
g_free (preedit_string);
@@ -3407,12 +3407,12 @@ gtk_html_im_delete_surrounding_cb (GtkIM
if (html_engine_get_editable (html->engine) && !html_engine_is_selection_active (html->engine)) {
gint orig_position = html->engine->cursor->position;
- html_cursor_jump_to_position_no_spell (html->engine->cursor, html->engine, orig_position + offset);
+ html_cursor_exactly_jump_to_position_no_spell (html->engine->cursor, html->engine, orig_position + offset);
html_engine_set_mark (html->engine);
- html_cursor_jump_to_position_no_spell (html->engine->cursor, html->engine, orig_position + offset + n_chars);
+ html_cursor_exactly_jump_to_position_no_spell (html->engine->cursor, html->engine, orig_position + offset + n_chars);
html_engine_delete (html->engine);
if (offset >= 0)
- html_cursor_jump_to_position_no_spell (html->engine->cursor, html->engine, orig_position);
+ html_cursor_exactly_jump_to_position_no_spell (html->engine->cursor, html->engine, orig_position);
}
return TRUE;
}
diff -up gtkhtml-3.15.92/src/htmlcursor.c.cursor-position gtkhtml-3.15.92/src/htmlcursor.c
--- gtkhtml-3.15.92/src/htmlcursor.c.cursor-position 2007-09-02 14:55:42.000000000 -0400
+++ gtkhtml-3.15.92/src/htmlcursor.c 2007-09-13 11:02:08.000000000 -0400
@@ -204,12 +204,20 @@ html_cursor_home (HTMLCursor *cursor,
static gboolean
-forward (HTMLCursor *cursor, HTMLEngine *engine)
+forward (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gboolean exact_position)
{
gboolean retval;
+ gboolean (*forward_func) (HTMLObject *self, HTMLCursor *cursor, HTMLEngine *engine);
retval = TRUE;
- if (!html_object_cursor_forward (cursor->object, cursor, engine)) {
+ if (exact_position)
+ forward_func = html_object_cursor_forward_one;
+ else
+ forward_func = html_object_cursor_forward;
+
+ if (!forward_func (cursor->object, cursor, engine)) {
HTMLObject *next;
next = html_object_next_cursor (cursor->object, (gint *) &cursor->offset);
@@ -224,8 +232,10 @@ forward (HTMLCursor *cursor, HTMLEngine
return retval;
}
-gboolean
-html_cursor_forward (HTMLCursor *cursor, HTMLEngine *engine)
+static gboolean
+html_cursor_real_forward (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gboolean exact_position)
{
gboolean retval;
@@ -238,20 +248,41 @@ html_cursor_forward (HTMLCursor *cursor,
html_engine_spell_check_range (engine, engine->cursor, engine->cursor);
cursor->have_target_x = FALSE;
- retval = forward (cursor, engine);
+ retval = forward (cursor, engine, exact_position);
debug_location (cursor);
return retval;
}
+gboolean
+html_cursor_forward (HTMLCursor *cursor,
+ HTMLEngine *engine)
+{
+ return html_cursor_real_forward (cursor, engine, FALSE);
+}
+
+gboolean
+html_cursor_forward_one (HTMLCursor *cursor,
+ HTMLEngine *engine)
+{
+ return html_cursor_real_forward (cursor, engine, TRUE);
+}
+
static gboolean
-backward (HTMLCursor *cursor, HTMLEngine *engine)
+backward (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gboolean exact_position)
{
gboolean retval;
+ gboolean (*backward_func) (HTMLObject *self, HTMLCursor *cursor, HTMLEngine *engine);
retval = TRUE;
- if (!html_object_cursor_backward (cursor->object, cursor, engine)) {
+ if (exact_position)
+ backward_func = html_object_cursor_backward_one;
+ else
+ backward_func = html_object_cursor_backward;
+ if (!backward_func (cursor->object, cursor, engine)) {
HTMLObject *prev;
prev = html_object_prev_cursor (cursor->object, (gint *) &cursor->offset);
@@ -266,9 +297,10 @@ backward (HTMLCursor *cursor, HTMLEngine
return retval;
}
-gboolean
-html_cursor_backward (HTMLCursor *cursor,
- HTMLEngine *engine)
+static gboolean
+html_cursor_real_backward (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gboolean exact_position)
{
gboolean retval;
@@ -281,13 +313,27 @@ html_cursor_backward (HTMLCursor *cursor
html_engine_spell_check_range (engine, engine->cursor, engine->cursor);
cursor->have_target_x = FALSE;
- retval = backward (cursor, engine);
+ retval = backward (cursor, engine, exact_position);
debug_location (cursor);
return retval;
}
+gboolean
+html_cursor_backward (HTMLCursor *cursor,
+ HTMLEngine *engine)
+{
+ return html_cursor_real_backward (cursor, engine, FALSE);
+}
+
+gboolean
+html_cursor_backward_one (HTMLCursor *cursor,
+ HTMLEngine *engine)
+{
+ return html_cursor_real_backward (cursor, engine, TRUE);
+}
+
gboolean
html_cursor_up (HTMLCursor *cursor,
@@ -338,7 +384,7 @@ html_cursor_up (HTMLCursor *cursor,
prev_x = x;
prev_y = y;
- if (! backward (cursor, engine))
+ if (! backward (cursor, engine, FALSE))
return FALSE;
html_object_get_cursor_base (cursor->object,
@@ -523,21 +569,12 @@ html_cursor_down (HTMLCursor *cursor,
}
-/**
- * html_cursor_jump_to:
- * @cursor:
- * @object:
- * @offset:
- *
- * Move the cursor to the specified @offset in the specified @object.
- *
- * Return value: %TRUE if successfull, %FALSE if failed.
- **/
-gboolean
-html_cursor_jump_to (HTMLCursor *cursor,
- HTMLEngine *engine,
- HTMLObject *object,
- guint offset)
+static gboolean
+html_cursor_real_jump_to (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ HTMLObject *object,
+ guint offset,
+ gboolean exact_position)
{
HTMLCursor original;
@@ -557,14 +594,14 @@ html_cursor_jump_to (HTMLCursor *cursor,
html_cursor_copy (&original, cursor);
- while (forward (cursor, engine)) {
+ while (forward (cursor, engine, exact_position)) {
if (cursor->object == object && cursor->offset == offset)
return TRUE;
}
html_cursor_copy (cursor, &original);
- while (backward (cursor, engine)) {
+ while (backward (cursor, engine, exact_position)) {
if (cursor->object == object && cursor->offset == offset)
return TRUE;
}
@@ -572,6 +609,46 @@ html_cursor_jump_to (HTMLCursor *cursor,
return FALSE;
}
+/**
+ * html_cursor_jump_to:
+ * @cursor:
+ * @object:
+ * @offset:
+ *
+ * Move the cursor to the specified @offset in the specified @object.
+ * Where exactly move to, depends on the is_cursor_position in PangoLogAttr say.
+ * This is useful for such as Indic languages that relies on that feature.
+ *
+ * Return value: %TRUE if successfull, %FALSE if failed.
+ **/
+gboolean
+html_cursor_jump_to (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ HTMLObject *object,
+ guint offset)
+{
+ return html_cursor_real_jump_to (cursor, engine, object, offset, FALSE);
+}
+
+/**
+ * html_cursor_exactly_jump_to:
+ * @cursor:
+ * @object:
+ * @offset:
+ *
+ * Move the cursor to near the specified @offset in the specified @object.
+ *
+ * Return value: %TRUE if successful, %FALSE if failed.
+ **/
+gboolean
+html_cursor_exactly_jump_to (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ HTMLObject *object,
+ guint offset)
+{
+ return html_cursor_real_jump_to (cursor, engine, object, offset, TRUE);
+}
+
/* Complex cursor movement commands. */
@@ -588,7 +665,7 @@ html_cursor_beginning_of_document (HTMLC
if (engine->need_spell_check)
html_engine_spell_check_range (engine, engine->cursor, engine->cursor);
- while (backward (cursor, engine))
+ while (backward (cursor, engine, FALSE))
;
}
@@ -605,7 +682,7 @@ html_cursor_end_of_document (HTMLCursor
if (engine->need_spell_check)
html_engine_spell_check_range (engine, engine->cursor, engine->cursor);
- while (forward (cursor, engine))
+ while (forward (cursor, engine, FALSE))
;
}
@@ -617,19 +694,11 @@ html_cursor_get_position (HTMLCursor *cu
return cursor->position;
}
-void
-html_cursor_jump_to_position_no_spell (HTMLCursor *cursor, HTMLEngine *engine, gint position)
-{
- gboolean need_spell_check;
-
- need_spell_check = engine->need_spell_check;
- engine->need_spell_check = FALSE;
- html_cursor_jump_to_position (cursor, engine, position);
- engine->need_spell_check = need_spell_check;
-}
-
-void
-html_cursor_jump_to_position (HTMLCursor *cursor, HTMLEngine *engine, gint position)
+static void
+html_cursor_real_jump_to_position (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gint position,
+ gboolean exact_position)
{
g_return_if_fail (cursor != NULL);
g_return_if_fail (position >= 0);
@@ -641,17 +710,63 @@ html_cursor_jump_to_position (HTMLCursor
if (cursor->position < position) {
while (cursor->position < position) {
- if (! forward (cursor, engine))
+ if (! forward (cursor, engine, exact_position))
break;
}
} else if (cursor->position > position) {
while (cursor->position > position) {
- if (! backward (cursor, engine))
+ if (! backward (cursor, engine, exact_position))
break;
}
}
}
+void
+html_cursor_jump_to_position (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gint position)
+{
+ html_cursor_real_jump_to_position (cursor, engine, position, FALSE);
+}
+
+void
+html_cursor_exactly_jump_to_position (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gint position)
+{
+ html_cursor_real_jump_to_position (cursor, engine, position, TRUE);
+}
+
+static void
+html_cursor_real_jump_to_position_no_spell (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gint position,
+ gboolean exact_position)
+{
+ gboolean need_spell_check;
+
+ need_spell_check = engine->need_spell_check;
+ engine->need_spell_check = FALSE;
+ html_cursor_real_jump_to_position (cursor, engine, position, exact_position);
+ engine->need_spell_check = need_spell_check;
+}
+
+void
+html_cursor_jump_to_position_no_spell (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gint position)
+{
+ html_cursor_real_jump_to_position_no_spell (cursor, engine, position, FALSE);
+}
+
+void
+html_cursor_exactly_jump_to_position_no_spell (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gint position)
+{
+ html_cursor_real_jump_to_position_no_spell (cursor, engine, position, TRUE);
+}
+
/* Comparison. */
@@ -750,7 +865,7 @@ html_cursor_beginning_of_paragraph (HTML
while (1) {
if (!cursor->offset) {
html_cursor_copy (©, cursor);
- if (backward (cursor, engine)) {
+ if (backward (cursor, engine, FALSE)) {
new_level = html_object_get_parent_level (cursor->object);
if (new_level < level
|| (new_level == level && flow != cursor->object->parent)) {
@@ -761,7 +876,7 @@ html_cursor_beginning_of_paragraph (HTML
break;
}
else
- if (!backward (cursor, engine))
+ if (!backward (cursor, engine, FALSE))
break;
rv = TRUE;
}
@@ -788,7 +903,7 @@ html_cursor_end_of_paragraph (HTMLCursor
while (1) {
if (cursor->offset == html_object_get_length (cursor->object)) {
html_cursor_copy (©, cursor);
- if (forward (cursor, engine)) {
+ if (forward (cursor, engine, FALSE)) {
new_level = html_object_get_parent_level (cursor->object);
if (new_level < level
|| (new_level == level && flow != cursor->object->parent)) {
@@ -799,7 +914,7 @@ html_cursor_end_of_paragraph (HTMLCursor
break;
}
else
- if (!forward (cursor, engine))
+ if (!forward (cursor, engine, FALSE))
break;
rv = TRUE;
}
diff -up gtkhtml-3.15.92/src/htmlobject.c.cursor-position gtkhtml-3.15.92/src/htmlobject.c
--- gtkhtml-3.15.92/src/htmlobject.c.cursor-position 2007-09-02 14:55:42.000000000 -0400
+++ gtkhtml-3.15.92/src/htmlobject.c 2007-09-13 11:02:08.000000000 -0400
@@ -820,7 +820,9 @@ html_object_class_init (HTMLObjectClass
klass->get_clear = get_clear;
klass->get_direction = html_object_real_get_direction;
klass->cursor_forward = html_object_real_cursor_forward;
+ klass->cursor_forward_one = html_object_real_cursor_forward;
klass->cursor_backward = html_object_real_cursor_backward;
+ klass->cursor_backward_one = html_object_real_cursor_backward;
klass->cursor_left = html_object_real_cursor_left;
klass->cursor_right = html_object_real_cursor_right;
klass->backspace = html_object_real_backspace;
@@ -1567,12 +1569,24 @@ html_object_cursor_forward (HTMLObject *
}
gboolean
+html_object_cursor_forward_one (HTMLObject *self, HTMLCursor *cursor, HTMLEngine *engine)
+{
+ return (* HO_CLASS (self)->cursor_forward_one) (self, cursor, engine);
+}
+
+gboolean
html_object_cursor_backward (HTMLObject *self, HTMLCursor *cursor, HTMLEngine *engine)
{
return (* HO_CLASS (self)->cursor_backward) (self, cursor, engine);
}
gboolean
+html_object_cursor_backward_one (HTMLObject *self, HTMLCursor *cursor, HTMLEngine *engine)
+{
+ return (* HO_CLASS (self)->cursor_backward_one) (self, cursor, engine);
+}
+
+gboolean
html_object_cursor_right (HTMLObject *self, HTMLPainter *painter, HTMLCursor *cursor)
{
return (* HO_CLASS (self)->cursor_right) (self, painter, cursor);
diff -up gtkhtml-3.15.92/src/htmlobject.h.cursor-position gtkhtml-3.15.92/src/htmlobject.h
--- gtkhtml-3.15.92/src/htmlobject.h.cursor-position 2007-09-02 14:55:42.000000000 -0400
+++ gtkhtml-3.15.92/src/htmlobject.h 2007-09-13 11:02:08.000000000 -0400
@@ -263,7 +263,9 @@ struct _HTMLObjectClass {
HTMLDirection (*get_direction) (HTMLObject *self);
gboolean (*cursor_forward) (HTMLObject *self, HTMLCursor *cursor, HTMLEngine *engine);
- gboolean (*cursor_backward) (HTMLObject *self, HTMLCursor *cursor, HTMLEngine *engine);
+ gboolean (*cursor_forward_one) (HTMLObject *self, HTMLCursor *cursor, HTMLEngine *engine);
+ gboolean (*cursor_backward) (HTMLObject *self, HTMLCursor *cursor, HTMLEngine *engine);
+ gboolean (*cursor_backward_one) (HTMLObject *self, HTMLCursor *cursor, HTMLEngine *engine);
gboolean (*cursor_right) (HTMLObject *self, HTMLPainter *painter, HTMLCursor *cursor);
gboolean (*cursor_left) (HTMLObject *self, HTMLPainter *painter, HTMLCursor *cursor);
@@ -465,9 +467,15 @@ HTMLObject *html_object_check_point
gboolean html_object_cursor_forward (HTMLObject *self,
HTMLCursor *cursor,
HTMLEngine *engine);
+gboolean html_object_cursor_forward_one (HTMLObject *self,
+ HTMLCursor *cursor,
+ HTMLEngine *engine);
gboolean html_object_cursor_backward (HTMLObject *self,
HTMLCursor *cursor,
HTMLEngine *engine);
+gboolean html_object_cursor_backward_one (HTMLObject *self,
+ HTMLCursor *cursor,
+ HTMLEngine *engine);
gboolean html_object_cursor_left (HTMLObject *self,
HTMLPainter *painter,
HTMLCursor *cursor);
diff -up gtkhtml-3.15.92/src/htmlcursor.h.cursor-position gtkhtml-3.15.92/src/htmlcursor.h
--- gtkhtml-3.15.92/src/htmlcursor.h.cursor-position 2007-09-02 14:55:42.000000000 -0400
+++ gtkhtml-3.15.92/src/htmlcursor.h 2007-09-13 11:02:08.000000000 -0400
@@ -90,6 +90,10 @@ gboolean html_cursor_jump_to
HTMLEngine *engine,
HTMLObject *obj,
guint offset);
+gboolean html_cursor_exactly_jump_to (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ HTMLObject *obj,
+ guint offset);
HTMLObject *html_cursor_child_of (HTMLCursor *cursor,
HTMLObject *parent);
@@ -97,13 +101,19 @@ HTMLObject *html_cursor_child_of
void html_cursor_normalize (HTMLCursor *cursor);
/* Position handling. */
-gint html_cursor_get_position (HTMLCursor *cursor);
-void html_cursor_jump_to_position (HTMLCursor *cursor,
- HTMLEngine *engine,
- gint position);
-void html_cursor_jump_to_position_no_spell (HTMLCursor *cursor,
- HTMLEngine *engine,
- gint position);
+gint html_cursor_get_position (HTMLCursor *cursor);
+void html_cursor_jump_to_position (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gint position);
+void html_cursor_exactly_jump_to_position (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gint position);
+void html_cursor_jump_to_position_no_spell (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gint position);
+void html_cursor_exactly_jump_to_position_no_spell (HTMLCursor *cursor,
+ HTMLEngine *engine,
+ gint position);
/* Retrieving the character under/before the cursor. */
gunichar html_cursor_get_current_char (const HTMLCursor *cursor);
Index: gtkhtml3.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gtkhtml3/devel/gtkhtml3.spec,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- gtkhtml3.spec 4 Sep 2007 02:45:19 -0000 1.100
+++ gtkhtml3.spec 13 Sep 2007 16:10:39 -0000 1.101
@@ -9,7 +9,7 @@
Name: gtkhtml3
Version: 3.15.92
-Release: 1%{?dist}
+Release: 2%{?dist}
License: LGPL/GPL
Group: System Environment/Libraries
Summary: gtkhtml library
@@ -29,6 +29,9 @@
# We do not ship gnome-common (or at least we're not supposed to).
Patch4: gtkhtml-3.13.1-no-gnome-common.patch
+# GNOME bug #443850
+Patch5: gtkhtml-3.15.92-cursor-position.patch
+
### Dependencies ###
Requires: gnome-icon-theme >= %{gnome_icon_theme_version}
@@ -63,6 +66,7 @@
%patch1 -p1 -b .crash
%patch3 -p1 -b .im-too-late
%patch4 -p1 -b .no-gnome-common
+%patch5 -p1 -b .cursor-position
%build
@@ -130,6 +134,9 @@
%{_libdir}/pkgconfig/*.pc
%changelog
+* Thu Sep 13 2007 Matthew Barnes <mbarnes at redhat.com> - 3.15.92-2.fc8
+- Add patch for GNOME bug #443850 (fix cursor position after typing halant).
+
* Mon Sep 03 2007 Matthew Barnes <mbarnes at redhat.com> - 3.15.92-1.fc8
- Update to 3.15.92
More information about the fedora-extras-commits
mailing list