Skip to content

Commit

Permalink
Fix VST windows resizing a little incorrectly
Browse files Browse the repository at this point in the history
This was fixed for setting the initial size of the window in 8e9f74d, but I missed the resizing case.
  • Loading branch information
DomClark authored and PhysSong committed Sep 11, 2018
1 parent 2c5cda5 commit 53dadd5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plugins/vst_base/RemoteVstPlugin.cpp
Expand Up @@ -1726,22 +1726,29 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode,
#endif #endif


case audioMasterSizeWindow: case audioMasterSizeWindow:
{
SHOW_CALLBACK( "amc: audioMasterSizeWindow\n" ); SHOW_CALLBACK( "amc: audioMasterSizeWindow\n" );
if( __plugin->m_window == 0 ) if( __plugin->m_window == 0 )
{ {
return 0; return 0;
} }
__plugin->m_windowWidth = _index; __plugin->m_windowWidth = _index;
__plugin->m_windowHeight = _value; __plugin->m_windowHeight = _value;
SetWindowPos( __plugin->m_window, 0, 0, 0, HWND window = __plugin->m_window;
_index + 8, _value + 26, DWORD dwStyle = GetWindowLongPtr( window, GWL_STYLE );
RECT windowSize = { 0, 0, (int) _index, (int) _value };
AdjustWindowRect( &windowSize, dwStyle, false );
SetWindowPos( window, 0, 0, 0,
windowSize.right - windowSize.left,
windowSize.bottom - windowSize.top,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOMOVE |
SWP_NOOWNERZORDER | SWP_NOZORDER ); SWP_NOOWNERZORDER | SWP_NOZORDER );
__plugin->sendMessage( __plugin->sendMessage(
message( IdVstPluginEditorGeometry ). message( IdVstPluginEditorGeometry ).
addInt( __plugin->m_windowWidth ). addInt( __plugin->m_windowWidth ).
addInt( __plugin->m_windowHeight ) ); addInt( __plugin->m_windowHeight ) );
return 1; return 1;
}


case audioMasterGetSampleRate: case audioMasterGetSampleRate:
SHOW_CALLBACK( "amc: audioMasterGetSampleRate\n" ); SHOW_CALLBACK( "amc: audioMasterGetSampleRate\n" );
Expand Down

0 comments on commit 53dadd5

Please sign in to comment.