mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-16 23:49:28 +02:00
LCL: Fix window RestoredLeft/Top values. Issue #8576, patch from Yuichiro Takahashi.
git-svn-id: trunk@46292 -
This commit is contained in:
parent
c93ed74ee4
commit
d186f4212a
@ -454,14 +454,13 @@ type
|
||||
function GetEffectiveShowInTaskBar: TShowInTaskBar;
|
||||
function GetMonitor: TMonitor;
|
||||
function GetPixelsPerInch: Longint;
|
||||
function GetRestoredLeft: integer;
|
||||
function GetRestoredTop: integer;
|
||||
function IsAutoScrollStored: Boolean;
|
||||
function IsForm: Boolean;
|
||||
function IsIconStored: Boolean;
|
||||
procedure CloseModal;
|
||||
procedure FreeIconHandles;
|
||||
procedure IconChanged(Sender: TObject);
|
||||
procedure Moved(Data: PtrInt);
|
||||
procedure SetActive(AValue: Boolean);
|
||||
procedure SetActiveControl(AWinControl: TWinControl);
|
||||
procedure SetActiveDefaultControl(AControl: TControl);
|
||||
@ -485,6 +484,7 @@ type
|
||||
procedure WMActivate(var Message : TLMActivate); message LM_ACTIVATE;
|
||||
procedure WMCloseQuery(var message: TLMessage); message LM_CLOSEQUERY;
|
||||
procedure WMHelp(var Message: TLMHelp); message LM_HELP;
|
||||
procedure WMMove(var Message: TLMMove); message LM_MOVE;
|
||||
procedure WMShowWindow(var message: TLMShowWindow); message LM_SHOWWINDOW;
|
||||
procedure WMSize(var message: TLMSize); message LM_Size;
|
||||
procedure WMWindowPosChanged(var Message: TLMWindowPosChanged); message LM_WINDOWPOSCHANGED;
|
||||
@ -685,8 +685,8 @@ type
|
||||
property ParentFont default False;
|
||||
property PixelsPerInch: Longint read GetPixelsPerInch write FPixelsPerInch stored False;
|
||||
property Position: TPosition read FPosition write SetPosition default poDesigned;
|
||||
property RestoredLeft: integer read GetRestoredLeft;
|
||||
property RestoredTop: integer read GetRestoredTop;
|
||||
property RestoredLeft: integer read FRestoredLeft;
|
||||
property RestoredTop: integer read FRestoredTop;
|
||||
property RestoredWidth: integer read FRestoredWidth;
|
||||
property RestoredHeight: integer read FRestoredHeight;
|
||||
property ShowInTaskBar: TShowInTaskbar read FShowInTaskbar write SetShowInTaskBar
|
||||
|
@ -730,16 +730,29 @@ begin
|
||||
|
||||
inherited WMSize(Message);
|
||||
|
||||
if (Message.SizeType and SIZE_RESTORED) > 0 then
|
||||
if (Message.SizeType and not SIZE_SourceIsInterface) = SIZE_RESTORED then
|
||||
begin
|
||||
FRestoredLeft := Left;
|
||||
FRestoredTop := Top;
|
||||
FRestoredWidth := Width;
|
||||
FRestoredHeight := Height;
|
||||
//DebugLn('[TCustomForm.WMSize] saving restored bounds ',DbgSName(Self),' ',dbgs(FRestoredWidth),'x',dbgs(FRestoredHeight));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomForm.WMMove(var Message: TLMMove);
|
||||
begin
|
||||
inherited WMMove(Message);
|
||||
Application.QueueAsyncCall(@Moved, 0)
|
||||
end;
|
||||
|
||||
procedure TCustomForm.Moved(Data: PtrInt);
|
||||
begin
|
||||
if WindowState = wsNormal then
|
||||
begin
|
||||
FRestoredLeft := Left;
|
||||
FRestoredTop := Top;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomForm.WMWindowPosChanged(var Message: TLMWindowPosChanged);
|
||||
begin
|
||||
if (Parent = nil) and Assigned(Message.WindowPos) and ((Message.WindowPos^.flags and SWP_SourceIsInterface)>0) then
|
||||
@ -2275,22 +2288,6 @@ begin
|
||||
Result := Screen.MonitorFromWindow(Handle, mdNearest);
|
||||
end;
|
||||
|
||||
function TCustomForm.GetRestoredLeft: integer;
|
||||
begin
|
||||
if WindowState=wsNormal then
|
||||
Result := Left
|
||||
else
|
||||
Result := FRestoredLeft;
|
||||
end;
|
||||
|
||||
function TCustomForm.GetRestoredTop: integer;
|
||||
begin
|
||||
if WindowState=wsNormal then
|
||||
Result := Top
|
||||
else
|
||||
Result := FRestoredTop;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TCustomForm Method SetFocusedControl
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user