Signed-off-by: falkTX <falktx@falktx.com>tags/v1.0
@@ -98,6 +98,8 @@ public: | |||
return; | |||
} | |||
std::strcpy(fPluginSearchString, "Search..."); | |||
fPlugin->setUI(this); | |||
const CarlaHostHandle handle = fPlugin->fCarlaHostHandle; | |||
@@ -105,10 +107,9 @@ public: | |||
if (carla_get_current_plugin_count(handle) != 0) | |||
{ | |||
showPluginUI(handle); | |||
startThread(); | |||
return; | |||
} | |||
std::strcpy(fPluginSearchString, "Search..."); | |||
} | |||
~IldaeilUI() override | |||
@@ -173,22 +174,22 @@ protected: | |||
void run() override | |||
{ | |||
fPluginCount = carla_get_cached_plugin_count(PLUGIN_LV2, nullptr); | |||
if (fPluginCount != 0) | |||
if (const uint count = carla_get_cached_plugin_count(PLUGIN_LV2, nullptr)) | |||
{ | |||
fPlugins = new CarlaCachedPluginInfo[fPluginCount]; | |||
fPlugins = new CarlaCachedPluginInfo[count]; | |||
for (uint i=0; i < fPluginCount && ! shouldThreadExit(); ++i) | |||
for (uint i=0; i < count && ! shouldThreadExit(); ++i) | |||
{ | |||
std::memcpy(&fPlugins[i], carla_get_cached_plugin_info(PLUGIN_LV2, i), sizeof(CarlaCachedPluginInfo)); | |||
// TODO fix leaks | |||
fPlugins[i].name = strdup(fPlugins[i].name); | |||
fPlugins[i].label = strdup(fPlugins[i].label); | |||
} | |||
fPluginCount = count; | |||
} | |||
if (! shouldThreadExit()) | |||
if (fDrawingState == kDrawingLoading && ! shouldThreadExit()) | |||
fDrawingState = kDrawingPluginList; | |||
} | |||
@@ -196,6 +197,8 @@ protected: | |||
{ | |||
switch (fDrawingState) | |||
{ | |||
case kDrawingInit: | |||
break; | |||
case kDrawingPluginList: | |||
drawPluginList(); | |||
break; | |||
@@ -214,8 +217,6 @@ protected: | |||
void drawBottomBar() | |||
{ | |||
const CarlaHostHandle handle = fPlugin->fCarlaHostHandle; | |||
ImGui::SetNextWindowPos(ImVec2(0, getHeight() - kBottomHeight * getScaleFactor())); | |||
ImGui::SetNextWindowSize(ImVec2(getWidth(), kBottomHeight * getScaleFactor())); | |||
@@ -298,7 +299,6 @@ protected: | |||
{ | |||
const CarlaCachedPluginInfo& info(fPlugins[i]); | |||
/* | |||
#if DISTRHO_PLUGIN_IS_SYNTH | |||
if (info.midiIns != 1 || info.audioOuts != 2) | |||
continue; | |||
@@ -311,13 +311,12 @@ protected: | |||
if (info.audioIns != 2 || info.audioOuts != 2) | |||
continue; | |||
#endif | |||
*/ | |||
const char* const slash = std::strchr(info.label, DISTRHO_OS_SEP); | |||
DISTRHO_SAFE_ASSERT_CONTINUE(slash != nullptr); | |||
// if (search != nullptr && strcasestr(info.name, search) == nullptr) | |||
// continue; | |||
if (search != nullptr && strcasestr(info.name, search) == nullptr) | |||
continue; | |||
bool selected = fPluginSelected == i; | |||
ImGui::TableNextRow(); | |||
@@ -70,14 +70,22 @@ Size<uint> getChildWindowSize(const uintptr_t winId) | |||
{ | |||
d_stdout("found child window"); | |||
XWindowAttributes attrs; | |||
memset(&attrs, 0, sizeof(attrs)); | |||
XSizeHints sizeHints; | |||
memset(&sizeHints, 0, sizeof(sizeHints)); | |||
if (XGetNormalHints(display, childWindow, &sizeHints)) | |||
{ | |||
int width = 0; | |||
int height = 0; | |||
int width = 0; | |||
int height = 0; | |||
if (XGetWindowAttributes(display, childWindow, &attrs)) | |||
{ | |||
width = attrs.width; | |||
height = attrs.height; | |||
} | |||
else if (XGetNormalHints(display, childWindow, &sizeHints)) | |||
{ | |||
if (sizeHints.flags & PSize) | |||
{ | |||
width = sizeHints.width; | |||
@@ -88,25 +96,18 @@ Size<uint> getChildWindowSize(const uintptr_t winId) | |||
width = sizeHints.base_width; | |||
height = sizeHints.base_height; | |||
} | |||
else if (sizeHints.flags & PMinSize) | |||
{ | |||
width = sizeHints.min_width; | |||
height = sizeHints.min_height; | |||
} | |||
} | |||
d_stdout("child window bounds %u %u", width, height); | |||
d_stdout("child window bounds %u %u", width, height); | |||
if (width > 1 && height > 1) | |||
{ | |||
// XMoveWindow(display, (::Window)winId, 0, 40); | |||
// XResizeWindow(display, (::Window)winId, width, height); | |||
// XMoveWindow(display, childWindow, 0, 40); | |||
// XMoveResizeWindow(display, childWindow, 0, 40, width, height); | |||
return Size<uint>(static_cast<uint>(width), static_cast<uint>(height)); | |||
} | |||
if (width > 1 && height > 1) | |||
{ | |||
// XMoveWindow(display, (::Window)winId, 0, 40); | |||
// XResizeWindow(display, (::Window)winId, width, height); | |||
// XMoveWindow(display, childWindow, 0, 40); | |||
// XMoveResizeWindow(display, childWindow, 0, 40, width, height); | |||
return Size<uint>(static_cast<uint>(width), static_cast<uint>(height)); | |||
} | |||
else | |||
d_stdout("child window without bounds"); | |||
} | |||
XCloseDisplay(display); | |||