mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-28 19:22:50 +02:00
win32: return normal size for minimized windows in GetWindowSize() - fixes issue #0021508
git-svn-id: trunk@36184 -
This commit is contained in:
parent
5a475a393d
commit
a152f6fb8f
@ -2286,21 +2286,22 @@ var
|
||||
Dec(Height, Windows.GetSystemMetrics(SM_CYCAPTION));
|
||||
end;
|
||||
|
||||
begin
|
||||
procedure SetWidthHeightFromRect(const R: TRect); inline;
|
||||
begin
|
||||
with R do
|
||||
begin
|
||||
Width := Right - Left;
|
||||
Height := Bottom - Top;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
WP.length := SizeOf(WP);
|
||||
Result := Boolean(Windows.GetWindowPlacement(Handle, WP));
|
||||
|
||||
if not Result then
|
||||
Exit;
|
||||
|
||||
if (WP.showCmd = SW_MINIMIZE) or (WP.showCmd = SW_SHOWMINIMIZED) then
|
||||
begin
|
||||
Width := 0;
|
||||
Height := 0;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// if it is a top level window then you can't use the normal size:
|
||||
// maximized or aero snap windows will have problems
|
||||
if (GetWindowLong(Handle, GWL_STYLE) and WS_CHILD = 0) then
|
||||
@ -2310,30 +2311,27 @@ begin
|
||||
Result := GetWindowInfo(Handle, @Info);
|
||||
if Result then
|
||||
begin
|
||||
with Info.rcWindow do
|
||||
begin
|
||||
Width := Right - Left;
|
||||
Height := Bottom - Top;
|
||||
end;
|
||||
// for minimized window use normal position, in other case use rcWindow of WindowInfo
|
||||
if (WP.showCmd = SW_MINIMIZE) or (WP.showCmd = SW_SHOWMINIMIZED) then
|
||||
SetWidthHeightFromRect(WP.rcNormalPosition)
|
||||
else
|
||||
SetWidthHeightFromRect(Info.rcWindow);
|
||||
Width := Width - 2 * Integer(Info.cxWindowBorders);
|
||||
Height := Height - 2 * Integer(Info.cyWindowBorders);
|
||||
ExcludeCaption;
|
||||
//WriteLn('W = ', Width, ' H = ', Height);
|
||||
Exit;
|
||||
end;
|
||||
Result := Boolean(Windows.GetWindowRect(Handle, @R));
|
||||
with R do
|
||||
if (WP.showCmd = SW_MINIMIZE) or (WP.showCmd = SW_SHOWMINIMIZED) then
|
||||
SetWidthHeightFromRect(WP.rcNormalPosition)
|
||||
else
|
||||
begin
|
||||
Width := Right - Left;
|
||||
Height := Bottom - Top;
|
||||
Result := Boolean(Windows.GetWindowRect(Handle, @R));
|
||||
SetWidthHeightFromRect(R);
|
||||
end;
|
||||
end
|
||||
else
|
||||
with WP.rcNormalPosition do
|
||||
begin
|
||||
Width := Right - Left;
|
||||
Height := Bottom - Top;
|
||||
end;
|
||||
SetWidthHeightFromRect(WP.rcNormalPosition);
|
||||
|
||||
WindowInfo := GetWin32WindowInfo(Handle);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user