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 Close;
procedure Resize; procedure Resize;
procedure Move; procedure Move;
procedure WindowStateChanged;
function GetEnabled: Boolean; function GetEnabled: Boolean;
procedure SetEnabled(AValue: Boolean); procedure SetEnabled(AValue: Boolean);
@ -136,6 +137,8 @@ type
procedure windowDidResignKey(notification: NSNotification); message 'windowDidResignKey:'; procedure windowDidResignKey(notification: NSNotification); message 'windowDidResignKey:';
procedure windowDidResize(notification: NSNotification); message 'windowDidResize:'; procedure windowDidResize(notification: NSNotification); message 'windowDidResize:';
procedure windowDidMove(notification: NSNotification); message 'windowDidMove:'; 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 // fullscreen notifications are only reported for 10.7 fullscreen
procedure windowWillEnterFullScreen(notification: NSNotification); message 'windowWillEnterFullScreen:'; procedure windowWillEnterFullScreen(notification: NSNotification); message 'windowWillEnterFullScreen:';
procedure windowDidEnterFullScreen(notification: NSNotification); message 'windowDidEnterFullScreen:'; procedure windowDidEnterFullScreen(notification: NSNotification); message 'windowDidEnterFullScreen:';
@ -209,6 +212,7 @@ 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;
function lclWindowState: 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;
@ -444,6 +448,14 @@ begin
end; end;
end; end;
function TCocoaWindowContent.lclWindowState: Integer;
begin
if isembedded then
Result := inherited lclWindowState
else
Result := window.lclWindowState;
end;
procedure TCocoaWindowContent.viewDidMoveToSuperview; procedure TCocoaWindowContent.viewDidMoveToSuperview;
begin begin
inherited viewDidMoveToSuperview; inherited viewDidMoveToSuperview;
@ -780,6 +792,18 @@ begin
callback.Move; callback.Move;
end; 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); procedure TCocoaWindow.windowWillEnterFullScreen(notification: NSNotification);
begin begin
if not isInFullScreen then isInFullScreen := true; if not isInFullScreen then isInFullScreen := true;

View File

@ -51,6 +51,7 @@ type
procedure Close; virtual; procedure Close; virtual;
procedure Resize; virtual; procedure Resize; virtual;
procedure Move; virtual; procedure Move; virtual;
procedure WindowStateChanged; virtual;
function GetEnabled: Boolean; virtual; function GetEnabled: Boolean; virtual;
procedure SetEnabled(AValue: Boolean); virtual; procedure SetEnabled(AValue: Boolean); virtual;
@ -428,6 +429,15 @@ begin
boundsDidChange(Owner); boundsDidChange(Owner);
end; 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; function TLCLWindowCallback.GetEnabled: Boolean;
begin begin
Result := Owner.lclIsEnabled; Result := Owner.lclIsEnabled;