Skip to content

Commit 53dadd5

Browse files
DomClarkPhysSong
authored andcommitted
Fix VST windows resizing a little incorrectly
This was fixed for setting the initial size of the window in 8e9f74d, but I missed the resizing case.
1 parent 2c5cda5 commit 53dadd5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: plugins/vst_base/RemoteVstPlugin.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1726,22 +1726,29 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode,
17261726
#endif
17271727

17281728
case audioMasterSizeWindow:
1729+
{
17291730
SHOW_CALLBACK( "amc: audioMasterSizeWindow\n" );
17301731
if( __plugin->m_window == 0 )
17311732
{
17321733
return 0;
17331734
}
17341735
__plugin->m_windowWidth = _index;
17351736
__plugin->m_windowHeight = _value;
1736-
SetWindowPos( __plugin->m_window, 0, 0, 0,
1737-
_index + 8, _value + 26,
1737+
HWND window = __plugin->m_window;
1738+
DWORD dwStyle = GetWindowLongPtr( window, GWL_STYLE );
1739+
RECT windowSize = { 0, 0, (int) _index, (int) _value };
1740+
AdjustWindowRect( &windowSize, dwStyle, false );
1741+
SetWindowPos( window, 0, 0, 0,
1742+
windowSize.right - windowSize.left,
1743+
windowSize.bottom - windowSize.top,
17381744
SWP_NOACTIVATE | SWP_NOMOVE |
17391745
SWP_NOOWNERZORDER | SWP_NOZORDER );
17401746
__plugin->sendMessage(
17411747
message( IdVstPluginEditorGeometry ).
17421748
addInt( __plugin->m_windowWidth ).
17431749
addInt( __plugin->m_windowHeight ) );
17441750
return 1;
1751+
}
17451752

17461753
case audioMasterGetSampleRate:
17471754
SHOW_CALLBACK( "amc: audioMasterGetSampleRate\n" );

0 commit comments

Comments
 (0)