Hide dock and menubar on OSX;

Due to QWidget::showFullScreen having side-effects on OSX (setting the
dock and menubar to autohide, making it impossible to then set them as
hidden), the calls to that method were replaced with
UBPlatformUtils::showFullScreen(QWidget *). This function then calls
QWidget::showMaximized() on OSX, or QWidget::showFullScreen() on Linux
and Windows.

It is currently still impossible to switch smoothly between showing or
hiding the dock on OSX; current behaviour is to hide it all the time,
even in desktop mode.
preferencesAboutTextFull
Craig Watson 9 years ago
parent 5f9d6b9c69
commit 20ebdf3cc5
  1. 10
      src/core/UBDisplayManager.cpp
  2. 3
      src/desktop/UBCustomCaptureWindow.cpp
  3. 2
      src/desktop/UBDesktopAnnotationController.cpp
  4. 1
      src/frameworks/UBPlatformUtils.h
  5. 9
      src/frameworks/UBPlatformUtils_linux.cpp
  6. 47
      src/frameworks/UBPlatformUtils_mac.mm
  7. 7
      src/frameworks/UBPlatformUtils_win.cpp

@ -158,7 +158,7 @@ void UBDisplayManager::setDisplayWidget(QWidget* pDisplayWidget)
mDisplayWidget = pDisplayWidget;
mDisplayWidget->setGeometry(mDesktop->screenGeometry(mDisplayScreenIndex));
if (UBSettings::settings()->appUseMultiscreen->get().toBool())
mDisplayWidget->showFullScreen();
UBPlatformUtils::showFullScreen(mDisplayWidget);
}
}
@ -209,14 +209,14 @@ void UBDisplayManager::positionScreens()
{
mControlWidget->hide();
mControlWidget->setGeometry(mDesktop->screenGeometry(mControlScreenIndex));
mControlWidget->showFullScreen();
UBPlatformUtils::showFullScreen(mControlWidget);
}
if (mDisplayWidget && mDisplayScreenIndex > -1)
{
mDisplayWidget->hide();
mDisplayWidget->setGeometry(mDesktop->screenGeometry(mDisplayScreenIndex));
mDisplayWidget->showFullScreen();
UBPlatformUtils::showFullScreen(mDisplayWidget);
}
else if(mDisplayWidget)
{
@ -234,7 +234,7 @@ void UBDisplayManager::positionScreens()
{
QWidget* previous = mPreviousDisplayWidgets.at(psi);
previous->setGeometry(mDesktop->screenGeometry(mPreviousScreenIndexes.at(psi)));
previous->showFullScreen();
UBPlatformUtils::showFullScreen(previous);
}
}
@ -280,7 +280,7 @@ void UBDisplayManager::blackout()
foreach(UBBlackoutWidget *blackoutWidget, mBlackoutWidgets)
{
blackoutWidget->showFullScreen();
UBPlatformUtils::showFullScreen(blackoutWidget);
}
}

@ -30,6 +30,7 @@
#include "UBCustomCaptureWindow.h"
#include "frameworks/UBPlatformUtils.h"
#include "gui/UBRubberBand.h"
#include "core/memcheck.h"
@ -74,7 +75,7 @@ int UBCustomCaptureWindow::execute(const QPixmap &pScreenPixmap)
int currentScreen = desktop->screenNumber(QCursor::pos());
setGeometry(desktop->screenGeometry(currentScreen));
showFullScreen();
UBPlatformUtils::showFullScreen(this);
setWindowOpacity(1.0);
return exec();

@ -332,7 +332,7 @@ void UBDesktopAnnotationController::showWindow()
UBDrawingController::drawingController()->setStylusTool(mDesktopStylusTool);
#ifndef Q_OS_LINUX
mTransparentDrawingView->showFullScreen();
UBPlatformUtils::showFullScreen(mTransparentDrawingView);
#else
// this is necessary to avoid unity to hide the panels
mTransparentDrawingView->show();

@ -204,6 +204,7 @@ public:
static QString urlFromClipboard();
static QStringList availableTranslations();
static void setFrontProcess();
static void showFullScreen(QWidget * pWidget);
#ifdef Q_OS_OSX
static void SetMacLocaleByIdentifier(const QString& id);

@ -429,7 +429,14 @@ QString UBPlatformUtils::urlFromClipboard()
return qsRet;
}
void UBPlatformUtils::setFrontProcess()
{
// not used in Linux
}
void UBPlatformUtils::showFullScreen(QWidget *pWidget)
{
pWidget->showFullScreen();
}

@ -65,7 +65,7 @@ void UBPlatformUtils::init()
//originalSetSystemUIMode = APEPatchCreate((const void *)SetSystemUIMode, (const void *)emptySetSystemUIMode);
setDesktopMode(false);
//setDesktopMode(false);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@ -93,20 +93,24 @@ void UBPlatformUtils::init()
void UBPlatformUtils::setDesktopMode(bool desktop)
{ /*
#ifndef OS_NEWER_THAN_OR_EQUAL_TO_1010
//OSStatus (*functor)(SystemUIMode, SystemUIOptions) = (OSStatus (*)(SystemUIMode, SystemUIOptions))originalSetSystemUIMode;
{
if (desktop)
{
functor(kUIModeNormal, 0);
//qDebug() << "setDesktopMode called. desktop = " << desktop;
@try {
// temporarily disabled due to bug: when switching to desktop mode (and calling this),
// openboard switches right back to the board mode. clicking again on desktop mode works.
/*if (desktop) {
[NSApp setPresentationOptions:NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock];
}
else*/
[NSApp setPresentationOptions:NSApplicationPresentationHideMenuBar | NSApplicationPresentationHideDock];
}
else
{
functor(kUIModeAllHidden, 0);
@catch(NSException * exception) {
qDebug() << "Error setting presentation options";
}
#endif
*/
}
@ -574,6 +578,23 @@ void UBPlatformUtils::setFrontProcess()
// activate the application, forcing focus on it
[app activateWithOptions: NSApplicationActivateIgnoringOtherApps];
// other option:NSApplicationActivateAllWindows. This won't steal focus from another app, e.g
// other option: NSApplicationActivateAllWindows. This won't steal focus from another app, e.g
// if the user is doing something else while waiting for OpenBoard to load
}
/**
* @brief Full-screen a QWidget. Specific behaviour is platform-dependent.
* @param pWidget the QWidget to maximize
*/
void UBPlatformUtils::showFullScreen(QWidget *pWidget)
{
pWidget->showMaximized();
/* On OS X, we want to hide the Dock and menu bar (aka "kiosk mode"). Qt's default behaviour
* when full-screening a QWidget is to set the dock and menu bar to auto-hide.
* Since it is impossible to later set different presentation options (i.e Hide dock & menu bar)
* to NSApplication, we have to avoid calling QWidget::showFullScreen on OSX.
*/
}

@ -427,4 +427,11 @@ QString UBPlatformUtils::urlFromClipboard()
void UBPlatformUtils::setFrontProcess()
{
// not used in Windows
}
void UBPlatformUtils::showFullScreen(QWidget *pWidget)
{
pWidget->showFullScreen();
}

Loading…
Cancel
Save