mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 20:20:28 +02:00
Cocoa: better support for Multi Display, Merge branch 'cocoa/MultiDisplay'
This commit is contained in:
parent
b06a22d74a
commit
da69f50a82
@ -138,7 +138,6 @@ type
|
|||||||
// Returns the position of the view or window, in the immediate
|
// Returns the position of the view or window, in the immediate
|
||||||
// parent (view or screen), relative to its client coordinates system
|
// parent (view or screen), relative to its client coordinates system
|
||||||
// Left and Top are always returned in LCL coordinate system.
|
// Left and Top are always returned in LCL coordinate system.
|
||||||
procedure lclRelativePos(var Left, Top: Integer); message 'lclRelativePos::';
|
|
||||||
procedure lclLocalToScreen(var X, Y: Integer); message 'lclLocalToScreen::';
|
procedure lclLocalToScreen(var X, Y: Integer); message 'lclLocalToScreen::';
|
||||||
procedure lclScreenToLocal(var X, Y: Integer); message 'lclScreenToLocal::';
|
procedure lclScreenToLocal(var X, Y: Integer); message 'lclScreenToLocal::';
|
||||||
function lclParent: id; message 'lclParent';
|
function lclParent: id; message 'lclParent';
|
||||||
@ -177,7 +176,6 @@ type
|
|||||||
procedure lclInvalidateRect(const r: TRect); message 'lclInvalidateRect:'; reintroduce;
|
procedure lclInvalidateRect(const r: TRect); message 'lclInvalidateRect:'; reintroduce;
|
||||||
procedure lclInvalidate; message 'lclInvalidate'; reintroduce;
|
procedure lclInvalidate; message 'lclInvalidate'; reintroduce;
|
||||||
procedure lclUpdate; message 'lclUpdate'; reintroduce;
|
procedure lclUpdate; message 'lclUpdate'; reintroduce;
|
||||||
procedure lclRelativePos(var Left, Top: Integer); message 'lclRelativePos::'; reintroduce;
|
|
||||||
procedure lclLocalToScreen(var X, Y: Integer); message 'lclLocalToScreen::'; reintroduce;
|
procedure lclLocalToScreen(var X, Y: Integer); message 'lclLocalToScreen::'; reintroduce;
|
||||||
procedure lclScreenToLocal(var X, Y: Integer); message 'lclScreenToLocal::'; reintroduce;
|
procedure lclScreenToLocal(var X, Y: Integer); message 'lclScreenToLocal::'; reintroduce;
|
||||||
function lclParent: id; message 'lclParent'; reintroduce;
|
function lclParent: id; message 'lclParent'; reintroduce;
|
||||||
@ -1144,7 +1142,7 @@ begin
|
|||||||
params.isFirstCall:= not hasMarkedText();
|
params.isFirstCall:= not hasMarkedText();
|
||||||
|
|
||||||
rect:= imeHandler.IMEGetTextBound( params );
|
rect:= imeHandler.IMEGetTextBound( params );
|
||||||
LCLToNSRect( rect, NSGlobalScreenHeight, Result );
|
LCLToNSRect( rect, NSGlobalScreenBottom, Result );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCocoaFullControlEdit.unmarkText;
|
procedure TCocoaFullControlEdit.unmarkText;
|
||||||
@ -1216,10 +1214,6 @@ procedure LCLObjectExtension.lclUpdate;
|
|||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure LCLObjectExtension.lclRelativePos(var Left,Top: Integer);
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure LCLObjectExtension.lclLocalToScreen(var X,Y: Integer);
|
procedure LCLObjectExtension.lclLocalToScreen(var X,Y: Integer);
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
@ -1481,22 +1475,6 @@ begin
|
|||||||
//display;
|
//display;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure LCLViewExtension.lclRelativePos(var Left, Top: Integer);
|
|
||||||
var
|
|
||||||
sv : NSView;
|
|
||||||
fr : NSRect;
|
|
||||||
begin
|
|
||||||
Left := Round(frame.origin.x);
|
|
||||||
sv := superview;
|
|
||||||
if Assigned(sv) and (not sv.isFlipped) then
|
|
||||||
begin
|
|
||||||
fr := frame;
|
|
||||||
Top := Round(sv.frame.size.height - fr.origin.y - fr.size.height);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Top := Round(frame.origin.y);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure LCLViewExtension.lclLocalToScreen(var X, Y:Integer);
|
procedure LCLViewExtension.lclLocalToScreen(var X, Y:Integer);
|
||||||
var
|
var
|
||||||
P: NSPoint;
|
P: NSPoint;
|
||||||
|
@ -42,15 +42,20 @@ function NSRectToRect(const NS: NSRect): TRect;
|
|||||||
procedure NSToLCLRect(const ns: NSRect; ParentHeight: Single; out lcl: TRect);
|
procedure NSToLCLRect(const ns: NSRect; ParentHeight: Single; out lcl: TRect);
|
||||||
procedure LCLToNSRect(const lcl: TRect; ParentHeight: Single; out ns: NSRect);
|
procedure LCLToNSRect(const lcl: TRect; ParentHeight: Single; out ns: NSRect);
|
||||||
|
|
||||||
function IndexToHMonitor(i: NSUInteger): HMonitor;
|
function ScreenPointFromLCLToNS(const lclPoint: TPoint): NSPoint;
|
||||||
function HMonitorToIndex(h: HMonitor): NSUInteger;
|
function ScreenPointFromNSToLCL(const cocoaPoint: NSPoint): TPoint;
|
||||||
function getScreenFromHMonitor(h: HMonitor): NSScreen;
|
function ScreenRectFromLCLToNS(const lclRect: TRect): NSRect;
|
||||||
|
function ScreenRectFromNSToLCL(const cocoaRect: NSRect): TRect;
|
||||||
|
|
||||||
function NSPrimaryScreen: NSScreen;
|
function NSPrimaryScreen: NSScreen;
|
||||||
function NSPrimaryScreenFrame: NSRect;
|
function NSPrimaryScreenFrame: NSRect;
|
||||||
function NSGlobalScreenFrame: NSRect;
|
function NSGlobalScreenFrame: NSRect;
|
||||||
function NSGlobalScreenLCLFrame: NSRect;
|
function NSGlobalScreenLCLFrame: NSRect;
|
||||||
function NSGlobalScreenHeight: CGFloat;
|
function NSGlobalScreenBottom: CGFloat;
|
||||||
|
|
||||||
|
function IndexToHMonitor(i: NSUInteger): HMonitor;
|
||||||
|
function HMonitorToIndex(h: HMonitor): NSUInteger;
|
||||||
|
function getScreenFromHMonitor(h: HMonitor): NSScreen;
|
||||||
|
|
||||||
function CreateParamsToNSRect(const params: TCreateParams): NSRect;
|
function CreateParamsToNSRect(const params: TCreateParams): NSRect;
|
||||||
|
|
||||||
@ -759,34 +764,35 @@ begin
|
|||||||
ns.size.height:=lcl.Bottom-lcl.Top;
|
ns.size.height:=lcl.Bottom-lcl.Top;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// According to the documentation of NSScreen.screen It's recommended
|
function ScreenPointFromLCLToNS(const lclPoint: TPoint): NSPoint;
|
||||||
// not to cache NSScreen objects stored in the array. As those might change.
|
|
||||||
// However, according to the same documentation, the objects can change
|
|
||||||
// only with a notificatio sent out. BUT while using a macincloud (remote desktop)
|
|
||||||
// services, it was identified that NSScreen object CAN change without any notification.
|
|
||||||
// So, instead of passing NSScreen as HMonitor, only INDEX+1 in NSScreen.screen
|
|
||||||
// is used.
|
|
||||||
function IndexToHMonitor(i: NSUInteger): HMonitor;
|
|
||||||
begin
|
begin
|
||||||
if i = NSIntegerMax then Result := 0
|
Result.x:= lclPoint.x;
|
||||||
else Result := i + 1;
|
Result.y:= NSGlobalScreenBottom - lclPoint.y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function HMonitorToIndex(h: HMonitor): NSUInteger;
|
function ScreenPointFromNSToLCL(const cocoaPoint: NSPoint): TPoint;
|
||||||
begin
|
begin
|
||||||
if h = 0 then Result := NSIntegerMax
|
Result.x:= Round( cocoaPoint.x );
|
||||||
else Result := NSUInteger(h)-1;
|
Result.y:= Round( NSGlobalScreenBottom - cocoaPoint.y );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function getScreenFromHMonitor(h: HMonitor): NSScreen;
|
function ScreenRectFromLCLToNS(const lclRect: TRect): NSRect;
|
||||||
|
begin
|
||||||
|
Result.origin.x:= lclRect.left;
|
||||||
|
Result.origin.y:= NSGlobalScreenBottom - lclRect.bottom;
|
||||||
|
Result.size.width:= lclRect.Right - lclRect.Left;
|
||||||
|
Result.size.height:= lclRect.Bottom - lclRect.Top;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ScreenRectFromNSToLCL(const cocoaRect: NSRect): TRect;
|
||||||
var
|
var
|
||||||
index: NSUInteger;
|
bottom: CGFloat;
|
||||||
begin
|
begin
|
||||||
Result:= nil;
|
bottom:= NSGlobalScreenBottom;
|
||||||
index:= HMonitorToIndex( h );
|
Result.Left:= Round( cocoaRect.origin.x );
|
||||||
if index>=NSScreen.screens.count then
|
Result.Top:= Round( bottom - NSMaxY(cocoaRect) );
|
||||||
Exit;
|
Result.Right:= Round( cocoaRect.origin.x + cocoaRect.size.width );
|
||||||
Result:= NSScreen( NSScreen.screens.objectAtIndex(index) );
|
Result.Bottom:= Round( bottom - cocoaRect.origin.y );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// primary display
|
// primary display
|
||||||
@ -821,10 +827,41 @@ begin
|
|||||||
Result.origin.y:= NSPrimaryScreenFrame.size.height - NSMaxY(Result);
|
Result.origin.y:= NSPrimaryScreenFrame.size.height - NSMaxY(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// the height of global full virtual display
|
// the bottom of global full virtual display
|
||||||
function NSGlobalScreenHeight: CGFloat;
|
// for cocoa window/screen to lcl coordinate
|
||||||
|
function NSGlobalScreenBottom: CGFloat;
|
||||||
begin
|
begin
|
||||||
Result:= NSGlobalScreenFrame.size.height;
|
Result:= NSMaxY( NSGlobalScreenFrame );
|
||||||
|
end;
|
||||||
|
|
||||||
|
// According to the documentation of NSScreen.screen It's recommended
|
||||||
|
// not to cache NSScreen objects stored in the array. As those might change.
|
||||||
|
// However, according to the same documentation, the objects can change
|
||||||
|
// only with a notificatio sent out. BUT while using a macincloud (remote desktop)
|
||||||
|
// services, it was identified that NSScreen object CAN change without any notification.
|
||||||
|
// So, instead of passing NSScreen as HMonitor, only INDEX+1 in NSScreen.screen
|
||||||
|
// is used.
|
||||||
|
function IndexToHMonitor(i: NSUInteger): HMonitor;
|
||||||
|
begin
|
||||||
|
if i = NSIntegerMax then Result := 0
|
||||||
|
else Result := i + 1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function HMonitorToIndex(h: HMonitor): NSUInteger;
|
||||||
|
begin
|
||||||
|
if h = 0 then Result := NSIntegerMax
|
||||||
|
else Result := NSUInteger(h)-1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function getScreenFromHMonitor(h: HMonitor): NSScreen;
|
||||||
|
var
|
||||||
|
index: NSUInteger;
|
||||||
|
begin
|
||||||
|
Result:= nil;
|
||||||
|
index:= HMonitorToIndex( h );
|
||||||
|
if index>=NSScreen.screens.count then
|
||||||
|
Exit;
|
||||||
|
Result:= NSScreen( NSScreen.screens.objectAtIndex(index) );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CreateParamsToNSRect(const params: TCreateParams): NSRect;
|
function CreateParamsToNSRect(const params: TCreateParams): NSRect;
|
||||||
|
@ -1074,7 +1074,7 @@ begin
|
|||||||
|
|
||||||
contentView := TCocoaWindowContent(Handle);
|
contentView := TCocoaWindowContent(Handle);
|
||||||
if (not contentView.isembedded) and Assigned(contentView.window) then
|
if (not contentView.isembedded) and Assigned(contentView.window) then
|
||||||
NSToLCLRect(contentView.window.frame, NSGlobalScreenHeight, ARect)
|
ARect := ScreenRectFromNSToLCL( contentView.window.frame )
|
||||||
else
|
else
|
||||||
ARect := contentView.lclFrame;
|
ARect := contentView.lclFrame;
|
||||||
Result := 1;
|
Result := 1;
|
||||||
@ -1138,19 +1138,13 @@ end;
|
|||||||
|
|
||||||
function TCocoaWidgetSet.GetCursorPos(var lpPoint: TPoint ): Boolean;
|
function TCocoaWidgetSet.GetCursorPos(var lpPoint: TPoint ): Boolean;
|
||||||
begin
|
begin
|
||||||
with NSEvent.mouseLocation do
|
lpPoint:= ScreenPointFromNSToLCL( NSEvent.mouseLocation );
|
||||||
begin
|
|
||||||
lpPoint.x := Round(x);
|
|
||||||
// cocoa returns cursor with inverted y coordinate
|
|
||||||
lpPoint.y := Round(NSGlobalScreenHeight-y);
|
|
||||||
end;
|
|
||||||
//debugln('GetCursorPos='+DbgS(lpPoint));
|
//debugln('GetCursorPos='+DbgS(lpPoint));
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCocoaWidgetSet.GetMonitorInfo(hMonitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
function TCocoaWidgetSet.GetMonitorInfo(hMonitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
||||||
var
|
var
|
||||||
globalScreenHeight: CGFloat;
|
|
||||||
ScreenID: NSScreen;
|
ScreenID: NSScreen;
|
||||||
begin
|
begin
|
||||||
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo));
|
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo));
|
||||||
@ -1159,9 +1153,8 @@ begin
|
|||||||
Result := Assigned(ScreenID);
|
Result := Assigned(ScreenID);
|
||||||
if not Result then Exit;
|
if not Result then Exit;
|
||||||
|
|
||||||
globalScreenHeight := NSGlobalScreenHeight;
|
lpmi^.rcMonitor:= ScreenRectFromNSToLCL( ScreenID.frame );
|
||||||
NSToLCLRect(ScreenID.frame, globalScreenHeight, lpmi^.rcMonitor);
|
lpmi^.rcWork:= ScreenRectFromNSToLCL( ScreenID.visibleFrame );
|
||||||
NSToLCLRect(ScreenID.visibleFrame, globalScreenHeight, lpmi^.rcWork);
|
|
||||||
// according to the documentation the primary (0,0 coord screen)
|
// according to the documentation the primary (0,0 coord screen)
|
||||||
// is always and index 0
|
// is always and index 0
|
||||||
if HMonitorToIndex(hMonitor) = 0 then
|
if HMonitorToIndex(hMonitor) = 0 then
|
||||||
@ -1333,13 +1326,6 @@ begin
|
|||||||
Result:=0;
|
Result:=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCocoaWidgetSet.GetWindowRelativePosition(Handle: hwnd; var Left, Top: Integer): boolean;
|
|
||||||
begin
|
|
||||||
Result := Handle <> 0;
|
|
||||||
if Result then
|
|
||||||
NSObject(handle).lclRelativePos(Left, Top);
|
|
||||||
end;
|
|
||||||
|
|
||||||
// 1. not only for Window, but also for other controls
|
// 1. not only for Window, but also for other controls
|
||||||
// 2. for a Window, according to this function specification, Width and Height
|
// 2. for a Window, according to this function specification, Width and Height
|
||||||
// should be returned. but ClientWidth and ClientHeight were returned
|
// should be returned. but ClientWidth and ClientHeight were returned
|
||||||
@ -1477,7 +1463,7 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
p.x:=Point.X;
|
p.x:=Point.X;
|
||||||
p.y:=NSGlobalScreenHeight-Point.Y;
|
p.y:=NSGlobalScreenBottom-Point.Y;
|
||||||
window := GetCocoaWindowAtPos(p);
|
window := GetCocoaWindowAtPos(p);
|
||||||
if Assigned(window) then
|
if Assigned(window) then
|
||||||
Result:= HWND(window.contentView);
|
Result:= HWND(window.contentView);
|
||||||
@ -1876,7 +1862,7 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result:= 0;
|
Result:= 0;
|
||||||
point:= LCLToNSPoint( ptScreenCoords, NSGlobalScreenHeight );
|
point:= ScreenPointFromLCLToNS( ptScreenCoords );
|
||||||
if point.y>=1 then // NSPointInRect is (upper,left) inside
|
if point.y>=1 then // NSPointInRect is (upper,left) inside
|
||||||
point.y:= point.y-1; // (lower,right) outside
|
point.y:= point.y-1; // (lower,right) outside
|
||||||
|
|
||||||
|
@ -122,7 +122,6 @@ function GetViewPortOrgEx(DC: HDC; P: PPoint): Integer; override;
|
|||||||
{function GetWindowLong(Handle : hwnd; int: Integer): PtrInt; override;}
|
{function GetWindowLong(Handle : hwnd; int: Integer): PtrInt; override;}
|
||||||
function GetWindowOrgEx(dc : hdc; P : PPoint): Integer; override;
|
function GetWindowOrgEx(dc : hdc; P : PPoint): Integer; override;
|
||||||
function GetWindowRect(Handle: hwnd; var ARect: TRect): Integer; override;
|
function GetWindowRect(Handle: hwnd; var ARect: TRect): Integer; override;
|
||||||
function GetWindowRelativePosition(Handle: hwnd; var Left, Top: Integer): boolean; override;
|
|
||||||
function GetWindowSize(Handle: hwnd; var Width, Height: Integer): boolean; override;
|
function GetWindowSize(Handle: hwnd; var Width, Height: Integer): boolean; override;
|
||||||
|
|
||||||
function HideCaret(Handle: HWND): Boolean; override;
|
function HideCaret(Handle: HWND): Boolean; override;
|
||||||
|
@ -47,7 +47,6 @@ type
|
|||||||
procedure lclInvalidateRect(const r: TRect); message 'lclInvalidateRect:'; reintroduce;
|
procedure lclInvalidateRect(const r: TRect); message 'lclInvalidateRect:'; reintroduce;
|
||||||
procedure lclInvalidate; message 'lclInvalidate'; reintroduce;
|
procedure lclInvalidate; message 'lclInvalidate'; reintroduce;
|
||||||
procedure lclUpdate; message 'lclUpdate'; reintroduce;
|
procedure lclUpdate; message 'lclUpdate'; reintroduce;
|
||||||
procedure lclRelativePos(var Left, Top: Integer); message 'lclRelativePos::'; reintroduce;
|
|
||||||
procedure lclLocalToScreen(var X, Y: Integer); message 'lclLocalToScreen::'; reintroduce;
|
procedure lclLocalToScreen(var X, Y: Integer); message 'lclLocalToScreen::'; reintroduce;
|
||||||
procedure lclScreenToLocal(var X, Y: Integer); message 'lclScreenToLocal::'; reintroduce;
|
procedure lclScreenToLocal(var X, Y: Integer); message 'lclScreenToLocal::'; reintroduce;
|
||||||
function lclFrame: TRect; message 'lclFrame'; reintroduce;
|
function lclFrame: TRect; message 'lclFrame'; reintroduce;
|
||||||
@ -222,7 +221,6 @@ type
|
|||||||
function lclOwnWindow: NSWindow; message 'lclOwnWindow';
|
function lclOwnWindow: NSWindow; message 'lclOwnWindow';
|
||||||
procedure lclSetFrame(const r: TRect); override;
|
procedure lclSetFrame(const r: TRect); override;
|
||||||
function lclFrame: TRect; override;
|
function lclFrame: TRect; override;
|
||||||
procedure lclRelativePos(var Left, Top: Integer); override;
|
|
||||||
procedure viewDidMoveToSuperview; override;
|
procedure viewDidMoveToSuperview; override;
|
||||||
procedure viewDidMoveToWindow; override;
|
procedure viewDidMoveToWindow; override;
|
||||||
procedure viewWillMoveToWindow(newWindow: CocoaAll.NSWindow); override;
|
procedure viewWillMoveToWindow(newWindow: CocoaAll.NSWindow); override;
|
||||||
@ -446,19 +444,11 @@ begin
|
|||||||
if not isembedded then
|
if not isembedded then
|
||||||
begin
|
begin
|
||||||
//Window bounds should return "client rect" in screen coordinates
|
//Window bounds should return "client rect" in screen coordinates
|
||||||
NSToLCLRect(window.frame, NSGlobalScreenHeight, wfrm);
|
wfrm := ScreenRectFromNSToLCL(window.frame);
|
||||||
Types.OffsetRect(Result, -Result.Left+wfrm.Left, -Result.Top+wfrm.Top);
|
Types.OffsetRect(Result, -Result.Left+wfrm.Left, -Result.Top+wfrm.Top);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCocoaWindowContent.lclRelativePos(var Left, Top: Integer);
|
|
||||||
begin
|
|
||||||
if isembedded then
|
|
||||||
inherited lclRelativePos(Left, Top)
|
|
||||||
else
|
|
||||||
window.lclRelativePos(Left, Top);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCocoaWindowContent.viewDidMoveToSuperview;
|
procedure TCocoaWindowContent.viewDidMoveToSuperview;
|
||||||
begin
|
begin
|
||||||
inherited viewDidMoveToSuperview;
|
inherited viewDidMoveToSuperview;
|
||||||
@ -1234,23 +1224,13 @@ begin
|
|||||||
contentView.lclUpdate;
|
contentView.lclUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure LCLWindowExtension.lclRelativePos(var Left, Top: Integer);
|
|
||||||
var
|
|
||||||
f: NSRect;
|
|
||||||
begin
|
|
||||||
f:=frame;
|
|
||||||
Left := Round(f.origin.x);
|
|
||||||
Top := Round(NSGlobalScreenHeight - NSMaxY(f));
|
|
||||||
//debugln('Top:'+dbgs(Top));
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure LCLWindowExtension.lclLocalToScreen(var X, Y:Integer);
|
procedure LCLWindowExtension.lclLocalToScreen(var X, Y:Integer);
|
||||||
var
|
var
|
||||||
f: NSRect;
|
f: NSRect;
|
||||||
begin
|
begin
|
||||||
f := frame;
|
f := frame;
|
||||||
inc(X, Round(f.origin.x));
|
inc(X, Round(f.origin.x));
|
||||||
inc(Y, Round(NSGlobalScreenHeight - NSMaxY(f)));
|
inc(Y, Round(NSGlobalScreenBottom - NSMaxY(f)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure LCLWindowExtension.lclScreenToLocal(var X, Y: Integer);
|
procedure LCLWindowExtension.lclScreenToLocal(var X, Y: Integer);
|
||||||
@ -1259,15 +1239,15 @@ var
|
|||||||
begin
|
begin
|
||||||
f := frame;
|
f := frame;
|
||||||
dec(X, Round(f.origin.x));
|
dec(X, Round(f.origin.x));
|
||||||
dec(Y, Round(NSGlobalScreenHeight - NSMaxY(f)));
|
dec(Y, Round(NSGlobalScreenBottom - NSMaxY(f)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function LCLWindowExtension.lclFrame: TRect;
|
function LCLWindowExtension.lclFrame: TRect;
|
||||||
begin
|
begin
|
||||||
if Assigned(contentView) then
|
if Assigned(contentView) then
|
||||||
Result:=contentView.lclFrame
|
Result:= contentView.lclFrame
|
||||||
else
|
else
|
||||||
NSToLCLRect(frame, NSGlobalScreenHeight, Result);
|
Result:= ScreenRectFromNSToLCL( frame );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function LCLWindowExtension.lclGetTopBarHeight:integer;
|
function LCLWindowExtension.lclGetTopBarHeight:integer;
|
||||||
@ -1288,12 +1268,12 @@ var
|
|||||||
ns : NSRect;
|
ns : NSRect;
|
||||||
h : integer;
|
h : integer;
|
||||||
begin
|
begin
|
||||||
LCLToNSRect(r, NSGlobalScreenHeight, ns);
|
ns:= ScreenRectFromLCLToNS( r );
|
||||||
|
|
||||||
// add topbar height
|
// add topbar height
|
||||||
h:=lclGetTopBarHeight;
|
h:= lclGetTopBarHeight;
|
||||||
ns.size.height:=ns.size.height+h;
|
ns.size.height:= ns.size.height + h;
|
||||||
ns.origin.y:=ns.origin.y-h;
|
ns.origin.y:= ns.origin.y - h;
|
||||||
{$ifdef BOOLFIX}
|
{$ifdef BOOLFIX}
|
||||||
setFrame_display_(ns, Ord(isVisible));
|
setFrame_display_(ns, Ord(isVisible));
|
||||||
{$else}
|
{$else}
|
||||||
|
@ -536,8 +536,8 @@ begin
|
|||||||
if lWindow <> nil then
|
if lWindow <> nil then
|
||||||
begin
|
begin
|
||||||
f := lWindow.frame;
|
f := lWindow.frame;
|
||||||
Point.x := Point.x+f.origin.x;
|
Point.x := Point.x + f.origin.x;
|
||||||
Point.y := lWindow.screen.frame.size.height- f.origin.y - Point.y;
|
Point.y := NSGlobalScreenBottom - ( Point.y + f.origin.y );
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -959,7 +959,7 @@ begin
|
|||||||
point:= TPoint.Create( x, y );
|
point:= TPoint.Create( x, y );
|
||||||
screen:= getScreenFromHMonitor( CocoaWidgetSet.MonitorFromPoint(point, MONITOR_DEFAULTTONULL) );
|
screen:= getScreenFromHMonitor( CocoaWidgetSet.MonitorFromPoint(point, MONITOR_DEFAULTTONULL) );
|
||||||
|
|
||||||
mouseY:= NSGlobalScreenHeight - y;
|
mouseY:= NSGlobalScreenBottom - y;
|
||||||
if Assigned(screen) then begin
|
if Assigned(screen) then begin
|
||||||
menuY:= screen.visibleFrame.origin.y + menu.size.height + 1;
|
menuY:= screen.visibleFrame.origin.y + menu.size.height + 1;
|
||||||
menuY:= max( mouseY, MenuY );
|
menuY:= max( mouseY, MenuY );
|
||||||
|
Loading…
Reference in New Issue
Block a user