Revert "Ensure the window origin is visible after DPI change"

This reverts commit 75284bb8f0 because it
doesn't always use the right window: at least under Windows 11 25H2 it
is possible that the center of the window is still on the old display
when we receive WM_DPICHANGED and so the window is moved to a wrong
position because of the check added in that commit.

Because this check was mostly needed to work around other issues that
made the window become too big, it seems better to revert it rather than
break something that worked correctly before.

See #26604.
This commit is contained in:
Vadim Zeitlin
2026-06-30 22:19:58 +02:00
parent 7b2bc588e3
commit 46cd33e2be
-9
View File
@@ -34,7 +34,6 @@
#include "wx/graphics.h"
#endif // wxUSE_GRAPHICS_CONTEXT
#include "wx/display.h"
#include "wx/dynlib.h"
#include "wx/msw/missing.h"
#include "wx/msw/private/darkmode.h"
@@ -339,14 +338,6 @@ bool wxNonOwnedWindow::HandleDPIChange(const wxSize& newDPI, const wxRect& newRe
// which it might have been just moved to this one, as doing this
// would result in an infinite stream of WM_DPICHANGED messages.
actualNewRect.Inflate(diff / 2);
// However still ensure that the window origin is visible on its
// display, we don't move to move it out of visible space.
const wxRect screenRect = wxDisplay(this).GetClientArea();
if ( actualNewRect.x < screenRect.x )
actualNewRect.x = screenRect.x;
if ( actualNewRect.y < screenRect.y )
actualNewRect.y = screenRect.y;
}
SetSize(actualNewRect);