vst windows getSize impl

This commit is contained in:
Paolo Marrone 2024-10-10 14:50:15 +02:00
parent 9727e377af
commit f90ec7abda

View File

@ -1307,6 +1307,8 @@ static Steinberg_tresult plugViewGetSize(void* thisInterface, struct Steinberg_V
plugView *v = (plugView *)((char *)thisInterface - offsetof(plugView, vtblIPlugView)); plugView *v = (plugView *)((char *)thisInterface - offsetof(plugView, vtblIPlugView));
size->left = 0; size->left = 0;
size->top = 0; size->top = 0;
size->right = 0;
size->bottom = 0;
if (v->ui) { if (v->ui) {
# ifdef __linux__ # ifdef __linux__
XWindowAttributes attr; XWindowAttributes attr;
@ -1323,6 +1325,13 @@ static Steinberg_tresult plugViewGetSize(void* thisInterface, struct Steinberg_V
CGFloat height = bounds.size.height; CGFloat height = bounds.size.height;
size->right = width; size->right = width;
size->bottom = height; size->bottom = height;
# endif
# ifdef _WIN32
RECT rect;
if (GetWindowRect((HWND)*((char **)v->ui), &rect)) {
size->right = rect.right - rect.left;
size->bottom = rect.bottom - rect.top;
}
# endif # endif
} }
if (!v->ui || size->right < 1 || size->bottom < 1) { if (!v->ui || size->right < 1 || size->bottom < 1) {