[gtk+] size-request: Clamp size requests to screen size
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] size-request: Clamp size requests to screen size
- Date: Wed, 15 Dec 2010 10:26:48 +0000 (UTC)
commit 544146b9be4078009c35695b1744431c98a81a40
Author: Benjamin Otte <otte redhat com>
Date: Wed Dec 15 10:33:02 2010 +0100
size-request: Clamp size requests to screen size
Size requests should only ever need to return the screen's width/height
and max. This way, potentially large widgets (tree view or icon view)
don't need to do so many computations, but can stop when their computed
size has reached the screen size.
gtk/gtksizerequest.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index c5e49e7..41ec259 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -239,6 +239,14 @@ compute_size_for_orientation (GtkWidget *widget,
&min_size, &nat_size);
pop_recursion_check (widget, orientation);
}
+#ifndef G_DISABLE_CHECKS
+ if (gtk_widget_get_screen (widget))
+ {
+ guint screen_width = gdk_screen_get_width (gtk_widget_get_screen (widget));
+ min_size = MIN (min_size, screen_width);
+ nat_size = MIN (nat_size, screen_width);
+ }
+#endif
}
else
{
@@ -272,6 +280,14 @@ compute_size_for_orientation (GtkWidget *widget,
&min_size, &nat_size);
pop_recursion_check (widget, orientation);
}
+#ifndef G_DISABLE_CHECKS
+ if (gtk_widget_get_screen (widget))
+ {
+ guint screen_height = gdk_screen_get_height (gtk_widget_get_screen (widget));
+ min_size = MIN (min_size, screen_height);
+ nat_size = MIN (nat_size, screen_height);
+ }
+#endif
}
if (min_size > nat_size)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]