internal/uidriver/glfw: Fix unstable FPS on fullscreen on macOS

FPS was unstable on fullscreen mode i.e., when the view size is the
same as the monitor size.

By using a little different size view, FPS becomes stable.

Updates #1745
This commit is contained in:
Hajime Hoshi 2021-09-18 19:20:45 +09:00
parent 11b9a4b161
commit 7be00d79e8
2 changed files with 16 additions and 1 deletions

View File

@ -45,7 +45,7 @@ func (v *view) update() {
func (v *view) usePresentsWithTransaction() bool { func (v *view) usePresentsWithTransaction() bool {
// Disable presentsWithTransaction on the fullscreen mode (#1745). // Disable presentsWithTransaction on the fullscreen mode (#1745).
return !v.vsyncDisabled && !v.fullscreen return !v.vsyncDisabled
} }
func (v *view) maximumDrawableCount() int { func (v *view) maximumDrawableCount() int {

View File

@ -63,6 +63,21 @@ package glfw
// if (!origResizable) { // if (!origResizable) {
// window.styleMask &= ~NSWindowStyleMaskResizable; // window.styleMask &= ~NSWindowStyleMaskResizable;
// } // }
//
// if ((window.styleMask & NSWindowStyleMaskFullScreen) == 0) {
// return;
// }
//
// // Reduce the view height (#1745).
// // https://stackoverflow.com/questions/27758027/sprite-kit-serious-fps-issue-in-full-screen-mode-on-os-x
// NSView* view = [window contentView];
// CGSize size = [view frame].size;
// size.width--;
// [view setFrameSize:size];
//
// // NSColor.blackColor (0, 0, 0, 1) didn't work.
// // Use the transparent color instead.
// [window setBackgroundColor: [NSColor colorWithSRGBRed:0 green:0 blue:0 alpha:0]];
// } // }
// //
// static void setNativeCursor(int cursorID) { // static void setNativeCursor(int cursorID) {