Browse Source
Merge pull request #8365 from ltetak/feature/borders_different_dpis
OffScreenMargin calculation with different DPI monitors calculation
pull/8404/head
Max Katz
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
1 deletions
-
src/Windows/Avalonia.Win32/WindowImpl.cs
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.Linq; |
|
|
|
using System.Runtime.InteropServices; |
|
|
|
using Avalonia.Controls; |
|
|
|
using Avalonia.Automation.Peers; |
|
|
|
@ -208,6 +209,8 @@ namespace Avalonia.Win32 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private double PrimaryScreenRenderScaling => Screen.AllScreens.FirstOrDefault(screen => screen.Primary)?.PixelDensity ?? 1; |
|
|
|
|
|
|
|
public double RenderScaling => _scaling; |
|
|
|
|
|
|
|
public double DesktopScaling => RenderScaling; |
|
|
|
@ -944,7 +947,7 @@ namespace Avalonia.Win32 |
|
|
|
if (WindowState == WindowState.Maximized) |
|
|
|
{ |
|
|
|
_extendedMargins = new Thickness(0, (borderCaptionThickness.top - borderThickness.top) / RenderScaling, 0, 0); |
|
|
|
_offScreenMargin = new Thickness(borderThickness.left / RenderScaling, borderThickness.top / RenderScaling, borderThickness.right / RenderScaling, borderThickness.bottom / RenderScaling); |
|
|
|
_offScreenMargin = new Thickness(borderThickness.left / PrimaryScreenRenderScaling, borderThickness.top / PrimaryScreenRenderScaling, borderThickness.right / PrimaryScreenRenderScaling, borderThickness.bottom / PrimaryScreenRenderScaling); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|