summaryrefslogtreecommitdiff
path: root/tests/testgtk.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-04-07 18:39:10 -0400
committerMatthias Clasen <mclasen@redhat.com>2015-04-07 18:40:21 -0400
commit65b7fc91bd60ee74b5b947326f0a39b6bae807de (patch)
treec41e0151ec0b8d6efb646386d5fa1fdb9d76d681 /tests/testgtk.c
parent61f3399f980288a9a9e4b03b50dd147a8af55a8d (diff)
downloadgtk+-65b7fc91bd60ee74b5b947326f0a39b6bae807de.tar.gz
testgtk: Respect display cursor size limitations
Instead of hardcoding 64, ask the display about the maximal supported cursor size.
Diffstat (limited to 'tests/testgtk.c')
-rw-r--r--tests/testgtk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c
index b9458e0477..90df1cfbf7 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -5103,6 +5103,8 @@ create_cursors (GtkWidget *widget)
if (cursor_demo)
{
+ guint w, h;
+
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
@@ -5116,7 +5118,8 @@ create_cursors (GtkWidget *widget)
gtk_entry_set_text (GTK_ENTRY (entry), "default");
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, TRUE, 0);
- size = gtk_spin_button_new_with_range (1.0, 64.0, 1.0);
+ gdk_display_get_maximal_cursor_size (gtk_widget_get_display (vbox), &w, &h);
+ size = gtk_spin_button_new_with_range (1.0, MIN (w, h), 1.0);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (size), 24.0);
gtk_box_pack_start (GTK_BOX (hbox), size, TRUE, TRUE, 0);