Browse Source

Fix parenting of plugin UIs

tags/1.9.4
falkTX 10 years ago
parent
commit
c1de847e57
10 changed files with 17 additions and 41 deletions
  1. +1
    -1
      source/backend/engine/CarlaEngine.cpp
  2. +5
    -3
      source/backend/plugin/CarlaPluginUi.cpp
  3. +0
    -3
      source/backend/plugin/VstPlugin.cpp
  4. +1
    -1
      source/backend/standalone/CarlaStandalone.cpp
  5. +0
    -7
      source/carla
  6. +0
    -9
      source/carla-patchbay
  7. +0
    -7
      source/carla-plugin
  8. +0
    -9
      source/carla-rack
  9. +7
    -0
      source/carla_host.py
  10. +3
    -1
      source/modules/dgl/src/Window.cpp

+ 1
- 1
source/backend/engine/CarlaEngine.cpp View File

@@ -2153,7 +2153,7 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch


case ENGINE_OPTION_FRONTEND_WIN_ID: case ENGINE_OPTION_FRONTEND_WIN_ID:
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);
const long winId(std::atol(valueStr));
const long long winId(std::strtoll(valueStr, nullptr, 16));
CARLA_SAFE_ASSERT_RETURN(winId >= 0,); CARLA_SAFE_ASSERT_RETURN(winId >= 0,);
pData->options.frontendWinId = static_cast<uintptr_t>(winId); pData->options.frontendWinId = static_cast<uintptr_t>(winId);
break; break;


+ 5
- 3
source/backend/plugin/CarlaPluginUi.cpp View File

@@ -136,7 +136,9 @@ public:
XSizeHints sizeHints; XSizeHints sizeHints;
carla_zeroStruct<XSizeHints>(sizeHints); carla_zeroStruct<XSizeHints>(sizeHints);


sizeHints.flags = PMinSize|PMaxSize;
sizeHints.flags = PSize|PMinSize|PMaxSize;
sizeHints.width = static_cast<int>(width);
sizeHints.height = static_cast<int>(height);
sizeHints.min_width = static_cast<int>(width); sizeHints.min_width = static_cast<int>(width);
sizeHints.min_height = static_cast<int>(height); sizeHints.min_height = static_cast<int>(height);
sizeHints.max_width = static_cast<int>(width); sizeHints.max_width = static_cast<int>(width);
@@ -160,7 +162,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fDisplay != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDisplay != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fWindow != 0,); CARLA_SAFE_ASSERT_RETURN(fWindow != 0,);


XSetTransientForHint(fDisplay, fWindow, (Window)winId);
XSetTransientForHint(fDisplay, fWindow, static_cast<Window>(winId));
} }


void* getPtr() const noexcept void* getPtr() const noexcept
@@ -190,7 +192,7 @@ bool CarlaPluginUi::tryTransientWinIdMatch(const uintptr_t pid, const char* cons
#elif defined(HAVE_X11) #elif defined(HAVE_X11)
struct ScopedDisplay { struct ScopedDisplay {
Display* display; Display* display;
ScopedDisplay() : display(XOpenDisplay(0)) {}
ScopedDisplay() : display(XOpenDisplay(nullptr)) {}
~ScopedDisplay() { if (display!=nullptr) XCloseDisplay(display); } ~ScopedDisplay() { if (display!=nullptr) XCloseDisplay(display); }
}; };
struct ScopedFreeData { struct ScopedFreeData {


+ 0
- 3
source/backend/plugin/VstPlugin.cpp View File

@@ -445,9 +445,6 @@ public:
if (fUi.window == nullptr) if (fUi.window == nullptr)
return pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, -1, 0, 0.0f, msg); return pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, -1, 0, 0.0f, msg);


if (uintptr_t winId = pData->engine->getOptions().frontendWinId)
fUi.window->setTransientWinId(winId);

QString guiTitle(QString("%1 (GUI)").arg(pData->name)); QString guiTitle(QString("%1 (GUI)").arg(pData->name));
fUi.window->setTitle(guiTitle.toUtf8().constData()); fUi.window->setTitle(guiTitle.toUtf8().constData());
} }


+ 1
- 1
source/backend/standalone/CarlaStandalone.cpp View File

@@ -1137,7 +1137,7 @@ void carla_set_engine_option(EngineOption option, int value, const char* valueSt


case CB::ENGINE_OPTION_FRONTEND_WIN_ID: case CB::ENGINE_OPTION_FRONTEND_WIN_ID:
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);
const long winId(std::atol(valueStr));
const long long winId(std::strtoll(valueStr, nullptr, 16));
CARLA_SAFE_ASSERT_RETURN(winId >= 0,); CARLA_SAFE_ASSERT_RETURN(winId >= 0,);
gStandalone.engineOptions.frontendWinId = static_cast<uintptr_t>(winId); gStandalone.engineOptions.frontendWinId = static_cast<uintptr_t>(winId);
break; break;


+ 0
- 7
source/carla View File

@@ -294,13 +294,6 @@ class CarlaHostW(HostWindow):


# ----------------------------------------------------------------- # -----------------------------------------------------------------


def showEvent(self, event):
HostWindow.showEvent(self, event)

# set our gui as parent for all plugins UIs
if gCarla.host is not None:
gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(self.winId()))

def resizeEvent(self, event): def resizeEvent(self, event):
HostWindow.resizeEvent(self, event) HostWindow.resizeEvent(self, event)
self.updateInfoLabelXandSize() self.updateInfoLabelXandSize()


+ 0
- 9
source/carla-patchbay View File

@@ -32,15 +32,6 @@ class CarlaHostW(HostWindow):
self.fContainer = CarlaPatchbayW(self) self.fContainer = CarlaPatchbayW(self)
self.setupContainer(True, self.fContainer.themeData) self.setupContainer(True, self.fContainer.themeData)


# -----------------------------------------------------------------

def showEvent(self, event):
HostWindow.showEvent(self, event)

# set our gui as parent for all plugins UIs
if gCarla.host is not None:
gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(self.winId()))

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Main # Main




+ 0
- 7
source/carla-plugin View File

@@ -552,13 +552,6 @@ class CarlaMiniW(HostWindow, ExternalUI):
# ------------------------------------------------------------------- # -------------------------------------------------------------------
# Qt events # Qt events


def showEvent(self, event):
HostWindow.showEvent(self, event)

# set our gui as parent for all plugins UIs
if gCarla.host is not None:
gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(self.winId()))

def closeEvent(self, event): def closeEvent(self, event):
self.closeExternalUI() self.closeExternalUI()
HostWindow.closeEvent(self, event) HostWindow.closeEvent(self, event)


+ 0
- 9
source/carla-rack View File

@@ -32,15 +32,6 @@ class CarlaHostW(HostWindow):
self.fContainer = CarlaRackW(self) self.fContainer = CarlaRackW(self)
self.setupContainer(False) self.setupContainer(False)


# -----------------------------------------------------------------

def showEvent(self, event):
HostWindow.showEvent(self, event)

# set our gui as parent for all plugins UIs
if gCarla.host is not None:
gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(self.winId()))

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Main # Main




+ 7
- 0
source/carla_host.py View File

@@ -1155,6 +1155,13 @@ class HostWindow(QMainWindow):


# ----------------------------------------------------------------- # -----------------------------------------------------------------


def showEvent(self, event):
QMainWindow.showEvent(self, event)

# set our gui as parent for all plugins UIs
if gCarla.host is not None:
gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, "%x" % self.winId())

def timerEvent(self, event): def timerEvent(self, event):
if event.timerId() == self.fIdleTimerFast: if event.timerId() == self.fIdleTimerFast:
#if not gCarla.isPlugin: #if not gCarla.isPlugin:


+ 3
- 1
source/modules/dgl/src/Window.cpp View File

@@ -426,7 +426,9 @@ public:
XSizeHints sizeHints; XSizeHints sizeHints;
memset(&sizeHints, 0, sizeof(sizeHints)); memset(&sizeHints, 0, sizeof(sizeHints));


sizeHints.flags = PMinSize|PMaxSize;
sizeHints.flags = PSize|PMinSize|PMaxSize;
sizeHints.width = static_cast<int>(width);
sizeHints.height = static_cast<int>(height);
sizeHints.min_width = static_cast<int>(width); sizeHints.min_width = static_cast<int>(width);
sizeHints.min_height = static_cast<int>(height); sizeHints.min_height = static_cast<int>(height);
sizeHints.max_width = static_cast<int>(width); sizeHints.max_width = static_cast<int>(width);


Loading…
Cancel
Save