mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-23 22:58:30 +00:00
MacOS: Detect display boundaries so created windows are placed in the right spot.
This commit is contained in:
parent
dad798d41d
commit
049d339643
|
@ -26,6 +26,9 @@ namespace OpenTK.Platform.MacOS.Carbon
|
||||||
[DllImport(appServices,EntryPoint="CGMainDisplayID")]
|
[DllImport(appServices,EntryPoint="CGMainDisplayID")]
|
||||||
internal static extern IntPtr MainDisplayID();
|
internal static extern IntPtr MainDisplayID();
|
||||||
|
|
||||||
|
[DllImport(appServices, EntryPoint = "CGDisplayBounds")]
|
||||||
|
internal unsafe static extern HIRect DisplayBounds(IntPtr display);
|
||||||
|
|
||||||
[DllImport(appServices,EntryPoint="CGDisplayPixelsWide")]
|
[DllImport(appServices,EntryPoint="CGDisplayPixelsWide")]
|
||||||
internal static extern int DisplayPixelsWide(IntPtr display);
|
internal static extern int DisplayPixelsWide(IntPtr display);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Print("CoreGraphics reported {0} displays.", displayCount);
|
Debug.Print("CoreGraphics reported {0} display(s).", displayCount);
|
||||||
Debug.Indent();
|
Debug.Indent();
|
||||||
|
|
||||||
for (int i = 0; i < displayCount; i++)
|
for (int i = 0; i < displayCount; i++)
|
||||||
|
@ -90,8 +90,14 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HIRect bounds = CG.DisplayBounds(currentDisplay);
|
||||||
|
Rectangle newRect = new Rectangle(
|
||||||
|
(int)bounds.Origin.X, (int)bounds.Origin.Y, (int)bounds.Size.Width, (int)bounds.Size.Height);
|
||||||
|
|
||||||
|
Debug.Print("Display {0} bounds: {1}", i, newRect);
|
||||||
|
|
||||||
DisplayDevice opentk_dev =
|
DisplayDevice opentk_dev =
|
||||||
new DisplayDevice(opentk_dev_current_res, primary, opentk_dev_available_res, Rectangle.Empty);
|
new DisplayDevice(opentk_dev_current_res, primary, opentk_dev_available_res, newRect);
|
||||||
|
|
||||||
displayMap.Add(opentk_dev, currentDisplay);
|
displayMap.Add(opentk_dev, currentDisplay);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue