Browse Source

Keep window size checks active

Signed-off-by: falkTX <falktx@falktx.com>
tags/v1.0
falkTX 3 years ago
parent
commit
ed5544e0f2
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
5 changed files with 71 additions and 65 deletions
  1. +1
    -0
      .github/workflows/build.yml
  2. +1
    -1
      Makefile
  3. +1
    -1
      carla
  4. +3
    -2
      plugins/Common/IldaeilUI.cpp
  5. +65
    -61
      plugins/Common/PluginHostWindow.cpp

+ 1
- 0
.github/workflows/build.yml View File

@@ -8,6 +8,7 @@ on:
branches:
- '*'
env:
CACHE_VERSION: 1
DEBIAN_FRONTEND: noninteractive
HOMEBREW_NO_AUTO_UPDATE: 1



+ 1
- 1
Makefile View File

@@ -28,7 +28,7 @@ CARLA_EXTRA_ARGS += USING_JUCE_GUI_EXTRA=false
# --------------------------------------------------------------

carla:
$(MAKE) static-plugin -C carla $(CARLA_EXTRA_ARGS) \
$(MAKE) bridges-plugin bridges-ui static-plugin -C carla $(CARLA_EXTRA_ARGS) \
CAN_GENERATE_LV2_TTL=false \
STATIC_PLUGIN_TARGET=true



+ 1
- 1
carla

@@ -1 +1 @@
Subproject commit 683c5fe9a05122693f6fb14254d0a3990d995acb
Subproject commit 2a55bbaef404982094805a8aab71f754cb602db5

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

@@ -473,8 +473,9 @@ public:
protected:
void pluginWindowResized(const uint width, const uint height) override
{
fNextSize = Size<uint>(width,
height + kButtonHeight * getScaleFactor() + ImGui::GetStyle().WindowPadding.y * 2);
const uint extraHeight = kButtonHeight * getScaleFactor() + ImGui::GetStyle().WindowPadding.y * 2;

fNextSize = Size<uint>(width, height + extraHeight);
}

void uiIdle() override


+ 65
- 61
plugins/Common/PluginHostWindow.cpp View File

@@ -187,29 +187,6 @@ struct PluginHostWindow::PrivateData
#elif defined(DISTRHO_OS_WINDOWS)
if (pluginWindow == nullptr)
pluginWindow = FindWindowExA((::HWND)parentWindowId, nullptr, nullptr, nullptr);

if (pluginWindow != nullptr)
{
int width = 0;
int height = 0;

RECT rect;
if (GetWindowRect(pluginWindow, &rect))
{
width = rect.right - rect.left;
height = rect.bottom - rect.top;
}

d_stdout("child window bounds %u %u | offset %u %u", width, height, xOffset, yOffset);

if (width > 1 && height > 1)
{
lookingForChildren = false;
SetWindowPos(pluginWindow, 0, xOffset, yOffset, 0, 0,
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOZORDER);
pluginWindowCallbacks->pluginWindowResized(width, height);
}
}
#else
if (pluginWindow == 0)
{
@@ -225,61 +202,88 @@ struct PluginHostWindow::PrivateData
XFree(childWindows);
}
}
#endif
}

#if defined(DISTRHO_OS_HAIKU)
#elif defined(DISTRHO_OS_MAC)
#elif defined(DISTRHO_OS_WINDOWS)
if (pluginWindow != nullptr)
{
int width = 0;
int height = 0;

RECT rect;
if (GetWindowRect(pluginWindow, &rect))
{
width = rect.right - rect.left;
height = rect.bottom - rect.top;
}

if (pluginWindow != 0)
if (lookingForChildren)
d_stdout("child window bounds %u %u | offset %u %u", width, height, xOffset, yOffset);

if (width > 1 && height > 1)
{
int width = 0;
int height = 0;
lookingForChildren = false;
SetWindowPos(pluginWindow, 0, xOffset, yOffset, 0, 0,
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOZORDER);
pluginWindowCallbacks->pluginWindowResized(width, height);
}
}
#else
if (pluginWindow != 0)
{
int width = 0;
int height = 0;

XWindowAttributes attrs;
memset(&attrs, 0, sizeof(attrs));
XWindowAttributes attrs;
memset(&attrs, 0, sizeof(attrs));

pthread_mutex_lock(&gErrorMutex);
const XErrorHandler oldErrorHandler = XSetErrorHandler(ildaeilErrorHandler);
gErrorTriggered = false;
pthread_mutex_lock(&gErrorMutex);
const XErrorHandler oldErrorHandler = XSetErrorHandler(ildaeilErrorHandler);
gErrorTriggered = false;

if (XGetWindowAttributes(display, pluginWindow, &attrs) && ! gErrorTriggered)
{
width = attrs.width;
height = attrs.height;
}
if (XGetWindowAttributes(display, pluginWindow, &attrs) && ! gErrorTriggered)
{
width = attrs.width;
height = attrs.height;
}

XSetErrorHandler(oldErrorHandler);
pthread_mutex_unlock(&gErrorMutex);
XSetErrorHandler(oldErrorHandler);
pthread_mutex_unlock(&gErrorMutex);

if (width == 0 && height == 0)
{
XSizeHints sizeHints;
memset(&sizeHints, 0, sizeof(sizeHints));
if (width == 0 && height == 0)
{
XSizeHints sizeHints;
memset(&sizeHints, 0, sizeof(sizeHints));

if (XGetNormalHints(display, pluginWindow, &sizeHints))
if (XGetNormalHints(display, pluginWindow, &sizeHints))
{
if (sizeHints.flags & PSize)
{
if (sizeHints.flags & PSize)
{
width = sizeHints.width;
height = sizeHints.height;
}
else if (sizeHints.flags & PBaseSize)
{
width = sizeHints.base_width;
height = sizeHints.base_height;
}
width = sizeHints.width;
height = sizeHints.height;
}
else if (sizeHints.flags & PBaseSize)
{
width = sizeHints.base_width;
height = sizeHints.base_height;
}
}
}

if (lookingForChildren)
d_stdout("child window bounds %u %u | offset %u %u", width, height, xOffset, yOffset);

if (width > 1 && height > 1)
{
lookingForChildren = false;
XMoveWindow(display, pluginWindow, xOffset, yOffset);
pluginWindowCallbacks->pluginWindowResized(width, height);
}
if (width > 1 && height > 1)
{
lookingForChildren = false;
XMoveWindow(display, pluginWindow, xOffset, yOffset);
pluginWindowCallbacks->pluginWindowResized(width, height);
}
#endif
}

#ifdef ILDAEIL_X11
for (XEvent event; XPending(display) > 0;)
XNextEvent(display, &event);
#endif


Loading…
Cancel
Save