mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08: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>
|
// #import <AppKit/AppKit.h>
|
||||||
//
|
//
|
||||||
// static void currentMonitorPos(int* x, int* y) {
|
// 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"];
|
// NSNumber* screenID = [screenDictionary objectForKey:@"NSScreenNumber"];
|
||||||
// CGDirectDisplayID aID = [screenID unsignedIntValue];
|
// CGDirectDisplayID aID = [screenID unsignedIntValue];
|
||||||
// const CGRect bounds = CGDisplayBounds(aID);
|
// const CGRect bounds = CGDisplayBounds(aID);
|
||||||
|
Loading…
Reference in New Issue
Block a user