Plugin host mouse clicks


#1

Hmmmm … I just noticed that my VST host no longer passes mouse events properly to the plugins.

After scouring my code for a few hours I compiled the juce demo VST host and found that it has the same issue. Oddly, the prebuilt does not though (guessing that the prebuilt may not be using the tip though, so this make sense, since this is a new issue).

The plugins I am using are AU … probably carbon … so I am guessing that it is an issue in the carbon wrapper. Whatever the case, it definitely passed the mouse clicks as late as a couple months ago, but does not currently.


#2

This is a strange one - I made a change last month to the event handling, but can’t for the life of me remember why the hell I did it… I think someone must have contributed it, but I can’t find an email or forum post discussing it… Anyway, I can’t try this out myself right now, but how about this change, in juce_mac_CarbonViewWrapperComponent.h?

[code] OSStatus carbonEventHandler (EventHandlerCallRef /nextHandlerRef/,
EventRef event)
{
switch (GetEventKind (event))
{
case kEventWindowHandleDeactivate:
ActivateWindow (wrapperWindow, TRUE);
return noErr;

        case kEventWindowGetClickActivation:
        {
            getTopLevelComponent()->toFront (false);

            ClickActivationResult howToHandleClick = kActivateAndHandleClick;

            SetEventParameter (event, kEventParamClickActivation, typeClickActivationResult,
                               sizeof (ClickActivationResult), &howToHandleClick);

            HIViewSetNeedsDisplay (embeddedView, true);
            return noErr;
        }
    }

    return eventNotHandledErr;
}

[/code]


#3

That’s the one, looking good, thanks.

Here’s another quick fix for yah too … (from juce_atomics.h)

[code]
template
inline Type Atomic::get() const throw()
{
#if JUCE_ATOMICS_MAC
return sizeof (Type) == 4 ? castFrom32Bit ((int32) OSAtomicAdd32Barrier (0, (volatile int32_t*) &value))
: castFrom64Bit ((int64) OSAtomicAdd64Barrier (0, (volatile int64_t*) &value));

      ...

#endif
}[/code]

Which needs tweaked so that macs know the 0 is type in64_t (or you get an undefined function error).

[code]
template
inline Type Atomic::get() const throw()
{
#if JUCE_ATOMICS_MAC
return sizeof (Type) == 4 ? castFrom32Bit ((int32) OSAtomicAdd32Barrier (0, (volatile int32_t*) &value))
: castFrom64Bit ((int64) OSAtomicAdd64Barrier (int64_t(0), (volatile int64_t*) &value));

      ...

#endif
}[/code]


#4

Ok, thanks!