| @@ -158,7 +158,12 @@ public: | |||||
| object: window]; | object: window]; | ||||
| [notificationCenter addObserver: view | [notificationCenter addObserver: view | ||||
| selector: @selector (frameChanged:) | |||||
| selector: @selector (windowWillMiniaturize:) | |||||
| name: NSWindowWillMiniaturizeNotification | |||||
| object: window]; | |||||
| [notificationCenter addObserver: view | |||||
| selector: @selector (windowDidDeminiaturize:) | |||||
| name: NSWindowDidDeminiaturizeNotification | name: NSWindowDidDeminiaturizeNotification | ||||
| object: window]; | object: window]; | ||||
| } | } | ||||
| @@ -472,10 +477,14 @@ public: | |||||
| bool setAlwaysOnTop (bool alwaysOnTop) override | bool setAlwaysOnTop (bool alwaysOnTop) override | ||||
| { | { | ||||
| if (! isSharedWindow) | if (! isSharedWindow) | ||||
| { | |||||
| [window setLevel: alwaysOnTop ? ((getStyleFlags() & windowIsTemporary) != 0 ? NSPopUpMenuWindowLevel | [window setLevel: alwaysOnTop ? ((getStyleFlags() & windowIsTemporary) != 0 ? NSPopUpMenuWindowLevel | ||||
| : NSFloatingWindowLevel) | : NSFloatingWindowLevel) | ||||
| : NSNormalWindowLevel]; | : NSNormalWindowLevel]; | ||||
| isAlwaysOnTop = alwaysOnTop; | |||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -1394,6 +1403,7 @@ public: | |||||
| bool isZooming = false, isFirstLiveResize = false, textWasInserted = false; | bool isZooming = false, isFirstLiveResize = false, textWasInserted = false; | ||||
| bool isStretchingTop = false, isStretchingLeft = false, isStretchingBottom = false, isStretchingRight = false; | bool isStretchingTop = false, isStretchingLeft = false, isStretchingBottom = false, isStretchingRight = false; | ||||
| bool windowRepresentsFile = false; | bool windowRepresentsFile = false; | ||||
| bool isAlwaysOnTop = false, wasAlwaysOnTop = false; | |||||
| String stringBeingComposed; | String stringBeingComposed; | ||||
| NSNotificationCenter* notificationCenter = nil; | NSNotificationCenter* notificationCenter = nil; | ||||
| @@ -1563,6 +1573,8 @@ struct JuceNSViewClass : public ObjCClass<NSView> | |||||
| addMethod (@selector (magnifyWithEvent:), magnify, "v@:@"); | addMethod (@selector (magnifyWithEvent:), magnify, "v@:@"); | ||||
| addMethod (@selector (acceptsFirstMouse:), acceptsFirstMouse, "c@:@"); | addMethod (@selector (acceptsFirstMouse:), acceptsFirstMouse, "c@:@"); | ||||
| addMethod (@selector (frameChanged:), frameChanged, "v@:@"); | addMethod (@selector (frameChanged:), frameChanged, "v@:@"); | ||||
| addMethod (@selector (windowWillMiniaturize:), windowWillMiniaturize, "v@:@"); | |||||
| addMethod (@selector (windowDidDeminiaturize:), windowDidDeminiaturize, "v@:@"); | |||||
| addMethod (@selector (wantsDefaultClipping:), wantsDefaultClipping, "c@:"); | addMethod (@selector (wantsDefaultClipping:), wantsDefaultClipping, "c@:"); | ||||
| addMethod (@selector (worksWhenModal), worksWhenModal, "c@:"); | addMethod (@selector (worksWhenModal), worksWhenModal, "c@:"); | ||||
| addMethod (@selector (viewDidMoveToWindow), viewDidMoveToWindow, "v@:"); | addMethod (@selector (viewDidMoveToWindow), viewDidMoveToWindow, "v@:"); | ||||
| @@ -1658,6 +1670,32 @@ private: | |||||
| static void frameChanged (id self, SEL, NSNotification*) { if (auto* p = getOwner (self)) p->redirectMovedOrResized(); } | static void frameChanged (id self, SEL, NSNotification*) { if (auto* p = getOwner (self)) p->redirectMovedOrResized(); } | ||||
| 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 windowWillMiniaturize (id self, SEL, NSNotification*) | |||||
| { | |||||
| if (auto* p = getOwner (self)) | |||||
| { | |||||
| if (p->isAlwaysOnTop) | |||||
| { | |||||
| // there is a bug when restoring minimised always on top windows so we need | |||||
| // to remove this behaviour before minimising and restore it afterwards | |||||
| p->setAlwaysOnTop (false); | |||||
| p->wasAlwaysOnTop = true; | |||||
| } | |||||
| } | |||||
| } | |||||
| static void windowDidDeminiaturize (id self, SEL, NSNotification*) | |||||
| { | |||||
| if (auto* p = getOwner (self)) | |||||
| { | |||||
| if (p->wasAlwaysOnTop) | |||||
| { | |||||
| p->setAlwaysOnTop (true); | |||||
| p->redirectMovedOrResized(); | |||||
| } | |||||
| } | |||||
| } | |||||
| static BOOL isOpaque (id self, SEL) | static BOOL isOpaque (id self, SEL) | ||||
| { | { | ||||
| auto* owner = getOwner (self); | auto* owner = getOwner (self); | ||||