mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 18:00:26 +02:00
Cocoa: fix TCocoaWidgetSet.WindowFromPoint() by GetCocoaWindowAtPos()
This commit is contained in:
parent
1f82cd542f
commit
48990d892e
@ -1554,11 +1554,8 @@ end;
|
||||
|
||||
function TCocoaWidgetSet.WindowFromPoint(Point: TPoint): HWND;
|
||||
var
|
||||
windows: NSArray;
|
||||
win: integer;
|
||||
window, windowbelowpoint: NSWindow;
|
||||
window:NSWindow;
|
||||
p:NSPoint;
|
||||
winnr:NSInteger;
|
||||
begin
|
||||
Result := 0;
|
||||
if not assigned(NSApp) then
|
||||
@ -1566,19 +1563,9 @@ begin
|
||||
|
||||
p.x:=Point.X;
|
||||
p.y:=NSScreenZeroHeight-Point.Y;
|
||||
winnr:=NSWindow.windowNumberAtPoint_belowWindowWithWindowNumber(p,0);
|
||||
windowbelowpoint:=NSWindow(NSApp.windowWithWindowNumber(winnr));
|
||||
|
||||
windows := NSApp.windows;
|
||||
for win := 0 to windows.count - 1 do
|
||||
begin
|
||||
window:=windows.objectAtIndex(win);
|
||||
if windowbelowpoint=window then
|
||||
begin
|
||||
Result:= HWND(window.contentView);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
window := GetCocoaWindowAtPos(p);
|
||||
if Assigned(window) then
|
||||
Result:= HWND(window.contentView);
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user