mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 07:17:13 -06:00
Windows: fixed wrong layout in maximized frame after changing screen scale factor (issue #904)
Windows binaries built and signed locally in clean workspace
This commit is contained in:
@@ -288,6 +288,23 @@ LRESULT CALLBACK FlatWndProc::WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, L
|
||||
isMoving = true;
|
||||
break;
|
||||
|
||||
case WM_DPICHANGED: {
|
||||
LRESULT lResult = ::CallWindowProc( defaultWndProc, hwnd, uMsg, wParam, lParam );
|
||||
|
||||
// if window is maximized and DPI/scaling changed, then Windows
|
||||
// does not send a subsequent WM_SIZE message and Java window bounds,
|
||||
// which depend on scale factor, are not updated
|
||||
bool isMaximized = ::IsZoomed( hwnd );
|
||||
if( isMaximized ) {
|
||||
RECT* r = reinterpret_cast<RECT*>( lParam );
|
||||
int width = r->right - r->left;
|
||||
int height = r->bottom - r->top;
|
||||
::CallWindowProc( defaultWndProc, hwnd, WM_SIZE, SIZE_MAXIMIZED, MAKELPARAM( width, height ) );
|
||||
}
|
||||
|
||||
return lResult;
|
||||
}
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
// do not erase background while the user is moving the window,
|
||||
// otherwise there may be rendering artifacts on HiDPI screens with Java 9+
|
||||
|
||||
Reference in New Issue
Block a user