cocoa: sending LCL bounds change notifications only if bounds have actually changed, to prevent WM_Size loops

git-svn-id: trunk@57616 -
This commit is contained in:
dmitry 2018-04-07 03:48:22 +00:00
parent ea840fc089
commit 1a38dc5407

View File

@ -1474,6 +1474,7 @@ class procedure TCocoaWSWinControl.SetBounds(const AWinControl: TWinControl;
const ALeft, ATop, AWidth, AHeight: Integer);
var
cb : ICommonCallBack;
r : TRect;
begin
if AWinControl.HandleAllocated then
begin
@ -1481,10 +1482,13 @@ begin
writeln(Format('TCocoaWSWinControl.SetBounds: %s Bounds=%s',
[AWinControl.Name, dbgs(Bounds(ALeft, ATop, AWidth, AHeight))]));
{$ENDIF}
NSObject(AWinControl.Handle).lclSetFrame(Bounds(ALeft, ATop, AWidth, AHeight));
cb := NSObject(AWinControl.Handle).lclGetCallback;
if Assigned(cb) then cb.boundsDidChange(nil);
r := NSObject(AWinControl.Handle).lclFrame;
if not EqualRect(r, bounds(Aleft, ATop, AWidth, AHeight)) then
begin
NSObject(AWinControl.Handle).lclSetFrame(Bounds(ALeft, ATop, AWidth, AHeight));
cb := NSObject(AWinControl.Handle).lclGetCallback;
if Assigned(cb) then cb.boundsDidChange(nil);
end;
end;
end;