Re: NSWindow styleMask and full screen
Re: NSWindow styleMask and full screen
- Subject: Re: NSWindow styleMask and full screen
- From: Lee Ann Rucker <email@hidden>
- Date: Thu, 19 Jul 2012 19:16:19 -0700 (PDT)
It's an Apple bug - I meant to file it but apparently didn't; I should do that. It's nothing to do with the styleMask; sometimes the window sets the buttonCell's temporarilyDisabled flag and doesn't restore it.
From a comment in my code:
* temporarilyDisabled should only be YES when the menubar is hidden, but sometimes
* the window code gets confused and doesn't reset it for windows that
* were changing state at the same time as the menu.
----- Original Message -----
From: "Gideon King" <email@hidden>
To: "Cocoa-Dev List" <email@hidden>
Sent: Thursday, July 19, 2012 6:54:22 PM
Subject: NSWindow styleMask and full screen
I have an application where sometimes I need to go full screen. While in full screen mode, I need to change the presentation mode so that sometimes the menubar and toolbar are autohiding, and sometimes just not shown. Then when I exit full screen, I reset the values to what they were before I started.
This works fine, except that when I return from full screen, the minimize button is disabled on the window.
So I thought I would record the styleMask of the window before going full screen, and then restore it afterwards.
When I ask for the window's styleMask, I get a value of 4111 which according to the documentation would be an impossible value. If I just use that value for setStyleMask: later in my program, my minimize button is still disabled.
I'm suspecting that Apple must be using the value for other things too, so I thought I would use:
oldStyleMask = [window styleMask];
oldStyleMask = oldStyleMask & (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask|NSTexturedBackgroundWindowMask);
… do stuff …
[window setStyleMask:oldStyleMask];
Now when I use the & statement, I get a value of 15, which matches how the window looks, but setting the style mask back to that value still doesn't enable the minimize button.
I looked around and found a suggestion on stack overflow http://stackoverflow.com/questions/7888308/nswindow-loses-miniaturize-button-on-lion, but the idea there would only be applicable if I was keeping the same application presentation options for the whole time I'm in full screen, which is not the case.
I have the same problem on 10.6, and the proposed workaround linked off stack overflow doesn't work - presumably because I change the application presentation options.
I even thought I would try to be smart and override styleMask with the following:
- (NSUInteger)styleMask {
return [super styleMask]|NSMiniaturizableWindowMask;
}
But even that wouldn't enable the miniaturize button!
Does anyone know of a workaround for this?
TIA
Gideon
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden