- call resizing without checking for the state change
- don't all resizing when the change does not come from the interface

git-svn-id: trunk@42106 -
This commit is contained in:
paul 2013-07-16 09:19:07 +00:00
parent 7d31d49396
commit 0286c2485a

View File

@ -694,7 +694,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TCustomForm.WMSize(var message: TLMSize); procedure TCustomForm.WMSize(var message: TLMSize);
var var
NewState, OldState: TWindowState; NewState: TWindowState;
begin begin
{$IFDEF CHECK_POSITION} {$IFDEF CHECK_POSITION}
DebugLn(['[TCustomForm.WMSize] ',DbgSName(Self),' Message.SizeType=',Message.SizeType,' Message.Width=',Message.Width,' Message.Height=',Message.Height,' AutoSizeDelayed=',AutoSizeDelayed]); DebugLn(['[TCustomForm.WMSize] ',DbgSName(Self),' Message.SizeType=',Message.SizeType,' Message.Width=',Message.Width,' Message.Height=',Message.Height,' AutoSizeDelayed=',AutoSizeDelayed]);
@ -712,26 +712,21 @@ begin
end; end;
//DebugLn('Trace:WMSIZE in TCustomForm'); //DebugLn('Trace:WMSIZE in TCustomForm');
OldState := FWindowState; if (Message.SizeType and SIZE_SourceIsInterface) <> 0 then
NewState := OldState; begin
case (Message.SizeType and not SIZE_SourceIsInterface) of NewState := FWindowState;
case (Message.SizeType xor SIZE_SourceIsInterface) of
SIZE_RESTORED: SIZE_RESTORED:
if Showing then
NewState := wsNormal; NewState := wsNormal;
SIZE_MINIMIZED: SIZE_MINIMIZED:
begin
if Showing then
NewState := wsMinimized; NewState := wsMinimized;
end;
SIZE_MAXIMIZED: SIZE_MAXIMIZED:
if Showing then
NewState := wsMaximized; NewState := wsMaximized;
SIZE_FULLSCREEN: SIZE_FULLSCREEN:
if Showing then
NewState := wsFullScreen; NewState := wsFullScreen;
end; end;
if OldState <> NewState then
Resizing(NewState); Resizing(NewState);
end;
inherited WMSize(Message); inherited WMSize(Message);
@ -1146,10 +1141,12 @@ procedure TCustomForm.Resizing(State: TWindowState);
var var
OldState: TWindowState; OldState: TWindowState;
begin begin
if not (csDesigning in ComponentState) then if Showing and not (csDesigning in ComponentState) then
begin begin
OldState := FWindowState; OldState := FWindowState;
FWindowState := State; FWindowState := State;
if OldState <> State then
begin
if (State = wsMinimized) and (Application.MainForm = Self) and if (State = wsMinimized) and (Application.MainForm = Self) and
(WidgetSet.GetLCLCapability(lcNeedMininimizeAppWithMainForm) <> LCL_CAPABILITY_NO) then (WidgetSet.GetLCLCapability(lcNeedMininimizeAppWithMainForm) <> LCL_CAPABILITY_NO) then
Application.Minimize; Application.Minimize;
@ -1160,6 +1157,7 @@ begin
OnWindowStateChange(Self); OnWindowStateChange(Self);
end; end;
end; end;
end;
procedure TCustomForm.CalculatePreferredSize(var PreferredWidth, procedure TCustomForm.CalculatePreferredSize(var PreferredWidth,
PreferredHeight: integer; WithThemeSpace: Boolean); PreferredHeight: integer; WithThemeSpace: Boolean);