mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 10:19:22 +02:00
Cocoa: TCocoaWidgetSet.GetWindowRect() fixed, returns the correct Window rectangle
Forms are now correctly vertically centered
This commit is contained in:
parent
998bfc4e21
commit
132d374870
@ -1085,21 +1085,21 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TCocoaWidgetSet.GetWindowRect(Handle: hwnd; var ARect: TRect): Integer;
|
function TCocoaWidgetSet.GetWindowRect(Handle: hwnd; var ARect: TRect): Integer;
|
||||||
var
|
var
|
||||||
dx, dy: Integer;
|
contentView: TCocoaWindowContent;
|
||||||
begin
|
begin
|
||||||
if Handle <> 0 then
|
Result := 0;
|
||||||
begin
|
if Handle=0 then
|
||||||
ARect := NSObject(Handle).lclFrame;
|
exit;
|
||||||
if not NSObject(Handle).isKindOfClass_(NSWindow) then
|
|
||||||
begin
|
if not NSObject(Handle).isKindOfClass(TCocoaWindowContent) then
|
||||||
dx := 0;
|
exit;
|
||||||
dy := 0;
|
|
||||||
NSObject(Handle).lclLocalToScreen(dx, dy);
|
contentView := TCocoaWindowContent(Handle);
|
||||||
MoveRect(ARect, dx, dy);
|
if (not contentView.isembedded) and Assigned(contentView.window) then
|
||||||
end;
|
NSToLCLRect(contentView.window.frame, NSGlobalScreenHeight, ARect)
|
||||||
Result := 1;
|
else
|
||||||
end else
|
ARect := contentView.lclFrame;
|
||||||
Result := 0;
|
Result := 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCocoaWidgetSet.IsWindowEnabled(Handle: HWND): boolean;
|
function TCocoaWidgetSet.IsWindowEnabled(Handle: HWND): boolean;
|
||||||
@ -1364,6 +1364,12 @@ begin
|
|||||||
NSObject(handle).lclRelativePos(Left, Top);
|
NSObject(handle).lclRelativePos(Left, Top);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// 1. not only for Window, but also for other controls
|
||||||
|
// 2. for a Window, according to this function specification, Width and Height
|
||||||
|
// should be returned. but ClientWidth and ClientHeight were returned
|
||||||
|
// actually before.
|
||||||
|
// 3. after the LCL FORM specification determined, corresponding modifications
|
||||||
|
// need to be made.
|
||||||
function TCocoaWidgetSet.GetWindowSize(Handle: hwnd; var Width, Height: Integer): boolean;
|
function TCocoaWidgetSet.GetWindowSize(Handle: hwnd; var Width, Height: Integer): boolean;
|
||||||
var
|
var
|
||||||
r: TRect;
|
r: TRect;
|
||||||
|
Loading…
Reference in New Issue
Block a user