cocoa: update interface ClientToScreen api call to recognize clientOffset for non-composite controls. todo: ScreenToClient must be updated accordingly

git-svn-id: trunk@58704 -
This commit is contained in:
dmitry 2018-08-14 15:37:28 +00:00
parent 1877bd1e5c
commit 728361e306

View File

@ -94,12 +94,27 @@ begin
end;
function TCocoaWidgetSet.ClientToScreen(Handle: HWND; var P: TPoint): Boolean;
var
r : NSRect;
cl : NSView;
clr : TRect;
begin
Result := Handle <> 0;
if Result then
begin
// must use lclContentView! - it's client view
NSObject(Handle).lclContentView.lclLocalToScreen(P.X, P.Y);
cl := NSObject(Handle).lclContentView;
if HWND(cl) = Handle then
begin
// if Handle is lclContentView, then we should check clientRect
// (i.e. TabControl doesn't have lclContentView, yet its clientRect is adjusted)
clr := NSObject(Handle).lclClientFrame;
P.X := P.X + clr.Left;
P.Y := P.Y + clr.Top;
end;
cl.lclLocalToScreen(P.X, P.Y);
end;
end;
procedure TCocoaWidgetSet.CallDefaultWndHandler(Sender: TObject; var Message);