surge-synthesizer / conduit

The Surge Synth Team Conduit Plugin Suite
Other
13 stars 4 forks source link

Windows: paint jassert on initializing plugin from HWNDComponentPeer #66

Closed mthierman closed 12 months ago

mthierman commented 12 months ago
void Component::paint (Graphics&)
{
    // if your component is marked as opaque, you must implement a paint
    // method and ensure that its entire area is completely painted.
    jassert (getBounds().isEmpty() || ! isOpaque());
}

Tested in Reaper (VST3 & CLAP) and experimental windows standalone from clap-wrapper

baconpaul commented 12 months ago

i'm so sorry i haven't had a moment to get into windows and review your pr. I will later in the week. apols - some personal stuff has me away from my desk and on laptop.

baconpaul commented 12 months ago

I think, though the fix is to give the window a temporary size before it is resized when it is added to desktop

#elif JUCE_WINDOWS
    impl->editor->setVisible(false);
    impl->editor->setOpaque(true);
    impl->editor->setTopLeftPosition(0, 0);
    impl->editor->addToDesktop(0, (void *)window->win32);
    impl->editor->setVisible(true);
    return true;
#else

that's the code in clap_juce_shim_impl.cpp around line 120.

I bet if before the addToDesktop we did an impl->editor->setSize(1,1,) the assert would vanish. And then we just need to figure out the right moment to get the size and stuff.

mthierman commented 12 months ago

i'm so sorry i haven't had a moment to get into windows and review your pr. I will later in the week. apols - some personal stuff has me away from my desk and on laptop.

No worries!

I think, though the fix is to give the window a temporary size before it is resized when it is added to desktop

#elif JUCE_WINDOWS
    impl->editor->setVisible(false);
    impl->editor->setOpaque(true);
    impl->editor->setTopLeftPosition(0, 0);
    impl->editor->addToDesktop(0, (void *)window->win32);
    impl->editor->setVisible(true);
    return true;
#else

that's the code in clap_juce_shim_impl.cpp around line 120.

I bet if before the addToDesktop we did an impl->editor->setSize(1,1,) the assert would vanish. And then we just need to figure out the right moment to get the size and stuff.

Thanks, I had to setSize and change setOpaque, still jassert but in a different place now. Will keep digging.

mthierman commented 12 months ago

isOpaque() returns true like it should, no problem there. getBounds().isEmpty() always returns false, I can't tell why, doesn't seem to matter where I call setSize() either.

baconpaul commented 12 months ago

Ahh the issue is actually way simpler now i got windows booted

basically: we add the EditorBase directly to the window with no intermediate component. (The shim should not do this and it is why we don't have a place to put our transform for setscale). But the editor base also doesn't implement paint.

If I add

    void paint(juce::Graphics &g)
    {
        g.fillAll(juce::Colours::black);
    }

to editor-base.h then the problem goes away.

I'll get that committed today along with reviewing the windows standalone, now I'm finally booted into windows.

baconpaul commented 12 months ago

should be all fixed now with the new clap-juce-shim