[sysprof/wip/visualizers] visualizer-view: avoid overscroll upon zoom change
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/visualizers] visualizer-view: avoid overscroll upon zoom change
- Date: Sat, 1 Oct 2016 00:05:50 +0000 (UTC)
commit 5c53dd5d6e61db735c471ff81654a5302c33825e
Author: Christian Hergert <chergert redhat com>
Date: Fri Sep 30 17:04:48 2016 -0700
visualizer-view: avoid overscroll upon zoom change
When changing the zoom (zooming out), we could potentially
let the scrollbar be past the end. This looks pretty bad when
the GtkWindow doesn't clip correctly.
This just adjusts things so we push ourselves back into the
visible area.
lib/sp-visualizer-view.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/lib/sp-visualizer-view.c b/lib/sp-visualizer-view.c
index b0b9565..4be1efe 100644
--- a/lib/sp-visualizer-view.c
+++ b/lib/sp-visualizer-view.c
@@ -130,6 +130,9 @@ sp_visualizer_view_notify_zoom (SpVisualizerView *self,
gint64 begin_time = 0.0;
gint64 end_time;
gdouble zoom;
+ gdouble page_size;
+ gdouble upper;
+ gdouble value;
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SP_IS_ZOOM_MANAGER (zoom_manager));
@@ -144,6 +147,15 @@ sp_visualizer_view_notify_zoom (SpVisualizerView *self,
sp_visualizer_view_set_time_range (self, begin_time, end_time);
gtk_adjustment_set_page_size (priv->scroll_adjustment, end_time - begin_time);
+ g_object_get (priv->scroll_adjustment,
+ "page-size", &page_size,
+ "upper", &upper,
+ "value", &value,
+ NULL);
+
+ if (value + page_size > upper)
+ gtk_adjustment_set_value (priv->scroll_adjustment, upper - page_size);
+
if (priv->reader != NULL)
{
gint64 real_range;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]