Hide 'fullscreen' button on OSX native windowbar


#1

I added this to NSViewComponentPeer to hide the fullscreen button on the native window bar of OSX.
It works so i'm happy but is there a more elegant way  to do this?

 

    void hideFullscreenButton()
    {

        NSButton *button = [window standardWindowButton:NSWindowFullScreenButton];

        [button removeFromSuperview];

    }

#2

Actually this version is better, because the previous method would somehow magically disables the resize cursor in the top right of the window bar.

        NSButton *button = [window standardWindowButton:NSWindowFullScreenButton];
        [button setHidden:YES];
        button.alphaValue = 0.0;
        [button setEnabled:NO];
        button.image = nil;
        button.alternateImage = nil;

#3

There's no need to do all that! If you're using DocumentWindow, then you can use the DocumentWindow::maximiseButton flag to choose whether you want the button.


#4

Hi Jules,
I'm referring to the fullscreen button  (since 10.8?) see attachment, not the maximize button.
I noticed when i disable the maximize button by not including it in the document buttons the fullscreen button also dissapears.
But that's not what i want, i want to keep all the buttons by specifying DocumentWindow::allButtons but i don't want the fullscreen button.
That's something that can't be done atm.
Our app supports multi monitor, this fancy fullscreen apple button doesn't work with multi monitor apps, that's why i don't want to show it.


#5

Yes, that's what I was talking about too - I tested it to make sure, and removing that flag does seem to do what you want. So I'm not quite sure what you mean about it not working..


#6

Hmmm,
I used DocumentWindow::minimiseButton | DocumentWindow::closeButton for the buttons and that indeed seems to be working.
But i thought that maximize button was referring to the (+) button and not that fullscreen button in the right hand top corner.
I mean that maximiseButton flag is around much longer than that fullscreen button that was introduced in 10.8, or am i wrong?
 


#7

Yes, it did originally refer to the green button on OSX, but it makes more sense to use the flag for kiosk mode, since the green button on OSX it only resizes the window, it doesn't put it into a different mode like the maximise button on Windows, so if your window is resizable at all, you'd probably always want the green button there too.


#8

The only downside of your solution is that i need to specify different window flags on Windows. Otherwise the Maxmize button will be disabled on windows.


#9

Yes, that's true, though I've always found that I end up needing a bunch of platform-specific code for setting up windows anyway, as there are other differences that always seem to need tweaking.