From 26c7ef4cd9c3c0bfa980f71ce45b949e009cdb5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20G=2E=20Aragoneses?= Date: Fri, 30 Aug 2013 22:00:47 +0200 Subject: [PATCH] sample: fix CustomScrollable sample to prevent too high Upper values Upper values having higher values than PageSize or PageIncrement cause rendering issues. This commit is a small adaptation of a fix from one of the edge cases pointed out in this commit in hyena: https://git.gnome.org/browse/hyena/commit/?h=gtk3&id=0745bfb75809886925dfa49a57c79e5f71565d08 --- sample/CustomScrollableWidget.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sample/CustomScrollableWidget.cs b/sample/CustomScrollableWidget.cs index 2535c9286..a06e03c18 100644 --- a/sample/CustomScrollableWidget.cs +++ b/sample/CustomScrollableWidget.cs @@ -184,6 +184,9 @@ class CustomScrollableWidget : CustomBase, IScrollableImplementor { if (hadjustment.Value + hadjustment.PageSize > hadjustment.Upper) { hadjustment.Value = hadjustment.Upper - hadjustment.PageSize; } + if (hadjustment.Upper > 0 && hadjustment.Upper < hadjustment.PageSize) { + hadjustment.Upper = hadjustment.PageSize; + } hadjustment.Change (); } @@ -193,6 +196,9 @@ class CustomScrollableWidget : CustomBase, IScrollableImplementor { if (vadjustment.Value + vadjustment.PageSize > vadjustment.Upper) { vadjustment.Value = vadjustment.Upper - vadjustment.PageSize; } + if (vadjustment.Upper > 0 && vadjustment.Upper < vadjustment.PageSize) { + vadjustment.Upper = vadjustment.PageSize; + } vadjustment.Change (); } }