vst.net icon indicating copy to clipboard operation
vst.net copied to clipboard

PluginCommandStub.Commands.EditorGetRect(out Rectangle wndRect) seems to always return Rect(X=0, Y=0, Width=400, Height=300)

Open paulpv opened this issue 3 years ago • 1 comments

Describe the bug I am so far only using Jacobi.Vst.Samples.Host with https://www.reaper.fm/reaplugs/. Whenever I show any of their Editors, the returned Rect size is always 400x300. image

To Reproduce Steps to reproduce the behavior:

  1. Install https://www.reaper.fm/reaplugs/
  2. Launch Jacobi.Vst.Samples.Host, load any of the plugins
  3. Set a breakpoint at EditorFrame.ShowDialog call to PluginCommandStub.Commands.EditorGetRect
  4. View the plugin's Editor

Expected behavior The plugin returns the correct Rect size. I have stepped through the code in OBS Studio and it loads the correct Rect size from all reaplugs.

Actual behavior Rect size always comes back as Rect(X=0, Y=0, Width=400, Height=300)

Desktop:

  • OS: Windows 10 Pro 21H1 19043.1889

paulpv avatar Aug 23 '22 23:08 paulpv

See https://github.com/NightVsKnight/vst.net/commit/855f6291e2134c3554a93be10f864b1868ced7f3

It returns non-400x300 rect when queried in OnLoad, which appears to be the more appropriate place to resize the control.

paulpv avatar Aug 23 '22 23:08 paulpv

My guess is that this plugin just returns 400x300 as a default value until it has initialized fully. I have enhanced the Host Sample to implement a more robust Window Size handling of the plugin editor window. The EditorGetRect call after the plugin has initialize yield more sensible values. I have also forwarded the SizeWindow call on the host command stub to the EditorFrame. This would allow dynamically sizing plugin editors to adjust the containing editor window.

obiwanjacobi avatar Dec 01 '22 09:12 obiwanjacobi