testgtk: Respect display cursor size limitations
authorMatthias Clasen <mclasen@redhat.com>
Tue, 7 Apr 2015 22:39:10 +0000 (18:39 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 7 Apr 2015 22:40:21 +0000 (18:40 -0400)
Instead of hardcoding 64, ask the display about the
maximal supported cursor size.

tests/testgtk.c

index b9458e0477653b4c2694409f44c448861a7621bb..90df1cfbf7dc5eb68a804489d420bb144723a111 100644 (file)
@@ -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);