Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/** Switch to full screen mode on OSX 10.7
* @return Whether we switched to full screen
*/
bool WindowQuartzSubdriver::ToggleFullscreen(bool fullscreen)
{
if (this->IsFullscreen() == fullscreen) return true;
if ([ this->window respondsToSelector:@selector(toggleFullScreen:) ]) {
if (fullscreen) {
[ NSApp setPresentationOptions:(NSApplicationPresentationHideMenuBar | NSApplicationPresentationHideDock) ];
} else {
[ NSApp setPresentationOptions:NSApplicationPresentationDefault ];
}
[ this->window performSelector:@selector(toggleFullScreen:) withObject:this->window ];
return true;
}
return false;
}
@michicc

This comment has been minimized.

Copy link

@michicc michicc commented Jan 3, 2021

/** Switch to full screen mode on OSX 10.7
 * @return Whether we switched to full screen
 */
bool WindowQuartzSubdriver::ToggleFullscreen(bool fullscreen)
{
	if (this->IsFullscreen() == fullscreen) return true;

	if ([ this->window respondsToSelector:@selector(toggleFullScreen:) ]) {
		if (fullscreen) [ NSApp setPresentationOptions:(NSApplicationPresentationHideMenuBar | NSApplicationPresentationHideDock) ];
		[ this->window performSelector:@selector(toggleFullScreen:) withObject:this->window ];
		if (!fullscreen) [ NSApp setPresentationOptions:NSApplicationPresentationDefault ];
		return true;
	}

	return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment