win32: don't set minimized window size using SetWindowPos - we need to set the normal window position using SetWindowPlacement

git-svn-id: trunk@29755 -
This commit is contained in:
paul 2011-03-09 03:23:07 +00:00
parent 0f516fc6ef
commit 66766609c8

View File

@ -469,9 +469,13 @@ class procedure TWin32WSWinControl.SetBounds(const AWinControl: TWinControl;
var var
IntfLeft, IntfTop, IntfWidth, IntfHeight: integer; IntfLeft, IntfTop, IntfWidth, IntfHeight: integer;
suppressMove: boolean; suppressMove: boolean;
Handle: HWND;
WindowPlacement: TWINDOWPLACEMENT;
begin begin
IntfLeft := ALeft; IntfTop := ATop; IntfLeft := ALeft;
IntfWidth := AWidth; IntfHeight := AHeight; IntfTop := ATop;
IntfWidth := AWidth;
IntfHeight := AHeight;
LCLBoundsToWin32Bounds(AWinControl, IntfLeft, IntfTop, IntfWidth, IntfHeight); LCLBoundsToWin32Bounds(AWinControl, IntfLeft, IntfTop, IntfWidth, IntfHeight);
{$IFDEF VerboseSizeMsg} {$IFDEF VerboseSizeMsg}
DebugLn('TWin32WSWinControl.ResizeWindow A ', dbgsName(AWinControl), DebugLn('TWin32WSWinControl.ResizeWindow A ', dbgsName(AWinControl),
@ -479,11 +483,20 @@ begin
' Win32=',Format('%d, %d, %d, %d', [IntfLeft,IntfTop,IntfWidth,IntfHeight]) ' Win32=',Format('%d, %d, %d, %d', [IntfLeft,IntfTop,IntfWidth,IntfHeight])
); );
{$ENDIF} {$ENDIF}
suppressMove := false; suppressMove := False;
AdaptBounds(AWinControl, IntfLeft, IntfTop, IntfWidth, IntfHeight, suppressMove); AdaptBounds(AWinControl, IntfLeft, IntfTop, IntfWidth, IntfHeight, suppressMove);
if not suppressMove then if not suppressMove then
Windows.SetWindowPos(AWinControl.Handle, 0, IntfLeft, IntfTop, IntfWidth, IntfHeight, begin
SWP_NOZORDER or SWP_NOACTIVATE); Handle := AWinControl.Handle;
WindowPlacement.length := SizeOf(WindowPlacement);
if IsIconic(Handle) and GetWindowPlacement(Handle, @WindowPlacement) then
begin
WindowPlacement.rcNormalPosition := Bounds(IntfLeft, IntfTop, IntfWidth, IntfHeight);
SetWindowPlacement(Handle, @WindowPlacement);
end
else
Windows.SetWindowPos(Handle, 0, IntfLeft, IntfTop, IntfWidth, IntfHeight, SWP_NOZORDER or SWP_NOACTIVATE);
end;
LCLControlSizeNeedsUpdate(AWinControl, True); LCLControlSizeNeedsUpdate(AWinControl, True);
end; end;