summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-03-13 06:01:57 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-03-13 06:04:58 -0400
commit7dd2539e1bdedf313fe60a8ac5c75566ebd1c7b6 (patch)
tree5583fbf744c6ee22159a6c6bdaaf682d689068ef
parent36d2324891d330d54156558e1405c9a0d7426157 (diff)
downloadgtk+-7dd2539e1bdedf313fe60a8ac5c75566ebd1c7b6.tar.gz
Add a missing runtime check
The cursor theme and size settting code was ifdefed to only be compiled with the X11 backend, but it didn't check for running under X at runtime. Fix that. http://bugzilla.gnome.org/695495
-rw-r--r--tests/testgtk.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 8d9447ec85..d7d63ff530 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -4801,27 +4801,30 @@ create_cursors (GtkWidget *widget)
NULL);
#ifdef GDK_WINDOWING_X11
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
-
- label = gtk_label_new ("Cursor Theme : ");
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
-
- entry = gtk_entry_new ();
- 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);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (size), 24.0);
- gtk_box_pack_start (GTK_BOX (hbox), size, TRUE, TRUE, 0);
-
- g_signal_connect (entry, "changed",
- G_CALLBACK (change_cursor_theme), hbox);
- g_signal_connect (size, "changed",
- G_CALLBACK (change_cursor_theme), hbox);
+ if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (vbox)))
+ {
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
+
+ label = gtk_label_new ("Cursor Theme : ");
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+
+ entry = gtk_entry_new ();
+ 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);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (size), 24.0);
+ gtk_box_pack_start (GTK_BOX (hbox), size, TRUE, TRUE, 0);
+
+ g_signal_connect (entry, "changed",
+ G_CALLBACK (change_cursor_theme), hbox);
+ g_signal_connect (size, "changed",
+ G_CALLBACK (change_cursor_theme), hbox);
+ }
#endif
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);