summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-05-17 16:37:26 +0100
committerMatthias Clasen <mclasen@redhat.com>2018-05-17 16:42:00 +0100
commit84364a7ef4751fa74af0aa34686605dd76ae0a9d (patch)
tree2329be0ccd841c9d85dea8baeba220aa4067fbf4
parentdaca4b9a39b91ed4675aea9134b9041d2e210269 (diff)
downloadgtk+-84364a7ef4751fa74af0aa34686605dd76ae0a9d.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 2783c3b654..14025e3ab1 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -34,6 +34,8 @@
#include "gtkintl.h"
#include "gtkprivate.h"
+#define BOX_SPACE 6
+
typedef struct {
GtkWidget *box;
GtkWidget *heading;
@@ -107,7 +109,7 @@ scroll_to_section (GtkButton *button,
adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (chooser->scrolled_window));
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
@@ -455,7 +457,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;