Julien Lebosquain
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
8 additions and
7 deletions
-
src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs
-
src/Windows/Avalonia.Win32/ScreenImpl.cs
|
|
|
@ -1631,7 +1631,7 @@ namespace Avalonia.Win32.Interop |
|
|
|
public static extern IntPtr MonitorFromPoint(POINT pt, MONITOR dwFlags); |
|
|
|
|
|
|
|
[DllImport("user32.dll")] |
|
|
|
public static extern IntPtr MonitorFromRect(RECT rect, MONITOR dwFlags); |
|
|
|
public static extern IntPtr MonitorFromRect(RECT* rect, MONITOR dwFlags); |
|
|
|
|
|
|
|
[DllImport("user32.dll")] |
|
|
|
public static extern IntPtr MonitorFromWindow(IntPtr hwnd, MONITOR dwFlags); |
|
|
|
|
|
|
|
@ -70,13 +70,14 @@ internal unsafe class ScreenImpl : ScreensBase<nint, WinScreen> |
|
|
|
|
|
|
|
protected override Screen? ScreenFromRectCore(PixelRect rect) |
|
|
|
{ |
|
|
|
var monitor = MonitorFromRect(new RECT |
|
|
|
var r = new RECT |
|
|
|
{ |
|
|
|
left = rect.TopLeft.X, |
|
|
|
top = rect.TopLeft.Y, |
|
|
|
right = rect.TopRight.X, |
|
|
|
bottom = rect.BottomRight.Y |
|
|
|
}, UnmanagedMethods.MONITOR.MONITOR_DEFAULTTONULL); |
|
|
|
left = rect.X, |
|
|
|
top = rect.Y, |
|
|
|
right = rect.Right, |
|
|
|
bottom = rect.Bottom |
|
|
|
}; |
|
|
|
var monitor = MonitorFromRect(&r, MONITOR.MONITOR_DEFAULTTONULL); |
|
|
|
|
|
|
|
return ScreenFromHMonitor(monitor); |
|
|
|
} |
|
|
|
|