From 62b1e83541a0d42315227cd2237d230c4a4195a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Sun, 17 Jul 2022 13:47:16 +0200 Subject: [PATCH] Support horizontal scrolling in the browser An unlikely situation. --- fiv-browser.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fiv-browser.c b/fiv-browser.c index c1c6a48..cd6c3e3 100644 --- a/fiv-browser.c +++ b/fiv-browser.c @@ -193,7 +193,14 @@ relayout(FivBrowser *self, int width) g_array_free(items, TRUE); int total_height = y + padding.bottom; if (self->hadjustment) { - // TODO(p): Set it to the width. Ideally, bump it to the minimum width. + gint minimum_width = 0; + gtk_widget_get_preferred_width(widget, &minimum_width, NULL); + + gtk_adjustment_set_lower(self->hadjustment, 0); + gtk_adjustment_set_upper(self->hadjustment, MAX(width, minimum_width)); + gtk_adjustment_set_step_increment(self->hadjustment, width * 0.1); + gtk_adjustment_set_page_increment(self->hadjustment, width * 0.9); + gtk_adjustment_set_page_size(self->hadjustment, width); } if (self->vadjustment) { gtk_adjustment_set_lower(self->vadjustment, 0);