mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 02:39:37 +02:00
Cocoa/MultiDisplay: fix the bug about GetCocoaWindowAtPos() in TCocoaWSPopupMenu.Popup()
This commit is contained in:
parent
afc2dae9d3
commit
98acb93c9a
@ -967,7 +967,7 @@ begin
|
||||
// in macOS it's possible to "rightclick" without focusing a window
|
||||
// so let's try to find the window
|
||||
if not Assigned(w) then
|
||||
w := GetCocoaWindowAtPos( NSMakePoint(px, py) );
|
||||
w := GetCocoaWindowAtPos( NSMakePoint(px, Round(NSGlobalScreenHeight) - py) );
|
||||
|
||||
if Assigned(w) then
|
||||
begin
|
||||
@ -975,17 +975,17 @@ begin
|
||||
if Assigned(view) then
|
||||
begin
|
||||
// LCL Screen coordinate
|
||||
menuY := round(NSGlobalScreenHeight - w.screen.visibleFrame.origin.y - menu.size.height) - 1;
|
||||
menuY := Round(NSGlobalScreenHeight - w.screen.visibleFrame.origin.y - menu.size.height) - 1;
|
||||
py := min(py, menuY);
|
||||
view.lclScreenToLocal(px, py);
|
||||
// have to flip again, because popUpMenuPositioningItem expects point
|
||||
// to be in View coordinates and it does respect Flipped flag
|
||||
if not view.isFlipped then
|
||||
py := Round(view.frame.size.height - py);
|
||||
py := Round(view.frame.size.height) - py;
|
||||
end;
|
||||
end
|
||||
else
|
||||
py := Round(NSGlobalScreenHeight - py);
|
||||
py := Round(NSGlobalScreenHeight) - py;
|
||||
|
||||
menu.popUpMenuPositioningItem_atLocation_inView(nil, NSMakePoint(px, py), view);
|
||||
APopupMenu.Close; // notify LCL popup menu
|
||||
|
Loading…
Reference in New Issue
Block a user