Closed AnClark closed 1 year ago
Is there any solution to prevent the UI from being resized casually, or just clip the UI (with scrollbar) when the host window size is smaller than the minimal size?
there's none. IMNSHO the minimum size, as designated by the plugin UI, should (rather must) be honored at all times no matter the cost; if not then it's responsibility of the host to provide the scrollbars in question.
it crashes probably some child widget graphic is getting an impossible zero height or height in size and some division-by-zero ensues causing the crash.
please tell whether https://github.com/rncbc/synthv1/commit/5bef8b8 mitigates the issue
thanks
please tell whether 5bef8b8 mitigates the issue
thanks
Issue still exists. What's more, whether CONFIG_LV2_UI_RESIZE is ON or not, UI can always be resized by REAPER.
I have a GDB backtrace of the crash (debug build, static Qt6):
Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ff85f909bb0 in QRasterPaintEngine::setDC(HDC__*) () from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
(gdb) bt
#0 0x00007ff85f909bb0 in QRasterPaintEngine::setDC(HDC__*) ()
from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#1 0x00007ff85f98c81a in QWindowsNativeImage::QWindowsNativeImage(int, int, QImage::Format) ()
from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#2 0x00007ff85f9cfde0 in QWindowsBackingStore::resize(QSize const&, QRegion const&) ()
from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#3 0x00007ff85f66c49d in QBackingStore::resize(QSize const&) ()
from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#4 0x00007ff85fa2b157 in QWidgetRepaintManager::paintAndFlush() ()
from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#5 0x00007ff85f6b36b1 in QWidgetWindow::handleResizeEvent(QResizeEvent*) ()
from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#6 0x00007ff85f6b505d in QWidgetWindow::event(QEvent*) ()
from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#7 0x00007ff85f94839f in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#8 0x00007ff85f7a32b8 in QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*) ()
from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#9 0x00007ff85fa5a83e in QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent*) () from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#10 0x00007ff85fa72e5c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#11 0x00007ff85fa7300f in QWindowSystemInterface::flushWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#12 0x00007ff85f7204f2 in QWindowsWindow::handleWmPaint(HWND__*, unsigned int, unsigned long long, long long, long long*) () from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#13 0x00007ff85f789b6f in QWindowsContext::windowsProc(HWND__*, unsigned int, QtWindows::WindowsEventType, unsigned long long, long long, long long*, QWindowsWindow**) () from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
#14 0x00007ff8602190c3 in qWindowsWndProc () from C:\Program Files\Common Files\LV2\synthv1.lv2\synthv1.dll
Issue still exists. What's more, whether CONFIG_LV2_UI_RESIZE is ON or not, UI can always be resized by REAPER.
too bad, I guess the oddball is on the reaper side then.
with CONFIG_LV2_UI_RESIZE=ON, can you have a breakpoint and/or trace the width and height values in here: https://github.com/rncbc/synthv1/blob/5bef8b8ad9abc58d0634362ed52cc03fb5d386f6/src/synthv1_lv2ui.cpp#L163
thanks
I've traced the values via this patch:
diff --git a/src/synthv1_lv2ui.cpp b/src/synthv1_lv2ui.cpp
index d228fc3..efec4c0 100644
--- a/src/synthv1_lv2ui.cpp
+++ b/src/synthv1_lv2ui.cpp
@@ -162,6 +162,10 @@ static const LV2UI_Show_Interface synthv1_lv2ui_show_interface =
int synthv1_lv2ui_resize ( LV2UI_Handle ui, int width, int height )
{
+ FILE *f = fopen("D:/size_log.txt", "w");
+ fprintf(f, "Width = %d, Height = %d\n", width, height);
+ fclose(f);
+
synthv1widget_lv2 *pWidget = static_cast<synthv1widget_lv2 *> (ui);
if (pWidget) {
const QSize& min_size = pWidget->minimumSize();
When UI becomes the size shown below, it reports Width = 1380, Height = 26
.
Also, in this line:
When I change UI_WINDOWS_RECOMMENDED_WIDTH
into a small value, for example, 46
, same problem occurs.
When UI becomes the size shown below, it reports Width = 1380, Height = 26.
and what about after the min_size, max_size clamping ?
ps. height=26 or anything less than the initial/minimum size is actually a death sentence o.O pps. even ardour conforms to this rule; why reaper doesn't is beyond my understanding.
and what about after the min_size, max_size clamping ?
I've found that 1380x46 is a threshold. When height is below 46, it crashes.
pps. even ardour conforms to this rule; why reaper doesn't is beyond my understanding.
On Windows, REAPER tends to resize LV2 UI rather than clipping it.
But for VST plugins, REAPER can clip as what I wish:
Maybe there's a way to stop Qt from following the parent window to resize its UI. Just like DPF's behavior:
P.S. Only Windows version has the window-resizing problem. Linux version (in Manjaro repo) works as wish, with Reaper for Linux.
P.S. Only Windows version has the window-resizing problem. Linux version (in Manjaro repo) works as wish, with Reaper for Linux.
then I would try to make the widget fixed size ie. non-resizable on windows:
like inserting the following:
#ifdef CONFIG_LV2_UI_WINDOWS
synthv1widget::setFixedSize(synthv1widget::sizeHint());
#endif
somewhere here (L91)? https://github.com/rncbc/synthv1/blob/010318282fee11242dcd62ff07f0f4e3bf8c5997/src/synthv1widget_lv2.cpp#L84-L92
P.S. Only Windows version has the window-resizing problem. Linux version (in Manjaro repo) works as wish, with Reaper for Linux.
I mean, on Linux, when window size is smaller than the recommended minimum size, UI can be clipped as what I wish. This is the better behavior.
Before resizing:
After resizing:
On Windows, UI won't be clipped. Instead, widgets will "zoom out" in portion:
Seems that Linux version conforms to fixed widget sizes (knobs, buttons, etc.), even though you don't assign setFixedSize()
explicitly for each widget. But Windows not.
The same implementation, the different UI behaviors. I don't know if it's Qt6's issue or not.
P.S. Maybe this is because of sizePolicy
? Almost all widgets has set it to Preferred
. Actual behaviors differ in Win32 and X11.
have you tried the purposed fix on windows as in https://github.com/rncbc/synthv1/issues/21#issuecomment-1323772244 ?
have you tried the purposed fix on windows as in #21 (comment) ?
Not yet. I'm not home, so I cannot test on my Windows PC. Only two Arch Linux laptops are around me.
BTW, 5bef8b8a is not a suitable workaround. Instead it causes layout issue on Linux:
And this workaround doesn't work on Windows. I suggest that you drop or revert this commit.
And this workaround doesn't work on Windows. I suggest that you drop or revert this commit.
done in 8637cbc. thanks
have you tried the purposed fix on windows as in #21 (comment) ?
Not yet. I'm not home, so I cannot test on my Windows PC. Only two Arch Linux laptops are around me.
any news?
I should ask again, sorry, but is this
#ifdef CONFIG_LV2_UI_WINDOWS
synthv1widget::setFixedSize(synthv1widget::sizeHint());
#endif
working fine on windows/reaper? or are you referring to something else?
REAPER on Windows will unconditionally ignore the fixed size, and forces resizing the UI.
so I guess this can closed then
cheers && thanks
Hi Rui,
Some hosts like REAPER can ignore the minimum size limitation, so the window can be resized like this:
Or this:
What's more, if I drag the window to a smaller size like the screenshot above, it will crash:
Is there any solution to prevent the UI from being resized casually, or just clip the UI (with scrollbar) when the host window size is smaller than the minimal size?