[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - vcl/osx

Tor Lillqvist tml at collabora.com
Mon Jun 11 16:15:08 UTC 2018


 vcl/osx/salframeview.mm |   36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

New commits:
commit 00d6704597b831fe7b5f1db8da55ee6fdb48f031
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed May 23 23:21:21 2018 +0300

    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 at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

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;
 }


More information about the Libreoffice-commits mailing list