diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-05-23 23:21:21 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-05-24 15:39:30 +0200 |
commit | 4b42fd7e9516fbbd8a92d97680524f32dd260fb2 (patch) | |
tree | c2e4035874ca686e9ad4ec044fd744b539759af0 /sfx2/source | |
parent | 3259f917545abcb8f325c42db3a81e0b9d4ad7fe (diff) |
tdf#115284: Unify LibreOffice and system full-screen concepts on macOS
Also tdf#76476, and probably more.
Make it so that when a window is in full-screen mode from
LibreOffice's point of view, it is also full-screen from the system's
point of view, and vice versa.
All three ways to enter and leave full-screen mode can now be used
with the same end result: The Ctrl-Cmd-F shortcut, the "View > Full
Screen" menu entry, and the green bubble on the title bar.
Don't disable/deactivate/etc menus while in full-screen mode. The menu
auto-hides so there is no harm in having it function normally.
Don't display the floating toolbar with a single "Full Screen" button
in it as the way to leave full-screen mode. Instead, the same three
ways that can be used to enter full-screen mode work to leave it, too.
Sadly I could not figure out a way to set a window properly to
full-screen at the point where a document window is created and set to
be the same size as that kind of document window was the previous time
it was open in LibreOffice. Thus don't save state for full-screen
windows as we can't properly restore them. At least not for macOS. It
is not good to just restore them as non-full-screened but still at the
size they had when full-screen.
One irritating glitch remains, and I was unable to fix that properly:
I now prevent closing the document window that is in full-screen mode.
Otherwise, if it is closed, the full-screen mode remains even if no
window is open there; the desktop is completely black. Moving the
cursor to the top edge, the LibreOffice menu is there, though. I tried
to fix that but with no fully satisfying result. (Some attempts even
lead to crashes, so just disabling closing is better than crashing at
least.)
Change-Id: Id909077ef9de9f19d48c8b9ad10d748a65b2417f
Reviewed-on: https://gerrit.libreoffice.org/54760
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 8fe2079492c5..5221205801ea 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * @@ -146,7 +146,11 @@ void SfxViewFrame::InitInterface_Impl() GetStaticInterface()->RegisterChildWindow(SID_BROWSER); GetStaticInterface()->RegisterChildWindow(SID_RECORDING_FLOATWINDOW); #if HAVE_FEATURE_DESKTOP +#ifndef MACOSX + // No floating toolbar to exit full-screen mode on macOS please; there is a system way to do it + // and that is what we want. GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_FULLSCREEN, SfxVisibilityFlags::FullScreen, ToolbarId::FullScreenToolbox); +#endif GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_APPLICATION, SfxVisibilityFlags::Standard, ToolbarId::EnvToolbox); #endif } @@ -2710,7 +2714,10 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) css::uno::Reference< css::frame::XFrame > xFrame( GetFrame().GetFrameInterface(), css::uno::UNO_QUERY); - +#ifndef MACOSX + // On macOS we don't deactivate the menu bar in system full-screen mode, which + // is how we implement the LibreOffice full-screen mode. The menu bar auto-hides + // in the full-screen mode. Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); Reference< css::frame::XLayoutManager > xLayoutManager; if ( xPropSet.is() ) @@ -2724,10 +2731,11 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) { } } - +#endif bool bNewFullScreenMode = pItem ? pItem->GetValue() : !pWork->IsFullScreenMode(); if ( bNewFullScreenMode != pWork->IsFullScreenMode() ) { +#ifndef MACOSX Reference< css::beans::XPropertySet > xLMPropSet( xLayoutManager, UNO_QUERY ); if ( xLMPropSet.is() ) { @@ -2741,8 +2749,11 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) { } } +#endif pWork->ShowFullScreenMode( bNewFullScreenMode ); +#ifndef MACOSX pWork->SetMenuBarMode( bNewFullScreenMode ? MenuBarMode::Hide : MenuBarMode::Normal ); +#endif GetFrame().GetWorkWindow_Impl()->SetFullScreen_Impl( bNewFullScreenMode ); if ( !pItem ) rReq.AppendItem( SfxBoolItem( SID_WIN_FULLSCREEN, bNewFullScreenMode ) ); |