[gtk+] Add a missing runtime check



commit 7dd2539e1bdedf313fe60a8ac5c75566ebd1c7b6
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Mar 13 06:01:57 2013 -0400

    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

 tests/testgtk.c |   45 ++++++++++++++++++++++++---------------------
 1 files changed, 24 insertions(+), 21 deletions(-)
---
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 8d9447e..d7d63ff 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]