diff --git a/configure.ac b/configure.ac index dcc35c9..2fa669c 100644 --- a/configure.ac +++ b/configure.ac @@ -92,7 +92,7 @@ dnl We need libX11 dnl AC_DEFUN([AC_X11_REQUIREMENTS], [ - AC_CHECK_LIB(X11, XOpenDisplay) + AC_CHECK_LIB(X11, XInitThreads) X11_LIBS='-lX11' AC_SUBST(X11_LIBS) ]) diff --git a/src/gtkinterface.cc b/src/gtkinterface.cc index 6e53a2f..97eb66e 100644 --- a/src/gtkinterface.cc +++ b/src/gtkinterface.cc @@ -84,17 +84,6 @@ window_state_event_cb (GtkWidget *widget, return gtk_interface->handle_window_state_event (ws_event); } -bool -GtkInterface::have_x11_display() -{ - static Display *display = NULL; - - if (!display) - display = XOpenDisplay (NULL); // this should work if and only if we do have an X11 server we can use - - return display != NULL; -} - GtkInterface::GtkInterface() : window_xid (0), video_width (0), @@ -110,9 +99,9 @@ GtkInterface::init (int *argc, char ***argv, KeyHandler *handler) { key_handler = handler; - if (have_x11_display()) + gdk_set_allowed_backends ("x11"); + if (gtk_init_check (argc, argv)) { - gtk_init (argc, argv); gtk_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_icon_name (GTK_WINDOW (gtk_window), "multimedia-player"); g_signal_connect (G_OBJECT (gtk_window), "key-press-event", G_CALLBACK (key_press_event_cb), this); diff --git a/src/gtkinterface.h b/src/gtkinterface.h index abdafe1..8f40b29 100644 --- a/src/gtkinterface.h +++ b/src/gtkinterface.h @@ -70,8 +70,6 @@ class GtkInterface void normal_size(); void set_opacity (double alpha_change); void set_title (const std::string& title); - - static bool have_x11_display(); }; #endif diff --git a/src/options.cc b/src/options.cc index 3be7dd0..afb3fd3 100644 --- a/src/options.cc +++ b/src/options.cc @@ -106,7 +106,8 @@ Options::parse (int argc, char **argv) g_option_context_add_main_entries (context, all_options, NULL); g_option_context_add_group (context, gst_init_get_option_group()); - if (GtkInterface::have_x11_display()) + gdk_set_allowed_backends("x11"); + if (gtk_init_check (&argc, &argv)) g_option_context_add_group (context, gtk_get_option_group (TRUE)); GError *error = NULL;