From 9adc8991cd11d30d1fb095b64b21bbb219bff30e Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Fri, 18 Dec 2015 17:11:44 +0100 Subject: [PATCH] Fixed UBPlatformUtils::showFullScreen not maximizing to full screen on OS X 10.9 --- src/frameworks/UBPlatformUtils_mac.mm | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index cdd2d237..36bfca8a 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -588,12 +588,24 @@ void UBPlatformUtils::setFrontProcess() */ 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. + /* OpenBoard is designed to be run in "kiosk mode", i.e full screen. + * On OS X, we want to maximize the application while hiding the dock and menu bar, + * rather than use OS X's native full screen mode (which places the window on a new desktop). + * However, 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. */ + + pWidget->showMaximized(); + + /* Hack. On OS X 10.10, showMaximize() resizes the widget to full screen; + but on 10.9, it is placed in the "available" screen area (i.e the screen area minus + the menu bar and dock area). So we have to manually resize it to the total screen height, + and move it up to the top of the screen (0,0 position) */ + + QDesktopWidget * desktop = QApplication::desktop(); + pWidget->resize(pWidget->width(), desktop->screenGeometry().height()); + pWidget->move(0, 0); + }