cocoa: processing system notifcations of the fullscreen changes

git-svn-id: trunk@57624 -
This commit is contained in:
dmitry 2018-04-08 16:01:46 +00:00
parent 1519d4d14f
commit dbdd55fa0f

View File

@ -427,6 +427,10 @@ type
procedure windowDidResignKey(notification: NSNotification); message 'windowDidResignKey:';
procedure windowDidResize(notification: NSNotification); message 'windowDidResize:';
procedure windowDidMove(notification: NSNotification); message 'windowDidMove:';
// fullscreen notifications are only reported for 10.7 fullscreen
procedure windowWillEnterFullScreen(notification: NSNotification); message 'windowWillEnterFullScreen:';
procedure windowDidEnterFullScreen(notification: NSNotification); message 'windowDidEnterFullScreen:';
procedure windowDidExitFullScreen(notification: NSNotification); message 'windowDidExitFullScreen:';
public
callback: IWindowCallback;
LCLForm: TCustomForm;
@ -1895,6 +1899,25 @@ begin
callback.Move;
end;
procedure TCocoaWindow.windowWillEnterFullScreen(notification: NSNotification);
begin
if not isInFullScreen then isInFullScreen := true;
// setting fullscreen flag, prior to the "Fullscreen" has actually been enabled.
// MacOS does 10.7 fullscreen switch with an animation (that's about 1 second long)
// if during that animation there's another call toggleFullScreen() is made
// then macOS produces an output "not in fullscreen state" and ignores the call.
end;
procedure TCocoaWindow.windowDidEnterFullScreen(notification: NSNotification);
begin
if not isInFullScreen then isInFullScreen := true;
end;
procedure TCocoaWindow.windowDidExitFullScreen(notification: NSNotification);
begin
if isInFullScreen then isInFullScreen := false;
end;
procedure TCocoaWindow.dealloc;
begin
if (fieldEditor <> nil) then