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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u.adjustViewSize()
|
||||||
|
|
||||||
if u.window.GetAttrib(glfw.Resizable) == glfw.False {
|
if u.window.GetAttrib(glfw.Resizable) == glfw.False {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1228,6 +1230,8 @@ func (u *UserInterface) setWindowSize(width, height int, fullscreen bool) {
|
|||||||
|
|
||||||
windowRecreated := u.setWindowSizeImpl(width, height, fullscreen)
|
windowRecreated := u.setWindowSizeImpl(width, height, fullscreen)
|
||||||
|
|
||||||
|
u.adjustViewSize()
|
||||||
|
|
||||||
// As width might be updated, update windowWidth/Height here.
|
// As width might be updated, update windowWidth/Height here.
|
||||||
u.windowWidth = width
|
u.windowWidth = width
|
||||||
u.windowHeight = height
|
u.windowHeight = height
|
||||||
|
@ -63,17 +63,24 @@ package glfw
|
|||||||
// if (!origResizable) {
|
// if (!origResizable) {
|
||||||
// window.styleMask &= ~NSWindowStyleMaskResizable;
|
// window.styleMask &= ~NSWindowStyleMaskResizable;
|
||||||
// }
|
// }
|
||||||
|
// }
|
||||||
//
|
//
|
||||||
|
// static void adjustViewSize(uintptr_t windowPtr) {
|
||||||
|
// NSWindow* window = (NSWindow*)windowPtr;
|
||||||
// if ((window.styleMask & NSWindowStyleMaskFullScreen) == 0) {
|
// if ((window.styleMask & NSWindowStyleMaskFullScreen) == 0) {
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // Reduce the view height (#1745).
|
// // Reduce the view height (#1745).
|
||||||
// // https://stackoverflow.com/questions/27758027/sprite-kit-serious-fps-issue-in-full-screen-mode-on-os-x
|
// // 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];
|
// NSView* view = [window contentView];
|
||||||
// CGSize size = [view frame].size;
|
// CGSize viewSize = [view frame].size;
|
||||||
// size.width--;
|
// if (windowSize.width != viewSize.width || windowSize.height != viewSize.height) {
|
||||||
// [view setFrameSize:size];
|
// return;
|
||||||
|
// }
|
||||||
|
// viewSize.width--;
|
||||||
|
// [view setFrameSize:viewSize];
|
||||||
//
|
//
|
||||||
// // NSColor.blackColor (0, 0, 0, 1) didn't work.
|
// // NSColor.blackColor (0, 0, 0, 1) didn't work.
|
||||||
// // Use the transparent color instead.
|
// // Use the transparent color instead.
|
||||||
@ -179,3 +186,7 @@ func (u *UserInterface) setNativeFullscreen(fullscreen bool) {
|
|||||||
glfw.WaitEventsTimeout(1)
|
glfw.WaitEventsTimeout(1)
|
||||||
C.setNativeFullscreen(C.uintptr_t(u.window.GetCocoaWindow()), C.bool(fullscreen))
|
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) {
|
func (u *UserInterface) setNativeFullscreen(fullscreen bool) {
|
||||||
panic(fmt.Sprintf("glfw: setNativeFullscreen is not implemented in this environment: %s", runtime.GOOS))
|
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) {
|
func (u *UserInterface) setNativeFullscreen(fullscreen bool) {
|
||||||
panic(fmt.Sprintf("glfw: setNativeFullscreen is not implemented in this environment: %s", runtime.GOOS))
|
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