# HG changeset patch # User nenolod # Date 1140854184 28800 # Node ID 8282b365f6cbe7a2deb0b84a080eca5cfa1375d4 # Parent 07adea9b34ea5b0cd3089f18a1e98af1a1de89f4 [svn] - Add some sanity checking to make sure we can't do X11 stuff when running headless. diff -r 07adea9b34ea -r 8282b365f6cb audacious/controlsocket.c --- a/audacious/controlsocket.c Fri Feb 24 23:44:27 2006 -0800 +++ b/audacious/controlsocket.c Fri Feb 24 23:56:24 2006 -0800 @@ -603,9 +603,12 @@ input_set_volume(v[0], v[1]); break; case CMD_SET_SKIN: - bmp_active_skin_load(data); + if (has_x11_connection == TRUE) + bmp_active_skin_load(data); break; case CMD_PL_WIN_TOGGLE: + if (has_x11_connection != TRUE) + break; tbool = *((gboolean *) data); if (tbool) playlistwin_show(); @@ -613,19 +616,27 @@ playlistwin_hide(); break; case CMD_EQ_WIN_TOGGLE: + if (has_x11_connection != TRUE) + break; tbool = *((gboolean *) data); equalizerwin_show(!!tbool); break; case CMD_SHOW_PREFS_BOX: + if (has_x11_connection != TRUE) + break; show_prefs_window(); break; case CMD_TOGGLE_AOT: + if (has_x11_connection != TRUE) + break; tbool = *((gboolean *) data); mainwin_set_always_on_top(tbool); break; case CMD_SHOW_ABOUT_BOX: break; case CMD_EJECT: + if (has_x11_connection != TRUE) + break; mainwin_eject_pushed(); break; case CMD_PLAYLIST_PREV: @@ -644,6 +655,8 @@ /* FIXME: to be implemented */ break; case CMD_MAIN_WIN_TOGGLE: + if (has_x11_connection != TRUE) + break; tbool = *((gboolean *) data); mainwin_show(!!tbool); break; diff -r 07adea9b34ea -r 8282b365f6cb audacious/main.c --- a/audacious/main.c Fri Feb 24 23:44:27 2006 -0800 +++ b/audacious/main.c Fri Feb 24 23:56:24 2006 -0800 @@ -1,5 +1,5 @@ -/* Audacious - Cross-platform multimedia platform. - * Copyright (C) 2005 Audacious development team. +/* Audacious - Cross-platform multimedia player + * Copyright (C) 2005-2006 Audacious development team. * * Based on BMP: * Copyright (C) 2003-2004 BMP development team. @@ -78,6 +78,7 @@ #include "pixmaps.h" #include "images/audacious_player.xpm" +gboolean has_x11_connection = FALSE; /* do we have an X11 connection? */ /* Translatable string for beep.desktop's comment field */ const gchar *desktop_comment = N_("Audacious"); @@ -918,11 +919,11 @@ /* Check GTK version. Really, this is only needed for binary * distribution since configure already checks. */ - if (!GTK_CHECK_VERSION(2, 4, 0)) { + if (!GTK_CHECK_VERSION(2, 6, 0)) { g_printerr(_("Sorry, your GTK+ version (%d.%d.%d) does not work with Audacious.\n" "Please use GTK+ %s or newer.\n"), gtk_major_version, gtk_minor_version, gtk_micro_version, - "2.4.0"); + "2.6.0"); exit(EXIT_FAILURE); } @@ -942,7 +943,6 @@ /* Now let's parse the command line options first. */ parse_cmd_line(argc, argv, &options); if (!gtk_init_check_ok) { - // if (!gtk_init_check(&argc, &argv)) { if (argc < 2) { /* GTK check failed, and no arguments passed to indicate that user is intending to only remote control a running @@ -1040,6 +1040,8 @@ starting_up = FALSE; + has_x11_connection = TRUE; + gtk_main(); GDK_THREADS_LEAVE(); diff -r 07adea9b34ea -r 8282b365f6cb audacious/main.h --- a/audacious/main.h Fri Feb 24 23:44:27 2006 -0800 +++ b/audacious/main.h Fri Feb 24 23:56:24 2006 -0800 @@ -35,7 +35,6 @@ #define BMP_PLAYLIST_BASENAME "playlist.m3u" #define BMP_LOG_BASENAME "log" - #define PLAYER_HEIGHT \ (cfg.player_shaded ? MAINWIN_SHADED_HEIGHT : MAINWIN_HEIGHT) #define PLAYER_WIDTH MAINWIN_WIDTH @@ -137,6 +136,8 @@ extern gboolean starting_up; +extern gboolean has_x11_connection; + void bmp_config_save(void); void bmp_config_load(void);