diff --git a/doc/Developer Guide.md b/doc/Developer Guide.md index ad6af79b1ea..baecd0af95b 100644 --- a/doc/Developer Guide.md +++ b/doc/Developer Guide.md @@ -210,8 +210,8 @@ sudo apt-get install ajmidid The run jac and ajmidid in separate terminals ``` -jack -d alsa -X alsa_midi -ajmidid -e +jackd -d alsa -X alsa_midi +a2jmidid -e ``` Now start surge with carla-single diff --git a/src/common/gui/PopupEditorDialog.cpp b/src/common/gui/PopupEditorDialog.cpp index 89f9cac94ad..c4172e27aab 100644 --- a/src/common/gui/PopupEditorDialog.cpp +++ b/src/common/gui/PopupEditorDialog.cpp @@ -147,11 +147,27 @@ void spawn_miniedit_text(char* c, int maxchars) #elif LINUX #include "UserInteractions.h" +#include void spawn_miniedit_text(char* c, int maxchars) { // FIXME: Implement text edit popup on Linux. - Surge::UserInteractions::promptError( "miniedit_text is not implemented on linux", "Unimplemented Feature" ); + char cmd[1024]; + snprintf(cmd, 1024, "zenity --entry --entry-text \"%s\"", c ); + FILE *z = popen( cmd, "r" ); + if( ! z ) + { + return; + } + char buffer[ 1024 ]; + if (!fscanf(z, "%1024s", buffer)) + { + return; + } + pclose(z); + + strncpy( c, buffer, maxchars); + } #endif diff --git a/src/linux/UserInteractionsLinux.cpp b/src/linux/UserInteractionsLinux.cpp index 5fb8c0819b6..4097eafb966 100644 --- a/src/linux/UserInteractionsLinux.cpp +++ b/src/linux/UserInteractionsLinux.cpp @@ -3,7 +3,18 @@ #include #include #include +#include +/* +** In June 2019, @baconpaul chose to implement these with an attempt +** to fork/exec a zenity. (He also did this for mini edit). This is not +** ideal. Properly you would somehow asynchronously interact with +** vstgui and so on, which @jjs started. But we kinda gotta do something. +** +** If you want to come along and rip out these zenity calls and replace them +** with vstgui, please do so! This is purely tactical stuff to get us +** not silently failing. +*/ namespace Surge { @@ -13,6 +24,17 @@ namespace UserInteractions void promptError(const std::string &message, const std::string &title, SurgeGUIEditor *guiEditor) { + if (vfork()==0) + { + if (execlp("zenity", "zenity", + "--error", + "--text", message.c_str(), + "--title", title.c_str(), + (char*)nullptr) < 0) + { + exit(0); + } + } std::cerr << "Surge Error\n" << title << "\n" << message << "\n" << std::flush; @@ -55,8 +77,22 @@ void promptFileOpenDialog(const std::string& initialDirectory, std::function callbackOnOpen, SurgeGUIEditor* guiEditor) { - UserInteractions::promptError("OpenFileDialog is unimplemented in this version of Surge. Sorry!", - "Unimplemented Function", guiEditor); + /* + ** This is a blocking model which will cause us problems I am sure + */ + FILE *z = popen( "zenity --file-selection", "r" ); + if( ! z ) + { + return; + } + char buffer[ 1024 ]; + if (!fscanf(z, "%1024s", buffer)) + { + return; + } + pclose(z); + + callbackOnOpen(buffer); } };