summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-05-23 23:21:21 +0300
committerTor Lillqvist <tml@collabora.com>2018-06-11 18:14:47 +0200
commit00d6704597b831fe7b5f1db8da55ee6fdb48f031 (patch)
tree203e66ba81a3d8a9595e1a62c6c51e13e42b0ec1
parent2acf9a3dab4502c10ec8d0a9194fc3b788dac301 (diff)
tdf#117872: Never participate in the macOS system full-screen mode
There is just too much complexity involved, and the way LibreOffice works really isn't prepared for the concept of windows having the option from a system point of view to being full-screenable or not. This means that the green bubble in window title bars changes from being a (system) full-screen toggle to being a maximize/restore toggle. Sure, the "maximize" concept also probably can be confused with LibreOffice's own full-screen concept. For instance, the Start Centre window is not expecting to be made full-screen. Still, when you from the Start Centre open a Writer document, it is the *same* window that is re-used as the Writer window, and then suddenly should be prepared to handle going full-screen. Also, it is up to each separate kind of document window whether it can be made full-screen (from the LibreOffice point of view) or not. Writer windows can, but Impress windows can't, for example. The View>Full Screen menu entry is added separately each case. Change-Id: I6983481cbd30c0e5190c450483b1246006c80633 Reviewed-on: https://gerrit.libreoffice.org/55617 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r--vcl/osx/salframeview.mm36
1 files changed, 21 insertions, 15 deletions
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index a4fc182858b1..2797c96b84b7 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -194,22 +194,28 @@ static AquaSalFrame* getMouseContainerFrame()
[pNSWindow useOptimizedDrawing: YES]; // OSX recommendation when there are no overlapping subviews within the receiver
#endif
- // enable OSX>=10.7 fullscreen options if available and useful
- bool bAllowFullScreen = (SalFrameStyleFlags::NONE == (mpFrame->mnStyle & (SalFrameStyleFlags::DIALOG | SalFrameStyleFlags::TOOLTIP | SalFrameStyleFlags::SYSTEMCHILD | SalFrameStyleFlags::FLOAT | SalFrameStyleFlags::TOOLWINDOW | SalFrameStyleFlags::INTRO)));
- bAllowFullScreen &= (SalFrameStyleFlags::NONE == (~mpFrame->mnStyle & SalFrameStyleFlags::SIZEABLE));
- bAllowFullScreen &= (mpFrame->mpParent == nullptr);
- const SEL setCollectionBehavior = @selector(setCollectionBehavior:);
- if( bAllowFullScreen && [pNSWindow respondsToSelector: setCollectionBehavior])
- {
- const int bMode= (bAllowFullScreen ? NSWindowCollectionBehaviorFullScreenPrimary : NSWindowCollectionBehaviorFullScreenAuxiliary);
- [pNSWindow performSelector:setCollectionBehavior withObject:reinterpret_cast<id>(static_cast<intptr_t>(bMode))];
- }
+ // Disallow full-screen mode on macOS >= 10.11 where it is enabled by default. We don't want it
+ // for now as it will just be confused with LibreOffice's home-grown full-screen concept, with
+ // which it has nothing to do, and one can get into all kinds of weird states by using them
+ // intermixedly.
- // disable OSX>=10.7 window restoration until we support it directly
- const SEL setRestorable = @selector(setRestorable:);
- if( [pNSWindow respondsToSelector: setRestorable]) {
- [pNSWindow performSelector:setRestorable withObject:reinterpret_cast<id>(NO)];
- }
+ // Ideally we should use the system full-screen mode and adapt the code for the home-grown thing
+ // to be in sync with that instead. (And we would then not need the button to get out of
+ // full-screen mode, as the normal way to get out of it is to either click on the green bubble
+ // again, or invoke the keyboard command again.)
+
+ // (Confusingly, at the moment the home-grown full-screen mode is bound to Cmd+Shift+F, which is
+ // the keyboard command normally used in apps to get in and out of the system full-screen mode.)
+
+ // Disabling system full-screen mode makes the green button on the title bar (on macOS >= 10.11)
+ // show a plus sign instead, and clicking it becomes identical to double-clicking the title bar,
+ // i.e. it maximizes / unmaximises the window. Sure, that state can also be confused with LO's
+ // home-grown full-screen mode. Oh well.
+
+ [pNSWindow setCollectionBehavior: NSWindowCollectionBehaviorFullScreenNone];
+
+ // Disable window restoration until we support it directly
+ [pNSWindow setRestorable: NO];
return (SalFrameWindow *)pNSWindow;
}