Skip to content

Commit

Permalink
IAudioPluginView.CheckSizeConstraint parameter ViewRectangle needs to…
Browse files Browse the repository at this point in the history
… be passed as ref (#9)

* IAudioPluginView.CheckSizeConstraint parameter ViewRectangle needs to be pass as ref

* Removed refs from Unmanaged as they are pointers.

Removed refs from Unmanaged as they are pointers.  Thanks @xoofx
  • Loading branch information
jwb-music authored Nov 24, 2024
1 parent eb444ee commit d10a72f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/NPlug/IAudioPluginView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
// Licensed under the BSD-Clause 2 license.
// See license.txt file in the project root for full license information.

using NPlug.Interop;
using System.Runtime.InteropServices;
using static NPlug.Interop.LibVst;

namespace NPlug;

/// <summary>
Expand Down Expand Up @@ -67,7 +63,7 @@ public interface IAudioPluginView
/// Handling of mouse wheel.
/// </summary>
void OnWheel(float distance);

/// <summary>
/// Handling of keyboard events : Key Down.
/// </summary>
Expand Down Expand Up @@ -97,7 +93,7 @@ public interface IAudioPluginView
/// requests a resize (IPlugFrame::resizeView ()) onSize has to be called afterward.
/// </summary>
void OnSize(ViewRectangle newSize);

/// <summary>
/// Focus changed message.
/// </summary>
Expand All @@ -117,7 +113,7 @@ public interface IAudioPluginView
/// On live resize this is called to check if the view can be resized to the given rect, if not
/// adjust the rect to the allowed size.
/// </summary>
bool CheckSizeConstraint(ViewRectangle rect);
bool CheckSizeConstraint(ref ViewRectangle rect);

/// <summary>
/// This interface communicates the content scale factor from the host to the plug-in view on
Expand Down
2 changes: 1 addition & 1 deletion src/NPlug/Interop/LibVst.IPlugView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private static partial ComResult canResize_ToManaged(IPlugView* self)

private static partial ComResult checkSizeConstraint_ToManaged(IPlugView* self, ViewRect* rect)
{
return Get(self).CheckSizeConstraint(*(ViewRectangle*)rect);
return Get(self).CheckSizeConstraint(ref *(ViewRectangle*)rect);
}

private static bool TryGetPlatform(FIDString type, out AudioPluginViewPlatform platform)
Expand Down

0 comments on commit d10a72f

Please sign in to comment.