mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
internal/uidriver/glfw: Bug fix: FPS is dropped when pressing the green button
Updates #1745
This commit is contained in:
parent
1a7cf7b3b8
commit
188e80d2f7
@ -776,6 +776,8 @@ func (u *UserInterface) registerWindowSetSizeCallback() {
|
||||
return
|
||||
}
|
||||
|
||||
u.adjustViewSize()
|
||||
|
||||
if u.window.GetAttrib(glfw.Resizable) == glfw.False {
|
||||
return
|
||||
}
|
||||
@ -1228,6 +1230,8 @@ func (u *UserInterface) setWindowSize(width, height int, fullscreen bool) {
|
||||
|
||||
windowRecreated := u.setWindowSizeImpl(width, height, fullscreen)
|
||||
|
||||
u.adjustViewSize()
|
||||
|
||||
// As width might be updated, update windowWidth/Height here.
|
||||
u.windowWidth = width
|
||||
u.windowHeight = height
|
||||
|
@ -63,17 +63,24 @@ package glfw
|
||||
// if (!origResizable) {
|
||||
// window.styleMask &= ~NSWindowStyleMaskResizable;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// static void adjustViewSize(uintptr_t windowPtr) {
|
||||
// NSWindow* window = (NSWindow*)windowPtr;
|
||||
// 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
|
||||
// CGSize windowSize = [window frame].size;
|
||||
// NSView* view = [window contentView];
|
||||
// CGSize size = [view frame].size;
|
||||
// size.width--;
|
||||
// [view setFrameSize:size];
|
||||
// CGSize viewSize = [view frame].size;
|
||||
// if (windowSize.width != viewSize.width || windowSize.height != viewSize.height) {
|
||||
// return;
|
||||
// }
|
||||
// viewSize.width--;
|
||||
// [view setFrameSize:viewSize];
|
||||
//
|
||||
// // NSColor.blackColor (0, 0, 0, 1) didn't work.
|
||||
// // Use the transparent color instead.
|
||||
@ -179,3 +186,7 @@ func (u *UserInterface) setNativeFullscreen(fullscreen bool) {
|
||||
glfw.WaitEventsTimeout(1)
|
||||
C.setNativeFullscreen(C.uintptr_t(u.window.GetCocoaWindow()), C.bool(fullscreen))
|
||||
}
|
||||
|
||||
func (u *UserInterface) adjustViewSize() {
|
||||
C.adjustViewSize(C.uintptr_t(u.window.GetCocoaWindow()))
|
||||
}
|
||||
|
@ -156,3 +156,6 @@ func (u *UserInterface) isNativeFullscreenAvailable() bool {
|
||||
func (u *UserInterface) setNativeFullscreen(fullscreen bool) {
|
||||
panic(fmt.Sprintf("glfw: setNativeFullscreen is not implemented in this environment: %s", runtime.GOOS))
|
||||
}
|
||||
|
||||
func (u *UserInterface) adjustViewSize() {
|
||||
}
|
||||
|
@ -203,3 +203,6 @@ func (u *UserInterface) isNativeFullscreenAvailable() bool {
|
||||
func (u *UserInterface) setNativeFullscreen(fullscreen bool) {
|
||||
panic(fmt.Sprintf("glfw: setNativeFullscreen is not implemented in this environment: %s", runtime.GOOS))
|
||||
}
|
||||
|
||||
func (u *UserInterface) adjustViewSize() {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user