-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to a "more macOS" fullscreen mode (#5453)
Also fixes flickering and reported screen size issues (cannot find the number) More info at glfw/glfw#2660
- Loading branch information
1 parent
bb1657e
commit e4211e5
Showing
4 changed files
with
52 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <AppKit/AppKit.h> | ||
|
||
void setFullScreen(bool full, void *win) { | ||
NSWindow *window = (NSWindow*)win; | ||
|
||
NSUInteger masks = [window styleMask]; | ||
bool isFull = masks & NSWindowStyleMaskFullScreen; | ||
if (isFull == full) { | ||
return; | ||
} | ||
|
||
[window toggleFullScreen:NULL]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//go:build !darwin | ||
|
||
package glfw | ||
|
||
func (w *window) doSetFullScreen(full bool) { | ||
monitor := w.getMonitorForWindow() | ||
mode := monitor.GetVideoMode() | ||
|
||
if full { | ||
w.viewport.SetMonitor(monitor, 0, 0, mode.Width, mode.Height, mode.RefreshRate) | ||
} else { | ||
if w.width == 0 && w.height == 0 { // if we were fullscreen on creation... | ||
s := w.canvas.Size().Max(w.canvas.MinSize()) | ||
w.width, w.height = w.screenSize(s) | ||
} | ||
w.viewport.SetMonitor(nil, w.xpos, w.ypos, w.width, w.height, 0) | ||
} | ||
} |