mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
macOS: Set CALayer format to fix Big Sur invalidation region
This commit is contained in:
parent
99112cf71f
commit
8fc1195c35
1 changed files with 13 additions and 0 deletions
|
|
@ -1646,6 +1646,7 @@ struct JuceNSViewClass : public ObjCClass<NSView>
|
|||
addMethod (@selector (wantsDefaultClipping), wantsDefaultClipping, "c@:");
|
||||
addMethod (@selector (worksWhenModal), worksWhenModal, "c@:");
|
||||
addMethod (@selector (viewDidMoveToWindow), viewDidMoveToWindow, "v@:");
|
||||
addMethod (@selector (viewWillDraw), viewWillDraw, "v@:");
|
||||
addMethod (@selector (keyDown:), keyDown, "v@:@");
|
||||
addMethod (@selector (keyUp:), keyUp, "v@:@");
|
||||
addMethod (@selector (insertText:), insertText, "v@:@");
|
||||
|
|
@ -1758,6 +1759,18 @@ private:
|
|||
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 viewWillDraw (id self, SEL)
|
||||
{
|
||||
// Without setting contentsFormat macOS Big Sur will always set the invalid area
|
||||
// to be the entire frame.
|
||||
#if defined (MAC_OS_X_VERSION_10_12) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12
|
||||
CALayer* layer = ((NSView*) self).layer;
|
||||
layer.contentsFormat = kCAContentsFormatRGBA8Uint;
|
||||
#endif
|
||||
|
||||
sendSuperclassMessage<void> (self, @selector (viewWillDraw));
|
||||
}
|
||||
|
||||
static void windowWillMiniaturize (id self, SEL, NSNotification*)
|
||||
{
|
||||
if (auto* p = getOwner (self))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue