Browse Source

Manage visibility state for NSM, starts hidden

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
a1501e46bf
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
6 changed files with 37 additions and 14 deletions
  1. +6
    -4
      source/backend/CarlaStandaloneNSM.cpp
  2. +1
    -1
      source/frontend/carla
  3. +1
    -1
      source/frontend/carla-jack-multi
  4. +1
    -1
      source/frontend/carla-jack-single
  5. +1
    -1
      source/frontend/carla-patchbay
  6. +27
    -6
      source/frontend/carla_host.py

+ 6
- 4
source/backend/CarlaStandaloneNSM.cpp View File

@@ -232,11 +232,12 @@ protected:
fHasOptionalGui = std::strstr(features, ":optional-gui:") != nullptr; fHasOptionalGui = std::strstr(features, ":optional-gui:") != nullptr;
fHasServerControl = std::strstr(features, ":server_control:") != nullptr; fHasServerControl = std::strstr(features, ":server_control:") != nullptr;


#if 0
// UI starts visible
// UI starts hidden
if (fHasOptionalGui) if (fHasOptionalGui)
lo_send_from(fReplyAddress, fServer, LO_TT_IMMEDIATE, "/nsm/client/gui_is_shown", "");
#endif
{
// NOTE: lo_send_from is a macro that creates local variables
lo_send_from(fReplyAddress, fServer, LO_TT_IMMEDIATE, "/nsm/client/gui_is_hidden", "");
}


carla_stdout("Carla started via '%s', message: %s", smName, message); carla_stdout("Carla started via '%s', message: %s", smName, message);


@@ -298,6 +299,7 @@ protected:
if (carla_is_engine_running(handle)) if (carla_is_engine_running(handle))
carla_engine_close(handle); carla_engine_close(handle);


// TODO send error if engine failed to initialize
carla_engine_init(handle, "JACK", clientNameId); carla_engine_init(handle, "JACK", clientNameId);


fProjectPath = projectPath; fProjectPath = projectPath;


+ 1
- 1
source/frontend/carla View File

@@ -54,7 +54,7 @@ if __name__ == '__main__':
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# Show GUI # Show GUI


gui.show()
gui.showIfNeeded()


# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# App-Loop # App-Loop


+ 1
- 1
source/frontend/carla-jack-multi View File

@@ -60,7 +60,7 @@ if __name__ == '__main__':
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# Show GUI # Show GUI


gui.show()
gui.showIfNeeded()


# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# App-Loop # App-Loop


+ 1
- 1
source/frontend/carla-jack-single View File

@@ -60,7 +60,7 @@ if __name__ == '__main__':
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# Show GUI # Show GUI


gui.show()
gui.showIfNeeded()


# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# App-Loop # App-Loop


+ 1
- 1
source/frontend/carla-patchbay View File

@@ -58,7 +58,7 @@ if __name__ == '__main__':
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# Show GUI # Show GUI


gui.show()
gui.showIfNeeded()


# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# App-Loop # App-Loop


+ 27
- 6
source/frontend/carla_host.py View File

@@ -610,6 +610,23 @@ class HostWindow(QMainWindow):
if not host.isControl: if not host.isControl:
QTimer.singleShot(0, self.slot_engineStart) QTimer.singleShot(0, self.slot_engineStart)


# --------------------------------------------------------------------------------------------------------
# Manage visibility state, needed for NSM

def hideForNSM(self):
for pitem in reversed(self.fPluginList):
if pitem is None:
continue
widget = pitem.getWidget().hideCustomUI()
self.hide()

def showIfNeeded(self):
if self.host.nsmOK:
self.ui.act_file_quit.setText(self.tr("Hide"))
QApplication.instance().setQuitOnLastWindowClosed(False)
else:
self.show()

# -------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------
# Setup # Setup


@@ -2404,11 +2421,7 @@ class HostWindow(QMainWindow):


# Hide Optional Gui # Hide Optional Gui
elif opcode == NSM_CALLBACK_HIDE_OPTIONAL_GUI: elif opcode == NSM_CALLBACK_HIDE_OPTIONAL_GUI:
for pitem in reversed(self.fPluginList):
if pitem is None:
continue
widget = pitem.getWidget().hideCustomUI()
self.hide()
self.hideForNSM()


self.host.nsm_ready(opcode) self.host.nsm_ready(opcode)


@@ -2453,7 +2466,7 @@ class HostWindow(QMainWindow):
def slot_handleSIGTERM(self): def slot_handleSIGTERM(self):
print("Got SIGTERM -> Closing now") print("Got SIGTERM -> Closing now")
self.fCustomStopAction = self.CUSTOM_ACTION_APP_CLOSE self.fCustomStopAction = self.CUSTOM_ACTION_APP_CLOSE
self.slot_engineStop(True)
self.close()


# -------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------
# Internal stuff # Internal stuff
@@ -2749,6 +2762,11 @@ class HostWindow(QMainWindow):
event.ignore() event.ignore()
return return


if self.host.nsmOK and self.fCustomStopAction != self.CUSTOM_ACTION_APP_CLOSE:
self.hideForNSM()
self.host.nsm_ready(NSM_CALLBACK_HIDE_OPTIONAL_GUI)
return

patchcanvas.handleAllPluginsRemoved() patchcanvas.handleAllPluginsRemoved()


if MACOS and self.fMacClosingHelper and not (self.host.isControl or self.host.isPlugin): if MACOS and self.fMacClosingHelper and not (self.host.isControl or self.host.isPlugin):
@@ -2773,6 +2791,9 @@ class HostWindow(QMainWindow):


QMainWindow.closeEvent(self, event) QMainWindow.closeEvent(self, event)


# if we reach this point, fully close ourselves
QApplication.instance().quit()

# ------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------
# Canvas callback # Canvas callback




Loading…
Cancel
Save