summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-05-17 16:37:26 +0100
committerMatthias Clasen <mclasen@redhat.com>2018-06-03 09:43:28 -0400
commita628e03042a980a2d946e638b67d308a0762943d (patch)
tree6704919026b3eb258f424e8b0d1b0cb02c79a9e9
parentf1d9ccd6c77b8883319ffb6b410346832c4b4d59 (diff)
downloadgtk+-a628e03042a980a2d946e638b67d308a0762943d.tar.gz
emoji: Improve section scrolling
Leave some space above the section heading when scrolling. This is a part of https://gitlab.gnome.org/GNOME/gtk/merge_requests/143 by Julian Sperber.
-rw-r--r--gtk/gtkemojichooser.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index 9697dad4b6..b2e5b15d0f 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -35,6 +35,8 @@
#include "gtkintl.h"
#include "gtkprivate.h"
+#define BOX_SPACE 6
+
typedef struct {
GtkWidget *box;
GtkWidget *heading;
@@ -124,7 +126,7 @@ scroll_to_section (GtkButton *button,
if (section->heading)
gtk_widget_get_allocation (section->heading, &alloc);
- gtk_adjustment_animate_to_value (adj, alloc.y);
+ gtk_adjustment_animate_to_value (adj, alloc.y - BOX_SPACE);
}
static void
@@ -493,7 +495,7 @@ adj_value_changed (GtkAdjustment *adj,
else
gtk_widget_get_allocation (section->box, &alloc);
- if (value < alloc.y)
+ if (value < alloc.y - BOX_SPACE)
break;
select_section = section;