mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-30 11:27:28 +01:00
Fix Cocoa window move and resize update and control anchor align problems
git-svn-id: trunk@43662 -
This commit is contained in:
parent
18a463791b
commit
cc30f43ab4
@ -927,9 +927,9 @@ begin
|
||||
if Result then
|
||||
begin
|
||||
if TCocoaWindowContent(handle).isembedded then
|
||||
TCocoaWindowContent(handle).lclRelativePos(Left, Top)
|
||||
TCocoaWindowContent(handle).lclRelativePos(Left, Top)
|
||||
else
|
||||
TCocoaWindowContent(handle).window.lclRelativePos(Left, Top);
|
||||
TCocoaWindowContent(handle).window.lclRelativePos(Left, Top);
|
||||
end
|
||||
end;
|
||||
|
||||
@ -940,7 +940,11 @@ begin
|
||||
Result := Handle <> 0;
|
||||
if Result then
|
||||
begin
|
||||
r := NSObject(Handle).lclFrame;
|
||||
if TCocoaWindowContent(handle).isembedded then
|
||||
r := TCocoaWindowContent(handle).lclFrame
|
||||
else
|
||||
r:=TCocoaWindowContent(handle).window.lclFrame;
|
||||
|
||||
Width := R.Right - R.Left;
|
||||
Height := R.Bottom - R.Top;
|
||||
end;
|
||||
|
||||
@ -27,6 +27,7 @@ type
|
||||
FContext: TCocoaContext;
|
||||
FHasCaret: Boolean;
|
||||
FTarget: TWinControl;
|
||||
FBoundsReportedToChildren: boolean;
|
||||
function GetHasCaret: Boolean;
|
||||
procedure SetHasCaret(AValue: Boolean);
|
||||
protected
|
||||
@ -220,6 +221,7 @@ begin
|
||||
FPropStorage := TStringList.Create;
|
||||
FPropStorage.Sorted := True;
|
||||
FPropStorage.Duplicates := dupAccept;
|
||||
FBoundsReportedToChildren:=false;
|
||||
end;
|
||||
|
||||
destructor TLCLCommonCallback.Destroy;
|
||||
@ -751,7 +753,7 @@ var
|
||||
SizeType: Integer;
|
||||
begin
|
||||
NewBounds := Owner.lclFrame;
|
||||
//debugln('Newbounds:'+ dbgs(newbounds));
|
||||
//debugln('Newbounds='+ dbgs(newbounds));
|
||||
// send window pos changed
|
||||
PosMsg.Msg := LM_WINDOWPOSCHANGED;
|
||||
PosMsg.Result := 0;
|
||||
@ -772,11 +774,12 @@ begin
|
||||
end;
|
||||
|
||||
OldBounds := Target.BoundsRect;
|
||||
//debugln(Target.Name+':'+ dbgs(OldBounds));
|
||||
//debugln('OldBounds Target='+Target.Name+':'+ dbgs(OldBounds));
|
||||
|
||||
Resized :=
|
||||
(OldBounds.Right - OldBounds.Left <> NewBounds.Right - NewBounds.Left) or
|
||||
(OldBounds.Bottom - OldBounds.Top <> NewBounds.Bottom - NewBounds.Top);
|
||||
|
||||
Moved :=
|
||||
(OldBounds.Left <> NewBounds.Left) or
|
||||
(OldBounds.Top <> NewBounds.Top);
|
||||
@ -784,9 +787,9 @@ begin
|
||||
ClientResized := False;
|
||||
|
||||
// update client rect
|
||||
if Resized or Target.ClientRectNeedsInterfaceUpdate then
|
||||
if Resized or Target.ClientRectNeedsInterfaceUpdate then
|
||||
begin
|
||||
Target.InvalidateClientRectCache(False);
|
||||
Target.InvalidateClientRectCache(false);
|
||||
ClientResized := True;
|
||||
end;
|
||||
|
||||
@ -803,6 +806,13 @@ begin
|
||||
LCLSendMoveMsg(Target, NewBounds.Left,
|
||||
NewBounds.Top, Move_SourceIsInterface);
|
||||
end;
|
||||
|
||||
if not FBoundsReportedToChildren then // first time we need this to update non cocoa based client rects
|
||||
begin
|
||||
Target.InvalidateClientRectCache(true);
|
||||
FBoundsReportedToChildren:=true;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TLCLCommonCallback.BecomeFirstResponder;
|
||||
@ -1005,9 +1015,13 @@ end;
|
||||
|
||||
class procedure TCocoaWSWinControl.SetBounds(const AWinControl: TWinControl;
|
||||
const ALeft, ATop, AWidth, AHeight: Integer);
|
||||
|
||||
begin
|
||||
if AWinControl.HandleAllocated then
|
||||
begin
|
||||
//debugln('TCocoaWSWinControl.SetBounds: '+AWinControl.Name+'Bounds='+dbgs(Bounds(ALeft, ATop, AWidth, AHeight)));
|
||||
NSObject(AWinControl.Handle).lclSetFrame(Bounds(ALeft, ATop, AWidth, AHeight));
|
||||
end;
|
||||
end;
|
||||
|
||||
class procedure TCocoaWSWinControl.SetCursor(const AWinControl: TWinControl;
|
||||
|
||||
@ -554,7 +554,11 @@ class procedure TCocoaWSCustomForm.SetBounds(const AWinControl: TWinControl;
|
||||
const ALeft, ATop, AWidth, AHeight: Integer);
|
||||
begin
|
||||
if AWinControl.HandleAllocated then
|
||||
NSObject(AWinControl.Handle).lclSetFrame(Bounds(ALeft, ATop, AWidth, AHeight));
|
||||
begin
|
||||
//debugln('TCocoaWSCustomForm.SetBounds: '+AWinControl.Name+'Bounds='+dbgs(Bounds(ALeft, ATop, AWidth, AHeight)));
|
||||
NSObject(AWinControl.Handle).lclSetFrame(Bounds(ALeft, ATop, AWidth, AHeight));
|
||||
TCocoaWindowContent(AwinControl.Handle).callback.boundsDidChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user