mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 06:39:12 +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 GetEffectiveShowInTaskBar: TShowInTaskBar;
|
||||||
function GetMonitor: TMonitor;
|
function GetMonitor: TMonitor;
|
||||||
function GetPixelsPerInch: Longint;
|
function GetPixelsPerInch: Longint;
|
||||||
function GetRestoredLeft: integer;
|
|
||||||
function GetRestoredTop: integer;
|
|
||||||
function IsAutoScrollStored: Boolean;
|
function IsAutoScrollStored: Boolean;
|
||||||
function IsForm: Boolean;
|
function IsForm: Boolean;
|
||||||
function IsIconStored: Boolean;
|
function IsIconStored: Boolean;
|
||||||
procedure CloseModal;
|
procedure CloseModal;
|
||||||
procedure FreeIconHandles;
|
procedure FreeIconHandles;
|
||||||
procedure IconChanged(Sender: TObject);
|
procedure IconChanged(Sender: TObject);
|
||||||
|
procedure Moved(Data: PtrInt);
|
||||||
procedure SetActive(AValue: Boolean);
|
procedure SetActive(AValue: Boolean);
|
||||||
procedure SetActiveControl(AWinControl: TWinControl);
|
procedure SetActiveControl(AWinControl: TWinControl);
|
||||||
procedure SetActiveDefaultControl(AControl: TControl);
|
procedure SetActiveDefaultControl(AControl: TControl);
|
||||||
@ -485,6 +484,7 @@ type
|
|||||||
procedure WMActivate(var Message : TLMActivate); message LM_ACTIVATE;
|
procedure WMActivate(var Message : TLMActivate); message LM_ACTIVATE;
|
||||||
procedure WMCloseQuery(var message: TLMessage); message LM_CLOSEQUERY;
|
procedure WMCloseQuery(var message: TLMessage); message LM_CLOSEQUERY;
|
||||||
procedure WMHelp(var Message: TLMHelp); message LM_HELP;
|
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 WMShowWindow(var message: TLMShowWindow); message LM_SHOWWINDOW;
|
||||||
procedure WMSize(var message: TLMSize); message LM_Size;
|
procedure WMSize(var message: TLMSize); message LM_Size;
|
||||||
procedure WMWindowPosChanged(var Message: TLMWindowPosChanged); message LM_WINDOWPOSCHANGED;
|
procedure WMWindowPosChanged(var Message: TLMWindowPosChanged); message LM_WINDOWPOSCHANGED;
|
||||||
@ -685,8 +685,8 @@ type
|
|||||||
property ParentFont default False;
|
property ParentFont default False;
|
||||||
property PixelsPerInch: Longint read GetPixelsPerInch write FPixelsPerInch stored False;
|
property PixelsPerInch: Longint read GetPixelsPerInch write FPixelsPerInch stored False;
|
||||||
property Position: TPosition read FPosition write SetPosition default poDesigned;
|
property Position: TPosition read FPosition write SetPosition default poDesigned;
|
||||||
property RestoredLeft: integer read GetRestoredLeft;
|
property RestoredLeft: integer read FRestoredLeft;
|
||||||
property RestoredTop: integer read GetRestoredTop;
|
property RestoredTop: integer read FRestoredTop;
|
||||||
property RestoredWidth: integer read FRestoredWidth;
|
property RestoredWidth: integer read FRestoredWidth;
|
||||||
property RestoredHeight: integer read FRestoredHeight;
|
property RestoredHeight: integer read FRestoredHeight;
|
||||||
property ShowInTaskBar: TShowInTaskbar read FShowInTaskbar write SetShowInTaskBar
|
property ShowInTaskBar: TShowInTaskbar read FShowInTaskbar write SetShowInTaskBar
|
||||||
|
@ -730,16 +730,29 @@ begin
|
|||||||
|
|
||||||
inherited WMSize(Message);
|
inherited WMSize(Message);
|
||||||
|
|
||||||
if (Message.SizeType and SIZE_RESTORED) > 0 then
|
if (Message.SizeType and not SIZE_SourceIsInterface) = SIZE_RESTORED then
|
||||||
begin
|
begin
|
||||||
FRestoredLeft := Left;
|
|
||||||
FRestoredTop := Top;
|
|
||||||
FRestoredWidth := Width;
|
FRestoredWidth := Width;
|
||||||
FRestoredHeight := Height;
|
FRestoredHeight := Height;
|
||||||
//DebugLn('[TCustomForm.WMSize] saving restored bounds ',DbgSName(Self),' ',dbgs(FRestoredWidth),'x',dbgs(FRestoredHeight));
|
//DebugLn('[TCustomForm.WMSize] saving restored bounds ',DbgSName(Self),' ',dbgs(FRestoredWidth),'x',dbgs(FRestoredHeight));
|
||||||
end;
|
end;
|
||||||
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);
|
procedure TCustomForm.WMWindowPosChanged(var Message: TLMWindowPosChanged);
|
||||||
begin
|
begin
|
||||||
if (Parent = nil) and Assigned(Message.WindowPos) and ((Message.WindowPos^.flags and SWP_SourceIsInterface)>0) then
|
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);
|
Result := Screen.MonitorFromWindow(Handle, mdNearest);
|
||||||
end;
|
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
|
TCustomForm Method SetFocusedControl
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user