mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-12 13:35:39 +02:00
undo speculative dpi awareness check
This commit is contained in:
parent
3c3b6b49db
commit
3aa6fb17e9
2 changed files with 2 additions and 17 deletions
|
@ -39,7 +39,6 @@ namespace PersistentWindows.Common.Models
|
||||||
public RECT ScreenPosition { get; set; }
|
public RECT ScreenPosition { get; set; }
|
||||||
public WindowPlacement WindowPlacement { get; set; }
|
public WindowPlacement WindowPlacement { get; set; }
|
||||||
public bool NeedUpdateWindowPlacement { get; set; } //non-persistent data used for tmp argument passing only
|
public bool NeedUpdateWindowPlacement { get; set; } //non-persistent data used for tmp argument passing only
|
||||||
public uint Dpi { get; set; }
|
|
||||||
|
|
||||||
// window z-order
|
// window z-order
|
||||||
public bool IsTopMost { get; set; }
|
public bool IsTopMost { get; set; }
|
||||||
|
|
|
@ -2010,7 +2010,7 @@ namespace PersistentWindows.Common
|
||||||
{
|
{
|
||||||
if (debugWindows.Contains(hWnd))
|
if (debugWindows.Contains(hWnd))
|
||||||
{
|
{
|
||||||
string log = string.Format("Captured {0,-8} at ({1}, {2}) of size {3} x {4} {5} fullscreen:{6} minimized:{7}, dpi:{8}",
|
string log = string.Format("Captured {0,-8} at ({1}, {2}) of size {3} x {4} {5} fullscreen:{6} minimized:{7}",
|
||||||
curDisplayMetrics,
|
curDisplayMetrics,
|
||||||
curDisplayMetrics.ScreenPosition.Left,
|
curDisplayMetrics.ScreenPosition.Left,
|
||||||
curDisplayMetrics.ScreenPosition.Top,
|
curDisplayMetrics.ScreenPosition.Top,
|
||||||
|
@ -2018,8 +2018,7 @@ namespace PersistentWindows.Common
|
||||||
curDisplayMetrics.ScreenPosition.Height,
|
curDisplayMetrics.ScreenPosition.Height,
|
||||||
curDisplayMetrics.Title,
|
curDisplayMetrics.Title,
|
||||||
curDisplayMetrics.IsFullScreen,
|
curDisplayMetrics.IsFullScreen,
|
||||||
curDisplayMetrics.IsMinimized,
|
curDisplayMetrics.IsMinimized
|
||||||
curDisplayMetrics.Dpi
|
|
||||||
);
|
);
|
||||||
Log.Event(log);
|
Log.Event(log);
|
||||||
|
|
||||||
|
@ -2426,8 +2425,6 @@ namespace PersistentWindows.Common
|
||||||
RECT screenPosition = new RECT();
|
RECT screenPosition = new RECT();
|
||||||
User32.GetWindowRect(hwnd, ref screenPosition);
|
User32.GetWindowRect(hwnd, ref screenPosition);
|
||||||
|
|
||||||
uint dpi = User32.GetDpiForWindow(hwnd);
|
|
||||||
|
|
||||||
bool isMinimized = IsMinimized(hwnd);
|
bool isMinimized = IsMinimized(hwnd);
|
||||||
|
|
||||||
IntPtr realHwnd = hwnd;
|
IntPtr realHwnd = hwnd;
|
||||||
|
@ -2465,7 +2462,6 @@ namespace PersistentWindows.Common
|
||||||
WindowPlacement = windowPlacement,
|
WindowPlacement = windowPlacement,
|
||||||
NeedUpdateWindowPlacement = false,
|
NeedUpdateWindowPlacement = false,
|
||||||
ScreenPosition = screenPosition,
|
ScreenPosition = screenPosition,
|
||||||
Dpi = dpi,
|
|
||||||
|
|
||||||
IsTopMost = IsWindowTopMost(hwnd),
|
IsTopMost = IsWindowTopMost(hwnd),
|
||||||
NeedClearTopMost = false,
|
NeedClearTopMost = false,
|
||||||
|
@ -2605,16 +2601,6 @@ namespace PersistentWindows.Common
|
||||||
}
|
}
|
||||||
else if (!prevDisplayMetrics.ScreenPosition.Equals(curDisplayMetrics.ScreenPosition))
|
else if (!prevDisplayMetrics.ScreenPosition.Equals(curDisplayMetrics.ScreenPosition))
|
||||||
{
|
{
|
||||||
if (prevDisplayMetrics.Dpi > 0 && curDisplayMetrics.Dpi != prevDisplayMetrics.Dpi)
|
|
||||||
{
|
|
||||||
if (curDisplayMetrics.ScreenPosition.Width * curDisplayMetrics.Dpi == prevDisplayMetrics.ScreenPosition.Width * prevDisplayMetrics.Dpi)
|
|
||||||
if (curDisplayMetrics.ScreenPosition.Height * curDisplayMetrics.Dpi == prevDisplayMetrics.ScreenPosition.Height * prevDisplayMetrics.Dpi)
|
|
||||||
{
|
|
||||||
// workaround #289
|
|
||||||
Log.Error($"ignore sudden scale ratio change for {GetWindowTitle(hwnd)}, prev DPI {prevDisplayMetrics.Dpi}, prev location {prevDisplayMetrics.ScreenPosition}, cur DPI {curDisplayMetrics.Dpi}, cur location {curDisplayMetrics.ScreenPosition}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
moved = true;
|
moved = true;
|
||||||
}
|
}
|
||||||
else if (!curDisplayMetrics.IsMinimized && prevDisplayMetrics.IsMinimized)
|
else if (!curDisplayMetrics.IsMinimized && prevDisplayMetrics.IsMinimized)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue