[balsa/wip/gtk4: 275/351] Fix the "scroll on click" issue



commit be0726c130ed073c3179175ba6579632d78662b6
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Apr 11 23:32:44 2018 -0400

    Fix the "scroll on click" issue
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=795085
    
    * src/balsa-message.c (balsa_message_init): wrap the
      BalsaMimeWidget::widget in a GtkViewport; if we do not,
      GtkContainer does it for us, but also sets it up to scroll when
      first clicked, which leaves the wrong text under the pointer.

 ChangeLog           |   10 ++++++++++
 src/balsa-message.c |    9 ++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f7155a2..ddcba9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2018-04-11  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       Fix the "scroll on click" issue
+       (https://bugzilla.gnome.org/show_bug.cgi?id=795085)
+
+       * src/balsa-message.c (balsa_message_init): wrap the
+       BalsaMimeWidget::widget in a GtkViewport; if we do not,
+       GtkContainer does it for us, but also sets it up to scroll when
+       first clicked, which leaves the wrong text under the pointer.
+
 2018-03-19  Peter Bloomfield  <pbloomfield bellsouth net>
 
        * libbalsa/imap/imap-commands.c (imap_mbox_handle_fetch_body):
diff --git a/src/balsa-message.c b/src/balsa-message.c
index 0c59bfb..21b6fc1 100644
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@ -664,6 +664,7 @@ balsa_message_init(BalsaMessage * bm)
     GtkStack  *stack;
     GtkWidget *vbox;
     GtkWidget *scroll;
+    GtkWidget *viewport;
     GtkWidget **buttons;
     GtkTreeStore *model;
     GtkGesture *gesture;
@@ -705,7 +706,13 @@ balsa_message_init(BalsaMessage * bm)
     widget = balsa_mime_widget_get_widget(bm->bm_widget);
     g_signal_connect(widget, "notify::has-focus",
                      G_CALLBACK(balsa_mime_widget_check_focus), bm);
-    gtk_container_add(GTK_CONTAINER(bm->scroll), widget);
+
+    /* If we do not add the widget to a viewport, GtkContainer would
+     * provide one, but it would also set it up to scroll on grab-focus,
+     * which has been really annoying for a long time :-( */
+    viewport = gtk_viewport_new(NULL, NULL);
+    gtk_container_add(GTK_CONTAINER(viewport), widget);
+    gtk_container_add(GTK_CONTAINER(bm->scroll), viewport);
 
     /* structure view */
     model = gtk_tree_store_new (NUM_COLUMNS,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]