Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.

Commit 1f4070c

Browse files
committed
rejigger the restore logic to bypass restore rect when maximized if the restore rect is off-screen
1 parent 1289548 commit 1f4070c

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

appshell/cef_main_window.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -420,23 +420,23 @@ void cef_main_window::RestoreWindowPlacement(int showCmd)
420420

421421
EnsureWindowRectVisibility(left, top, width, height, SW_SHOWNORMAL);
422422

423-
wp.rcNormalPosition.left = left;
424-
wp.rcNormalPosition.top = top;
423+
// presumably they would all be set to CW_USEDEFAULT
424+
// but we check for any out-of-bounds value and
425+
// bypass the restore rect as to let Windows decide
426+
if (left != CW_USEDEFAULT &&
427+
top != CW_USEDEFAULT &&
428+
height != CW_USEDEFAULT &&
429+
width != CW_USEDEFAULT) {
425430

426-
if (width != CW_USEDEFAULT) {
427-
wp.rcNormalPosition.right = wp.rcNormalPosition.left + width;
428-
} else {
429-
wp.rcNormalPosition.right = CW_USEDEFAULT;
430-
}
431+
wp.rcNormalPosition.left = left;
432+
wp.rcNormalPosition.top = top;
431433

432-
if (height != CW_USEDEFAULT) {
434+
wp.rcNormalPosition.right = wp.rcNormalPosition.left + width;
433435
wp.rcNormalPosition.bottom = wp.rcNormalPosition.top + height;
434-
} else {
435-
wp.rcNormalPosition.bottom = CW_USEDEFAULT;
436-
}
437436

438-
// This returns FALSE on failure but not sure what we could do in that case
439-
SetWindowPlacement(&wp);
437+
// This returns FALSE on failure but not sure what we could do in that case
438+
SetWindowPlacement(&wp);
439+
}
440440
}
441441

442442
ShowWindow(showCmd);

0 commit comments

Comments
 (0)