From 5d5b22afd449b08290d69d2e3062a23563a4ac97 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Mon, 10 Feb 2014 21:32:43 -0800 Subject: [PATCH] Mixer: Avoid operations that would attempt to open the X display when running in noui mode. Closes #104 --- mixer/src/JACK_Module.C | 7 +++++++ mixer/src/Spatialization_Console.C | 10 +++++++++- mixer/src/main.C | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mixer/src/JACK_Module.C b/mixer/src/JACK_Module.C index 59561a9..756fd67 100644 --- a/mixer/src/JACK_Module.C +++ b/mixer/src/JACK_Module.C @@ -292,6 +292,13 @@ get_connections_for_ports ( std::vector ports ) void JACK_Module::update_connection_status ( void ) { + /* do nothing when running in noui mode, as ->add will call some + * font measurement stuff which attempts to open the X display. */ + if ( ! fl_display ) + { + return; + } + std::list output_names = get_connections_for_ports( aux_audio_output ); std::list input_names = get_connections_for_ports( aux_audio_input ); diff --git a/mixer/src/Spatialization_Console.C b/mixer/src/Spatialization_Console.C index 8c13a17..e82527a 100644 --- a/mixer/src/Spatialization_Console.C +++ b/mixer/src/Spatialization_Console.C @@ -45,11 +45,14 @@ Spatialization_Console::Spatialization_Console ( void ) : Fl_Double_Window( 850, label( "Spatialization Console" ); - fl_font( FL_HELVETICA, 14 ); + labelfont( FL_HELVETICA ); + labelsize( 14 ); int padding = 48; int S = 802; + if ( fl_display ) + /* don't open the display in noui mode... */ { int sx, sy, sw, sh; @@ -108,7 +111,12 @@ Spatialization_Console::set ( Log_Entry &e ) else if ( ! ( strcmp( s, ":shown" ) ) ) { if ( atoi( v ) ) + { + if ( fl_display ) + { show(); + } + } else hide(); } diff --git a/mixer/src/main.C b/mixer/src/main.C index 902e112..5471ca6 100644 --- a/mixer/src/main.C +++ b/mixer/src/main.C @@ -131,6 +131,8 @@ main ( int argc, char **argv ) { bool no_ui = false; + fl_display = 0; + printf( "%s %s %s -- %s\n", APP_TITLE, VERSION, "", COPYRIGHT ); Thread::init();