[gtkhtml/gnome-2-28] 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/gnome-2-28] Bug #494986 - Clicking URL moves view to the top in caret mode
- Date: Mon, 11 Jan 2010 19:08:04 +0000 (UTC)
commit 0a4b8410323ceea70feb11ceb82ed2137da1afa0
Author: Milan Crha <mcrha redhat com>
Date: Mon Jan 11 20:07:33 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 c7ebed5..49c8cb0 100644
--- a/gtkhtml/gtkhtml.c
+++ b/gtkhtml/gtkhtml.c
@@ -1842,9 +1842,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;
@@ -2106,6 +2109,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;
@@ -3460,6 +3468,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 ();
@@ -3644,6 +3653,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]