mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
LV2 Host: Avoid sending resize events back to the plugin if they originated from the plugin
This commit is contained in:
parent
648a7bcecc
commit
e57dac4a63
1 changed files with 24 additions and 5 deletions
|
|
@ -464,6 +464,7 @@ public:
|
||||||
|
|
||||||
void resized() override
|
void resized() override
|
||||||
{
|
{
|
||||||
|
const ScopedValueSetter scope { resizingSelf, true };
|
||||||
viewComponent.setBounds (getLocalBounds());
|
viewComponent.setBounds (getLocalBounds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -471,6 +472,9 @@ public:
|
||||||
{
|
{
|
||||||
// If the editor changed size as a result of a request from the client,
|
// If the editor changed size as a result of a request from the client,
|
||||||
// we shouldn't send a notification back to the client.
|
// we shouldn't send a notification back to the client.
|
||||||
|
if (resizeFromClient)
|
||||||
|
return;
|
||||||
|
|
||||||
if (uiInstance != nullptr)
|
if (uiInstance != nullptr)
|
||||||
{
|
{
|
||||||
if (resizeClient.valid && resizeClient.extension.ui_resize != nullptr)
|
if (resizeClient.valid && resizeClient.extension.ui_resize != nullptr)
|
||||||
|
|
@ -500,6 +504,9 @@ public:
|
||||||
|
|
||||||
void childBoundsChanged (Component* c) override
|
void childBoundsChanged (Component* c) override
|
||||||
{
|
{
|
||||||
|
if (resizingSelf)
|
||||||
|
return;
|
||||||
|
|
||||||
if (c == nullptr)
|
if (c == nullptr)
|
||||||
resizeToFitView();
|
resizeToFitView();
|
||||||
}
|
}
|
||||||
|
|
@ -518,13 +525,16 @@ public:
|
||||||
|
|
||||||
if (optionsInterface.valid)
|
if (optionsInterface.valid)
|
||||||
optionsInterface.extension.set (uiInstance->instance.getHandle(), options);
|
optionsInterface.extension.set (uiInstance->instance.getHandle(), options);
|
||||||
|
|
||||||
applyLastRequestedPhysicalSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void viewRequestedResizeInLogicalPixels (int width, int height) override
|
void viewRequestedResizeInLogicalPixels (int width, int height) override
|
||||||
{
|
{
|
||||||
|
if (resizingSelf)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const ScopedValueSetter scope { resizeFromClient, true };
|
||||||
|
|
||||||
const auto physical = componentToLv2Rect ({ width, height });
|
const auto physical = componentToLv2Rect ({ width, height });
|
||||||
lastPhysicalWidth = physical.getWidth();
|
lastPhysicalWidth = physical.getWidth();
|
||||||
lastPhysicalHeight = physical.getHeight();;
|
lastPhysicalHeight = physical.getHeight();;
|
||||||
|
|
@ -533,6 +543,11 @@ private:
|
||||||
|
|
||||||
void viewRequestedResizeInPhysicalPixels (int width, int height) override
|
void viewRequestedResizeInPhysicalPixels (int width, int height) override
|
||||||
{
|
{
|
||||||
|
if (resizingSelf)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const ScopedValueSetter scope { resizeFromClient, true };
|
||||||
|
|
||||||
lastPhysicalWidth = width;
|
lastPhysicalWidth = width;
|
||||||
lastPhysicalHeight = height;
|
lastPhysicalHeight = height;
|
||||||
const auto logical = lv2ToComponentRect ({ width, height });
|
const auto logical = lv2ToComponentRect ({ width, height });
|
||||||
|
|
@ -568,7 +583,7 @@ private:
|
||||||
float getPeerScale() const
|
float getPeerScale() const
|
||||||
{
|
{
|
||||||
if (auto* peer = getPeer())
|
if (auto* peer = getPeer())
|
||||||
return peer->getPlatformScaleFactor();
|
return (float) peer->getPlatformScaleFactor();
|
||||||
|
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
@ -663,12 +678,15 @@ private:
|
||||||
{
|
{
|
||||||
ConfiguredEditorComponent& window;
|
ConfiguredEditorComponent& window;
|
||||||
|
|
||||||
void operator() (float platformScale) const
|
void operator() (float) const
|
||||||
{
|
{
|
||||||
MessageManager::callAsync ([ref = Component::SafePointer<ConfiguredEditorComponent> (&window), platformScale]
|
MessageManager::callAsync ([ref = Component::SafePointer<ConfiguredEditorComponent> (&window)]
|
||||||
{
|
{
|
||||||
if (auto* r = ref.getComponent())
|
if (auto* r = ref.getComponent())
|
||||||
|
{
|
||||||
r->sendScaleFactorToPlugin();
|
r->sendScaleFactorToPlugin();
|
||||||
|
r->viewComponent.forceViewToSize();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -682,6 +700,7 @@ private:
|
||||||
std::unique_ptr<UiInstanceWithSupports> uiInstance;
|
std::unique_ptr<UiInstanceWithSupports> uiInstance;
|
||||||
OptionalExtension<LV2UI_Resize> resizeClient;
|
OptionalExtension<LV2UI_Resize> resizeClient;
|
||||||
OptionalExtension<LV2_Options_Interface> optionsInterface;
|
OptionalExtension<LV2_Options_Interface> optionsInterface;
|
||||||
|
bool resizingSelf = false, resizeFromClient = false;
|
||||||
PeerChangedListener peerListener { *this, [this]
|
PeerChangedListener peerListener { *this, [this]
|
||||||
{
|
{
|
||||||
applyLastRequestedPhysicalSize();
|
applyLastRequestedPhysicalSize();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue