mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-01 07:58:12 +02:00
cocoa: if app is inactive searching through available windows in order to find one by mouse position. bug #37877
git-svn-id: trunk@64117 -
This commit is contained in:
parent
e7263b2573
commit
f490c67b0f
@ -831,6 +831,7 @@ var
|
|||||||
view : NSView;
|
view : NSView;
|
||||||
w : NSWindow;
|
w : NSWindow;
|
||||||
px, py: Integer;
|
px, py: Integer;
|
||||||
|
wi: NSUInteger;
|
||||||
begin
|
begin
|
||||||
if Assigned(APopupMenu) and (APopupMenu.Handle<>0) then
|
if Assigned(APopupMenu) and (APopupMenu.Handle<>0) then
|
||||||
begin
|
begin
|
||||||
@ -847,6 +848,31 @@ begin
|
|||||||
py := y;
|
py := y;
|
||||||
view := nil;
|
view := nil;
|
||||||
w :=NSApp.keyWindow;
|
w :=NSApp.keyWindow;
|
||||||
|
if not Assigned(w) and (NSApp.windows.count>0) then
|
||||||
|
begin
|
||||||
|
// in macOS it's possible to "rightclick" without focusing a window
|
||||||
|
// so let's try to find the window
|
||||||
|
for wi := 0 to NSApp.windows.count-1 do
|
||||||
|
begin
|
||||||
|
w := NSWindow(NSApp.windows.objectAtIndex(wi));
|
||||||
|
if not w.isVisible then Continue;
|
||||||
|
view := w.contentView;
|
||||||
|
view.lclScreenToLocal(px, py);
|
||||||
|
if (px >= 0) and (py >= 0)
|
||||||
|
and (px<=Round(view.frame.size.width))
|
||||||
|
and (py<=Round(view.frame.size.height))
|
||||||
|
then
|
||||||
|
begin
|
||||||
|
px := X;
|
||||||
|
py := Y;
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
w := nil;
|
||||||
|
px := X;
|
||||||
|
py := Y;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
if Assigned(w) then
|
if Assigned(w) then
|
||||||
begin
|
begin
|
||||||
view := w.contentView;
|
view := w.contentView;
|
||||||
|
Loading…
Reference in New Issue
Block a user