cocoa: updating windowState. Patch by Zoë Peterson. #35622

git-svn-id: trunk@61287 -
This commit is contained in:
dmitry 2019-05-24 12:59:09 +00:00
parent 544969faaf
commit d4240fda12
2 changed files with 34 additions and 0 deletions

View File

@ -67,6 +67,7 @@ type
procedure Close;
procedure Resize;
procedure Move;
procedure WindowStateChanged;
function GetEnabled: Boolean;
procedure SetEnabled(AValue: Boolean);
@ -136,6 +137,8 @@ type
procedure windowDidResignKey(notification: NSNotification); message 'windowDidResignKey:';
procedure windowDidResize(notification: NSNotification); message 'windowDidResize:';
procedure windowDidMove(notification: NSNotification); message 'windowDidMove:';
procedure windowDidMiniaturize(notification: NSNotification); message 'windowDidMiniaturize:';
procedure windowDidDeminiaturize(notification: NSNotification); message 'windowDidDeminiaturize:';
// fullscreen notifications are only reported for 10.7 fullscreen
procedure windowWillEnterFullScreen(notification: NSNotification); message 'windowWillEnterFullScreen:';
procedure windowDidEnterFullScreen(notification: NSNotification); message 'windowDidEnterFullScreen:';
@ -209,6 +212,7 @@ type
function lclOwnWindow: NSWindow; message 'lclOwnWindow';
procedure lclSetFrame(const r: TRect); override;
function lclFrame: TRect; override;
function lclWindowState: Integer; override;
procedure viewDidMoveToSuperview; override;
procedure viewDidMoveToWindow; override;
procedure viewWillMoveToWindow(newWindow: CocoaAll.NSWindow); override;
@ -444,6 +448,14 @@ begin
end;
end;
function TCocoaWindowContent.lclWindowState: Integer;
begin
if isembedded then
Result := inherited lclWindowState
else
Result := window.lclWindowState;
end;
procedure TCocoaWindowContent.viewDidMoveToSuperview;
begin
inherited viewDidMoveToSuperview;
@ -780,6 +792,18 @@ begin
callback.Move;
end;
procedure TCocoaWindow.windowDidMiniaturize(notification: NSNotification);
begin
if Assigned(callback) then
callback.WindowStateChanged;
end;
procedure TCocoaWindow.windowDidDeminiaturize(notification: NSNotification);
begin
if Assigned(callback) then
callback.WindowStateChanged;
end;
procedure TCocoaWindow.windowWillEnterFullScreen(notification: NSNotification);
begin
if not isInFullScreen then isInFullScreen := true;

View File

@ -51,6 +51,7 @@ type
procedure Close; virtual;
procedure Resize; virtual;
procedure Move; virtual;
procedure WindowStateChanged; virtual;
function GetEnabled: Boolean; virtual;
procedure SetEnabled(AValue: Boolean); virtual;
@ -428,6 +429,15 @@ begin
boundsDidChange(Owner);
end;
procedure TLCLWindowCallback.WindowStateChanged;
var
Bounds: TRect;
begin
Bounds := HandleFrame.lclFrame;
LCLSendSizeMsg(Target, Bounds.Right - Bounds.Left, Bounds.Bottom - Bounds.Top,
Owner.lclWindowState, True);
end;
function TLCLWindowCallback.GetEnabled: Boolean;
begin
Result := Owner.lclIsEnabled;