[gtkhtml] Bug #494986 - Clicking URL moves view to the top in caret mode
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtkhtml] Bug #494986 - Clicking URL moves view to the top in caret mode
- Date: Mon, 11 Jan 2010 19:06:36 +0000 (UTC)
commit 198e349a58e78fcbfbda7918ccc43df0cac8b8d9
Author: Milan Crha <mcrha redhat com>
Date: Mon Jan 11 20:04:08 2010 +0100
Bug #494986 - Clicking URL moves view to the top in caret mode
gtkhtml/gtkhtml-private.h | 1 +
gtkhtml/gtkhtml.c | 15 +++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gtkhtml/gtkhtml-private.h b/gtkhtml/gtkhtml-private.h
index 9dd3a23..5e23390 100644
--- a/gtkhtml/gtkhtml-private.h
+++ b/gtkhtml/gtkhtml-private.h
@@ -79,6 +79,7 @@ struct _GtkHTMLPrivate {
gboolean in_key_binding;
gchar *caret_first_focus_anchor;
+ gboolean is_first_focus;
};
void gtk_html_private_calc_scrollbars (GtkHTML *html,
diff --git a/gtkhtml/gtkhtml.c b/gtkhtml/gtkhtml.c
index 759a0e5..8815944 100644
--- a/gtkhtml/gtkhtml.c
+++ b/gtkhtml/gtkhtml.c
@@ -1843,9 +1843,12 @@ button_press_event (GtkWidget *widget,
html = GTK_HTML (widget);
engine = html->engine;
- if (event->button == 1 || ((event->button == 2 || event->button == 3)
- && html_engine_get_editable (engine)))
+ if (event->button == 1 || ((event->button == 2 || event->button == 3) && html_engine_get_editable (engine))) {
+ html->priv->is_first_focus = FALSE;
+ html->priv->skip_update_cursor = TRUE;
+ html->priv->cursor_moved = FALSE;
gtk_widget_grab_focus (widget);
+ }
if (event->type == GDK_BUTTON_PRESS) {
GtkAdjustment *adjustment;
@@ -2107,6 +2110,11 @@ goto_caret_anchor (GtkHTML *html)
g_return_val_if_fail (html != NULL, FALSE);
g_return_val_if_fail (GTK_IS_HTML (html), FALSE);
+ if (!html->priv->is_first_focus)
+ return FALSE;
+
+ html->priv->is_first_focus = FALSE;
+
if (html->priv->caret_first_focus_anchor && html_object_find_anchor (html->engine->clue, html->priv->caret_first_focus_anchor, &x, &y)) {
GtkAdjustment *adjustment;
GtkLayout *layout;
@@ -3435,6 +3443,7 @@ gtk_html_init (GtkHTML* html)
html->priv->in_key_binding = FALSE;
html->priv->caret_first_focus_anchor = NULL;
+ html->priv->is_first_focus = TRUE;
/* IM Context */
html->priv->im_context = gtk_im_multicontext_new ();
@@ -3617,6 +3626,8 @@ gtk_html_begin_full (GtkHTML *html,
else
html->engine->keep_scroll = FALSE;
+ html->priv->is_first_focus = TRUE;
+
handle = html_engine_begin (html->engine, content_type);
if (handle == NULL)
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]