Browse Source

Cleanup

Signed-off-by: falkTX <falktx@falktx.com>
main
falkTX 1 year ago
parent
commit
2521899d37
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 18 additions and 22 deletions
  1. +5
    -2
      plugins/Common/IldaeilUI.cpp
  2. +11
    -18
      plugins/Common/PluginHostWindow.cpp
  3. +2
    -2
      plugins/Common/PluginHostWindow.hpp

+ 5
- 2
plugins/Common/IldaeilUI.cpp View File

@@ -162,6 +162,7 @@ class IldaeilUI : public UI,
} fIdleState = kIdleInit;

IldaeilBasePlugin* const fPlugin;
void* const fNativeWindowHandle;
PluginHostWindow fPluginHostWindow;

BinaryType fBinaryType;
@@ -218,7 +219,8 @@ public:
fDrawingState(kDrawingLoading),
fIdleState(kIdleInit),
fPlugin((IldaeilBasePlugin*)getPluginInstancePointer()),
fPluginHostWindow(getWindow(), this),
fNativeWindowHandle(reinterpret_cast<void*>(getWindow().getNativeWindowHandle())),
fPluginHostWindow(fNativeWindowHandle, this),
fBinaryType(BINARY_NATIVE),
fPluginType(PLUGIN_LV2),
fNextPluginType(fPluginType),
@@ -412,7 +414,8 @@ public:
fIgnoreNextHostWindowResize = false;
fShowingHostWindow = true;

carla_embed_custom_ui(handle, fPluginId, fPluginHostWindow.attachAndGetWindowHandle());
fPluginHostWindow.restart();
carla_embed_custom_ui(handle, fPluginId, fNativeWindowHandle);
}
else
#endif


+ 11
- 18
plugins/Common/PluginHostWindow.cpp View File

@@ -51,8 +51,7 @@ static int ildaeilErrorHandler(Display*, XErrorEvent*)

struct PluginHostWindow::PrivateData
{
Window& parentWindow;
const uintptr_t parentWindowId;
void* const windowHandle;
Callbacks* const pluginWindowCallbacks;

#if defined(DISTRHO_OS_HAIKU)
@@ -69,9 +68,8 @@ struct PluginHostWindow::PrivateData

bool lookingForChildren;

PrivateData(Window& pw, Callbacks* const cbs)
: parentWindow(pw),
parentWindowId(pw.getNativeWindowHandle()),
PrivateData(void* const wh, Callbacks* const cbs)
: windowHandle(wh),
pluginWindowCallbacks(cbs),
#if defined(DISTRHO_OS_HAIKU)
#elif defined(DISTRHO_OS_MAC)
@@ -109,22 +107,17 @@ struct PluginHostWindow::PrivateData
#endif
}

void* attachAndGetWindowHandle()
void restart()
{
lookingForChildren = true;
#if defined(DISTRHO_OS_HAIKU)
return nullptr;
#elif defined(DISTRHO_OS_MAC)
pluginView = nullptr;
return (void*)parentWindowId;
#elif defined(DISTRHO_OS_WASM)
return nullptr;
#elif defined(DISTRHO_OS_WINDOWS)
pluginWindow = nullptr;
return (void*)parentWindowId;
#else
pluginWindow = 0;
return (void*)parentWindowId;
#endif
}

@@ -168,7 +161,7 @@ struct PluginHostWindow::PrivateData
if (pluginView == nullptr)
{
bool first = true;
for (NSView* view in [(NSView*)parentWindowId subviews])
for (NSView* view in [(NSView*)windowHandle subviews])
{
if (first)
{
@@ -182,7 +175,7 @@ struct PluginHostWindow::PrivateData
#elif defined(DISTRHO_OS_WASM)
#elif defined(DISTRHO_OS_WINDOWS)
if (pluginWindow == nullptr)
pluginWindow = FindWindowExA((::HWND)parentWindowId, nullptr, nullptr, nullptr);
pluginWindow = FindWindowExA((::HWND)windowHandle, nullptr, nullptr, nullptr);
#else
if (display == nullptr)
return;
@@ -193,7 +186,7 @@ struct PluginHostWindow::PrivateData
::Window* childWindows = nullptr;
uint numChildren = 0;

XQueryTree(display, parentWindowId, &rootWindow, &parentWindow, &childWindows, &numChildren);
XQueryTree(display, (::Window)windowHandle, &rootWindow, &parentWindow, &childWindows, &numChildren);

if (numChildren > 0 && childWindows != nullptr)
{
@@ -334,17 +327,17 @@ struct PluginHostWindow::PrivateData
}
};

PluginHostWindow::PluginHostWindow(Window& parentWindow, Callbacks* const cbs)
: pData(new PrivateData(parentWindow, cbs)) {}
PluginHostWindow::PluginHostWindow(void* const windowHandle, Callbacks* const cbs)
: pData(new PrivateData(windowHandle, cbs)) {}

PluginHostWindow::~PluginHostWindow()
{
delete pData;
}

void* PluginHostWindow::attachAndGetWindowHandle()
void PluginHostWindow::restart()
{
return pData->attachAndGetWindowHandle();
pData->restart();
}

bool PluginHostWindow::hide()


+ 2
- 2
plugins/Common/PluginHostWindow.hpp View File

@@ -32,10 +32,10 @@ public:
virtual void pluginWindowResized(uint width, uint height) = 0;
};

explicit PluginHostWindow(Window& parentWindow, Callbacks* cbs);
explicit PluginHostWindow(void* windowHandle, Callbacks* cbs);
~PluginHostWindow();

void* attachAndGetWindowHandle();
void restart();
bool hide();
void idle();
void setOffset(uint x, uint y);


Loading…
Cancel
Save