diff --git a/source/frontend/carla-plugin b/source/frontend/carla-plugin index 8529b8b76..e80c33609 100755 --- a/source/frontend/carla-plugin +++ b/source/frontend/carla-plugin @@ -578,17 +578,17 @@ class CarlaEmbedW(QEmbedWidget): if __name__ == '__main__': # ------------------------------------------------------------- - # App initialization - - app = CarlaApplication("Carla2-Plugin") + # Get details regarding target usage - # ------------------------------------------------------------- - # Set-up custom signal handling + try: + winId = int(os.getenv("CARLA_PLUGIN_EMBED_WINID")) + except: + winId = 0 - setUpSignals() + usingEmbed = bool(LINUX and winId != 0) # ------------------------------------------------------------- - # Init host backend + # Init host backend (part 1) isPatchbay = sys.argv[0].rsplit(os.path.sep)[-1].lower().replace(".exe","") == "carla-plugin-patchbay" @@ -596,19 +596,34 @@ if __name__ == '__main__': host.processMode = ENGINE_PROCESS_MODE_PATCHBAY if isPatchbay else ENGINE_PROCESS_MODE_CONTINUOUS_RACK host.processModeForced = True host.nextProcessMode = host.processMode - loadHostSettings(host) # ------------------------------------------------------------- - # Create GUI - - try: - winId = int(os.getenv("CARLA_PLUGIN_EMBED_WINID")) - except: - winId = 0 + # Set-up environment gCarla.utils.setenv("CARLA_PLUGIN_EMBED_WINID", "0") - if LINUX and winId != 0: + if usingEmbed: + gCarla.utils.setenv("QT_QPA_PLATFORM", "xcb") + + # ------------------------------------------------------------- + # App initialization + + app = CarlaApplication("Carla2-Plugin") + + # ------------------------------------------------------------- + # Set-up custom signal handling + + setUpSignals() + + # ------------------------------------------------------------- + # Init host backend (part 2) + + loadHostSettings(host) + + # ------------------------------------------------------------- + # Create GUI + + if usingEmbed: gui = CarlaEmbedW(host, winId, isPatchbay) else: gui = CarlaMiniW(host, isPatchbay)