[gdm] Compute needs-scrollbar logic differently
- From: Ray Strode <halfline src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gdm] Compute needs-scrollbar logic differently
- Date: Fri, 30 Oct 2009 21:02:15 +0000 (UTC)
commit f685f9fe038d891026fce69a47a7ab7c3e438d37
Author: Ray Strode <rstrode redhat com>
Date: Fri Oct 30 16:44:29 2009 -0400
Compute needs-scrollbar logic differently
This way is a little clearer to read and seems to work
around a bug where the scrollbar gets shown briefly at
the end of an animation.
gui/simple-greeter/gdm-scrollable-widget.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-scrollable-widget.c b/gui/simple-greeter/gdm-scrollable-widget.c
index 6d9dc83..d55013d 100644
--- a/gui/simple-greeter/gdm-scrollable-widget.c
+++ b/gui/simple-greeter/gdm-scrollable-widget.c
@@ -252,7 +252,7 @@ gdm_scrollable_widget_animation_stop (GdmScrollableWidgetAnimation *animation)
static gboolean
gdm_scrollable_widget_needs_scrollbar (GdmScrollableWidget *widget)
{
- GtkAdjustment *adjustment;
+ gboolean needs_scrollbar;
if (widget->priv->scrollbar == NULL) {
return FALSE;
@@ -266,9 +266,19 @@ gdm_scrollable_widget_needs_scrollbar (GdmScrollableWidget *widget)
return FALSE;
}
- adjustment = gtk_range_get_adjustment (GTK_RANGE (widget->priv->scrollbar));
+ if (GTK_BIN (widget)->child != NULL) {
+ GtkRequisition child_requisition;
+ int available_height;
+
+ gtk_widget_get_child_requisition (GTK_BIN (widget)->child,
+ &child_requisition);
+ available_height = GTK_WIDGET (widget)->allocation.height;
+ needs_scrollbar = child_requisition.height > available_height;
+ } else {
+ needs_scrollbar = FALSE;
+ }
- return adjustment->upper - adjustment->lower > adjustment->page_size;
+ return needs_scrollbar;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]