| @@ -1120,12 +1120,15 @@ public: | |||||
| name: NSWindowWillMiniaturizeNotification | name: NSWindowWillMiniaturizeNotification | ||||
| object: currentWindow]; | object: currentWindow]; | ||||
| #if JUCE_COREGRAPHICS_DRAW_ASYNC | |||||
| [notificationCenter addObserver: view | [notificationCenter addObserver: view | ||||
| selector: becomeKeySelector | selector: becomeKeySelector | ||||
| name: NSWindowDidBecomeKeyNotification | name: NSWindowDidBecomeKeyNotification | ||||
| object: currentWindow]; | object: currentWindow]; | ||||
| #endif | |||||
| [notificationCenter addObserver: view | |||||
| selector: resignKeySelector | |||||
| name: NSWindowDidResignKeyNotification | |||||
| object: currentWindow]; | |||||
| } | } | ||||
| } | } | ||||
| @@ -1140,6 +1143,12 @@ public: | |||||
| component.repaint(); | component.repaint(); | ||||
| } | } | ||||
| void resignKey() | |||||
| { | |||||
| viewFocusLoss(); | |||||
| sendModalInputAttemptIfBlocked(); | |||||
| } | |||||
| void liveResizingStart() | void liveResizingStart() | ||||
| { | { | ||||
| if (constrainer == nullptr) | if (constrainer == nullptr) | ||||
| @@ -1516,6 +1525,7 @@ public: | |||||
| static const SEL asyncMouseDownSelector; | static const SEL asyncMouseDownSelector; | ||||
| static const SEL asyncMouseUpSelector; | static const SEL asyncMouseUpSelector; | ||||
| static const SEL becomeKeySelector; | static const SEL becomeKeySelector; | ||||
| static const SEL resignKeySelector; | |||||
| private: | private: | ||||
| static NSView* createViewInstance(); | static NSView* createViewInstance(); | ||||
| @@ -1691,6 +1701,7 @@ const SEL NSViewComponentPeer::frameChangedSelector = @selector (frameChanged: | |||||
| const SEL NSViewComponentPeer::asyncMouseDownSelector = @selector (asyncMouseDown:); | const SEL NSViewComponentPeer::asyncMouseDownSelector = @selector (asyncMouseDown:); | ||||
| const SEL NSViewComponentPeer::asyncMouseUpSelector = @selector (asyncMouseUp:); | const SEL NSViewComponentPeer::asyncMouseUpSelector = @selector (asyncMouseUp:); | ||||
| const SEL NSViewComponentPeer::becomeKeySelector = @selector (becomeKey:); | const SEL NSViewComponentPeer::becomeKeySelector = @selector (becomeKey:); | ||||
| const SEL NSViewComponentPeer::resignKeySelector = @selector (resignKey:); | |||||
| JUCE_END_IGNORE_WARNINGS_GCC_LIKE | JUCE_END_IGNORE_WARNINGS_GCC_LIKE | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1796,6 +1807,7 @@ struct JuceNSViewClass : public NSViewComponentPeerWrapper<ObjCClass<NSView>> | |||||
| addMethod (NSViewComponentPeer::asyncMouseUpSelector, asyncMouseUp, "v@:@"); | addMethod (NSViewComponentPeer::asyncMouseUpSelector, asyncMouseUp, "v@:@"); | ||||
| addMethod (NSViewComponentPeer::frameChangedSelector, frameChanged, "v@:@"); | addMethod (NSViewComponentPeer::frameChangedSelector, frameChanged, "v@:@"); | ||||
| addMethod (NSViewComponentPeer::becomeKeySelector, becomeKey, "v@:@"); | addMethod (NSViewComponentPeer::becomeKeySelector, becomeKey, "v@:@"); | ||||
| addMethod (NSViewComponentPeer::resignKeySelector, resignKey, "v@:@"); | |||||
| addMethod (@selector (performKeyEquivalent:), performKeyEquivalent, "c@:@"); | addMethod (@selector (performKeyEquivalent:), performKeyEquivalent, "c@:@"); | ||||
| @@ -1862,6 +1874,7 @@ private: | |||||
| static void viewDidMoveToWindow (id self, SEL) { if (auto* p = getOwner (self)) p->viewMovedToWindow(); } | static void viewDidMoveToWindow (id self, SEL) { if (auto* p = getOwner (self)) p->viewMovedToWindow(); } | ||||
| static void dismissModals (id self, SEL) { if (auto* p = getOwner (self)) p->dismissModals(); } | static void dismissModals (id self, SEL) { if (auto* p = getOwner (self)) p->dismissModals(); } | ||||
| static void becomeKey (id self, SEL) { if (auto* p = getOwner (self)) p->becomeKey(); } | static void becomeKey (id self, SEL) { if (auto* p = getOwner (self)) p->becomeKey(); } | ||||
| static void resignKey (id self, SEL) { if (auto* p = getOwner (self)) p->resignKey(); } | |||||
| static BOOL isFlipped (id, SEL) { return true; } | static BOOL isFlipped (id, SEL) { return true; } | ||||