mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
ui: Bug fix: currentMonitorPos returned wrong values on macOS
[NSScreen mainScreen] sometimes returned a wrong screen for the window. Use [[NSApp mainWindow] screen] when possible. Fixes #703
This commit is contained in:
parent
c4a066ecd0
commit
dbe71e81bd
@ -24,7 +24,15 @@ package ui
|
||||
// #import <AppKit/AppKit.h>
|
||||
//
|
||||
// static void currentMonitorPos(int* x, int* y) {
|
||||
// NSDictionary* screenDictionary = [[NSScreen mainScreen] deviceDescription];
|
||||
// NSScreen* screen = [NSScreen mainScreen];
|
||||
// NSWindow* window = [NSApp mainWindow];
|
||||
// if ([window isVisible]) {
|
||||
// // When the window is visible, the window is already initialized.
|
||||
// // [NSScreen mainScreen] sometimes tells a lie when the window is put across monitors (#703).
|
||||
// // Use [[NSApp mainWindow] screen] instead.
|
||||
// screen = [window screen];
|
||||
// }
|
||||
// NSDictionary* screenDictionary = [screen deviceDescription];
|
||||
// NSNumber* screenID = [screenDictionary objectForKey:@"NSScreenNumber"];
|
||||
// CGDirectDisplayID aID = [screenID unsignedIntValue];
|
||||
// const CGRect bounds = CGDisplayBounds(aID);
|
||||
|
Loading…
Reference in New Issue
Block a user