1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-21 01:24:21 +00:00

Altered the method by which plugin UIs re-post carbon keyboard events.

This commit is contained in:
jules 2013-10-01 19:54:35 +01:00
parent 8c6caf8853
commit 5818b89b04
5 changed files with 16 additions and 3 deletions

View file

@ -1479,7 +1479,7 @@ private:
lastEventTime = eventTime;
[[hostWindow parentWindow] makeKeyWindow];
[NSApp postEvent: [NSApp currentEvent] atStart: YES];
repostCurrentNSEvent();
}
}

View file

@ -162,7 +162,7 @@ void forwardCurrentKeyEventToHostWindow()
if (! isJuceWindow (w))
{
ActivateWindow (w, true);
[NSApp postEvent: [NSApp currentEvent] atStart: YES];
repostCurrentNSEvent();
}
}

View file

@ -254,7 +254,7 @@ bool forwardCurrentKeyEventToHost (Component* comp)
#else
NSWindow* win = [(NSView*) comp->getWindowHandle() window];
[[win parentWindow] makeKeyWindow];
[NSApp postEvent: [NSApp currentEvent] atStart: YES];
repostCurrentNSEvent();
return true;
#endif
}

View file

@ -29,6 +29,11 @@ using namespace juce;
#if JUCE_MAC && ! DOXYGEN
#define Point juce::Point
#define Component juce::Component
namespace juce
{
void repostCurrentNSEvent();
}
#endif
extern AudioProcessor* JUCE_CALLTYPE createPluginFilterOfType (AudioProcessor::WrapperType);

View file

@ -328,3 +328,11 @@ void MessageManager::broadcastMessage (const String& message)
object: nil
userInfo: info];
}
// Special function used by some plugin classes to re-post carbon events
void repostCurrentNSEvent();
void repostCurrentNSEvent()
{
NSEvent* e = [NSApp currentEvent];
[[NSOperationQueue mainQueue] addOperationWithBlock: ^{ [NSApp postEvent: e atStart: YES]; }];
}