[gtk+/gtk-2-18] Don't scroll to insert after middle-click paste
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-18] Don't scroll to insert after middle-click paste
- Date: Fri, 12 Mar 2010 23:03:32 +0000 (UTC)
commit 68b278bf34da81f418199a6e1e828836bcc2bbe9
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Mar 8 11:25:26 2010 -0500
Don't scroll to insert after middle-click paste
Patch by Ignacio Casal Quinteiro, bug 612119.
(cherry picked from commit d84a83142329c725eaad3492d9f1eb62415f9d24)
gtk/gtktextview.c | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 3c0958a..a401323 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -109,6 +109,7 @@ struct _GtkTextViewPrivate
guint blink_time; /* time in msec the cursor has blinked since last user event */
guint im_spot_idle;
gchar *im_module;
+ guint scroll_after_paste : 1;
};
@@ -1265,6 +1266,9 @@ gtk_text_view_init (GtkTextView *text_view)
{
GtkWidget *widget = GTK_WIDGET (text_view);
GtkTargetList *target_list;
+ GtkTextViewPrivate *priv;
+
+ priv = GTK_TEXT_VIEW_GET_PRIVATE (text_view);
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
@@ -1280,6 +1284,8 @@ gtk_text_view_init (GtkTextView *text_view)
text_view->tabs = NULL;
text_view->editable = TRUE;
+ priv->scroll_after_paste = TRUE;
+
gtk_drag_dest_set (widget, 0, NULL, 0,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
@@ -4348,6 +4354,12 @@ gtk_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
else if (event->button == 2)
{
GtkTextIter iter;
+ GtkTextViewPrivate *priv;
+
+ /* We do not want to scroll back to the insert iter when we paste
+ with the middle button */
+ priv = GTK_TEXT_VIEW_GET_PRIVATE (text_view);
+ priv->scroll_after_paste = FALSE;
gtk_text_layout_get_iter_at_pixel (text_view->layout,
&iter,
@@ -5781,8 +5793,17 @@ gtk_text_view_paste_done_handler (GtkTextBuffer *buffer,
gpointer data)
{
GtkTextView *text_view = data;
- DV(g_print (G_STRLOC": scrolling onscreen\n"));
- gtk_text_view_scroll_mark_onscreen (text_view, gtk_text_buffer_get_insert (buffer));
+ GtkTextViewPrivate *priv;
+
+ priv = GTK_TEXT_VIEW_GET_PRIVATE (text_view);
+
+ if (priv->scroll_after_paste)
+ {
+ DV(g_print (G_STRLOC": scrolling onscreen\n"));
+ gtk_text_view_scroll_mark_onscreen (text_view, gtk_text_buffer_get_insert (buffer));
+ }
+
+ priv->scroll_after_paste = TRUE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]