diff --git a/resources/ui/carla_add_jack.ui b/resources/ui/carla_add_jack.ui index 9a92104b4..6cff5942c 100644 --- a/resources/ui/carla_add_jack.ui +++ b/resources/ui/carla_add_jack.ui @@ -6,8 +6,8 @@ 0 0 - 418 - 278 + 416 + 344 @@ -24,7 +24,7 @@ - Command + Application @@ -40,19 +40,6 @@ - - - - false - - - Session Manager: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -82,35 +69,6 @@ - - - - Take control of main applicaton window - - - - - - - false - - - - None / Manual - - - - - LADISH (SIGUSR1) - - - - - Non Session Manager (OSC) - - - - @@ -136,8 +94,49 @@ Setup - - + + + + MIDI inputs: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 1 + + + + + + + 64 + + + + + + + MIDI outputs: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 1 + + + + + Qt::Horizontal @@ -149,7 +148,7 @@ - + Qt::Horizontal @@ -162,7 +161,7 @@ - + Qt::Horizontal @@ -175,20 +174,23 @@ - + Qt::Horizontal + + QSizePolicy::Fixed + - 1 + 20 1 - + Qt::Horizontal @@ -201,7 +203,7 @@ - + Audio inputs: @@ -211,14 +213,27 @@ - + + + + Qt::Horizontal + + + + 1 + 1 + + + + + 64 - + 0 @@ -231,24 +246,23 @@ - - - - MIDI inputs: + + + + Qt::Horizontal - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + QSizePolicy::Fixed - - - - - - 1 + + + 20 + 1 + - + - + Audio outputs: @@ -258,68 +272,108 @@ - - - - 64 + + + + Qt::Horizontal - + + + 1 + 1 + + + - - + + - MIDI outputs: + Take control of main applicaton window - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + false + + + None / Manual + + + + + LADISH (SIGUSR1) + + + + + Non Session Manager (OSC) + + - - - - 1 + + + + false + + + Session Manager: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + + + + + Workarounds + + + + Qt::Horizontal + + QSizePolicy::Fixed + - 1 + 20 1 - - + + Qt::Horizontal - 1 + 135 1 - - - - Qt::Horizontal + + + + false - - - 1 - 1 - + + Capture only the first X11 Window - + diff --git a/source/backend/plugin/CarlaPluginJack.cpp b/source/backend/plugin/CarlaPluginJack.cpp index 1edff90c3..d1ca982a8 100644 --- a/source/backend/plugin/CarlaPluginJack.cpp +++ b/source/backend/plugin/CarlaPluginJack.cpp @@ -1208,7 +1208,7 @@ public: // --------------------------------------------------------------- // check setup - if (std::strlen(label) != 5) + if (std::strlen(label) != 6) { pData->engine->setLastError("invalid application setup received"); return false; @@ -1217,7 +1217,9 @@ public: for (int i=4; --i >= 0;) { CARLA_SAFE_ASSERT_RETURN(label[i] >= '0' && label[i] <= '0'+64, false); } - CARLA_SAFE_ASSERT_RETURN(label[4] >= '0' && label[4] < '0'+0x4f, false); + for (int i=6; --i >= 4;) { + CARLA_SAFE_ASSERT_RETURN(label[i] >= '0' && label[i] < '0'+0x4f, false); + } fInfo.aIns = label[0] - '0'; fInfo.aOuts = label[1] - '0'; @@ -1226,7 +1228,7 @@ public: fInfo.setupLabel = label; - const int setupHints = label[4] - '0'; + const int setupHints = label[5] - '0'; // --------------------------------------------------------------- // set info @@ -1283,7 +1285,7 @@ public: #endif //fInfo.optionsAvailable = optionAv; - if (setupHints & 0x10) + if (setupHints & 0x1) pData->hints |= PLUGIN_HAS_CUSTOM_UI; // --------------------------------------------------------------- diff --git a/source/carla_database.py b/source/carla_database.py index bec1865f5..c8f007efb 100755 --- a/source/carla_database.py +++ b/source/carla_database.py @@ -1884,12 +1884,14 @@ class PluginDatabaseW(QDialog): # Jack Application Dialog class JackApplicationW(QDialog): - # TODO complete this - FLAG_SESSION_MGR_JACK = 0x01 - FLAG_SESSION_MGR_LADISH = 0x02 - FLAG_SESSION_MGR_LASH = 0x04 - FLAG_SESSION_MGR_NSM = 0x08 - FLAG_CONTROL_WINDOW = 0x10 + SESSION_MGR_NONE = 0 + SESSION_MGR_JACK = 1 + SESSION_MGR_LADISH = 2 + SESSION_MGR_LASH = 3 + SESSION_MGR_NSM = 4 + + FLAG_CONTROL_WINDOW = 0x1 + FLAG_CAPTURE_FIRST_WINDOW = 0x2 def __init__(self, parent, host): QDialog.__init__(self, parent) @@ -1917,25 +1919,30 @@ class JackApplicationW(QDialog): def getCommandAndFlags(self): name = self.ui.le_name.text() command = self.ui.le_command.text() + smgr = self.SESSION_MGR_NONE flags = 0x0 if not name: name = command.split(" ",1)[0] # TODO finalize flag definitions - sessionMgrIndex = self.ui.cb_session_mgr.currentIndex() - if sessionMgrIndex == 1: - flags |= self.FLAG_SESSION_MGR_LADISH - elif sessionMgrIndex == 2: - flags |= self.FLAG_SESSION_MGR_NSM + #uiSessionMgrIndex = self.ui.cb_session_mgr.currentIndex() + #if uiSessionMgrIndex == 1: + #smgr = self.SESSION_MGR_LADISH + #elif uiSessionMgrIndex == 2: + #smgr = self.SESSION_MGR_NSM + if self.ui.cb_manage_window.isChecked(): flags |= self.FLAG_CONTROL_WINDOW + if self.ui.cb_capture_first_window.isChecked(): + flags |= self.FLAG_CAPTURE_FIRST_WINDOW baseIntVal = ord('0') - labelSetup = "%s%s%s%s%s" % (chr(baseIntVal+self.ui.sb_audio_ins.value()), - chr(baseIntVal+self.ui.sb_audio_outs.value()), - chr(baseIntVal+self.ui.sb_midi_ins.value()), - chr(baseIntVal+self.ui.sb_midi_outs.value()), - chr(baseIntVal+flags)) + labelSetup = "%s%s%s%s%s%s" % (chr(baseIntVal+self.ui.sb_audio_ins.value()), + chr(baseIntVal+self.ui.sb_audio_outs.value()), + chr(baseIntVal+self.ui.sb_midi_ins.value()), + chr(baseIntVal+self.ui.sb_midi_outs.value()), + chr(baseIntVal+smgr), + chr(baseIntVal+flags)) return (command, name, labelSetup) def loadSettings(self): diff --git a/source/interposer/interposer-jack-x11.cpp b/source/interposer/interposer-jack-x11.cpp index 3a7e3763a..c38f5df43 100644 --- a/source/interposer/interposer-jack-x11.cpp +++ b/source/interposer/interposer-jack-x11.cpp @@ -61,6 +61,8 @@ typedef int (*CarlaInterposedCallback)(int, void*); static Display* gCurrentlyMappedDisplay = nullptr; static Window gCurrentlyMappedWindow = 0; static CarlaInterposedCallback gInterposedCallback = nullptr; +static int gInterposedSessionManager = 0; +static int gInterposedHints = 0; static bool gCurrentWindowMapped = false; static bool gCurrentWindowVisible = false; @@ -161,7 +163,7 @@ int XMapWindow(Display* display, Window window) // got a new window, we may need to forget last one if (gCurrentlyMappedDisplay != nullptr && gCurrentlyMappedWindow != 0) { - // igonre requests against the current mapped window + // ignore requests against the current mapped window if (gCurrentlyMappedWindow == window) return 0; @@ -171,6 +173,7 @@ int XMapWindow(Display* display, Window window) XSetTransientForHint(display, window, gCurrentlyMappedWindow); break; } + // ignore empty windows created after the main one if (numItems == 0) break; @@ -220,31 +223,45 @@ int XUnmapWindow(Display* display, Window window) // --------------------------------------------------------------------------------------------------------------------- CARLA_EXPORT -int jack_carla_interposed_action(int action, void* ptr) +int jack_carla_interposed_action(int action, int value, void* ptr) { - carla_debug("jack_carla_interposed_action(%i, %p)", action, ptr); + carla_debug("jack_carla_interposed_action(%i, %i, %p)", action, value, ptr); switch (action) { - case 1: // set callback + case 1: + // set hints and callback + gInterposedHints = value; gInterposedCallback = (CarlaInterposedCallback)ptr; return 1; - case 2: // show gui - gCurrentWindowVisible = true; - if (gCurrentlyMappedDisplay == nullptr || gCurrentlyMappedWindow == 0) - return 0; + case 2: + // session manager + gInterposedSessionManager = value; + return 1; - gCurrentWindowMapped = true; - return real_XMapWindow(gCurrentlyMappedDisplay, gCurrentlyMappedWindow); + case 3: + // show gui + if (value != 0) + { + gCurrentWindowVisible = true; + if (gCurrentlyMappedDisplay == nullptr || gCurrentlyMappedWindow == 0) + return 0; - case 3: // hide gui - gCurrentWindowVisible = false; - if (gCurrentlyMappedDisplay == nullptr || gCurrentlyMappedWindow == 0) - return 0; + gCurrentWindowMapped = true; + return real_XMapWindow(gCurrentlyMappedDisplay, gCurrentlyMappedWindow); + } + // hide gui + else + { + gCurrentWindowVisible = false; + if (gCurrentlyMappedDisplay == nullptr || gCurrentlyMappedWindow == 0) + return 0; - gCurrentWindowMapped = false; - return real_XUnmapWindow(gCurrentlyMappedDisplay, gCurrentlyMappedWindow); + gCurrentWindowMapped = false; + return real_XUnmapWindow(gCurrentlyMappedDisplay, gCurrentlyMappedWindow); + } + break; case 4: // close everything gCurrentWindowMapped = false; diff --git a/source/libjack/libjack.cpp b/source/libjack/libjack.cpp index 2e3427ec4..cf65ff641 100644 --- a/source/libjack/libjack.cpp +++ b/source/libjack/libjack.cpp @@ -27,7 +27,7 @@ using juce::Time; typedef int (*CarlaInterposedCallback)(int, void*); CARLA_EXPORT -int jack_carla_interposed_action(int, void*) +int jack_carla_interposed_action(int, int, void*) { carla_stderr2("Non-export jack_carla_interposed_action called, this should not happen!!"); return 1337; @@ -115,7 +115,7 @@ public: CARLA_SAFE_ASSERT_RETURN(shmIds != nullptr && std::strlen(shmIds) == 6*4,); const char* const libjackSetup(std::getenv("CARLA_LIBJACK_SETUP")); - CARLA_SAFE_ASSERT_RETURN(libjackSetup != nullptr && std::strlen(libjackSetup) == 5,); + CARLA_SAFE_ASSERT_RETURN(libjackSetup != nullptr && std::strlen(libjackSetup) == 6,); // make sure we don't get loaded again carla_unsetenv("CARLA_SHM_IDS"); @@ -126,7 +126,9 @@ public: for (int i=4; --i >= 0;) { CARLA_SAFE_ASSERT_RETURN(libjackSetup[i] >= '0' && libjackSetup[i] <= '0'+64,); } - CARLA_SAFE_ASSERT_RETURN(libjackSetup[4] >= '0' && libjackSetup[4] < '0'+0x4f,); + for (int i=6; --i >= 4;) { + CARLA_SAFE_ASSERT_RETURN(libjackSetup[i] >= '0' && libjackSetup[i] < '0'+0x4f,); + } std::memcpy(fBaseNameAudioPool, shmIds+6*0, 6); std::memcpy(fBaseNameRtClientControl, shmIds+6*1, 6); @@ -143,7 +145,8 @@ public: fServer.numMidiIns = libjackSetup[2] - '0'; fServer.numMidiOuts = libjackSetup[3] - '0'; - jack_carla_interposed_action(1, (void*)carla_interposed_callback); + jack_carla_interposed_action(1, libjackSetup[5] - '0', (void*)carla_interposed_callback); + jack_carla_interposed_action(2, libjackSetup[4] - '0', nullptr); fNonRealtimeThread.startThread(); } @@ -843,7 +846,7 @@ bool CarlaJackAppClient::handleNonRtData() break; case kPluginBridgeNonRtClientShowUI: - if (jack_carla_interposed_action(2, nullptr) == 1337) + if (jack_carla_interposed_action(3, 1, nullptr) == 1337) { // failed, LD_PRELOAD did not work? const char* const message("Cannot show UI, LD_PRELOAD not working?"); @@ -862,7 +865,7 @@ bool CarlaJackAppClient::handleNonRtData() break; case kPluginBridgeNonRtClientHideUI: - jack_carla_interposed_action(3, nullptr); + jack_carla_interposed_action(3, 0, nullptr); break; case kPluginBridgeNonRtClientUiParameterChange: