Changeset 27057 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Mar 4, 2010 7:45:10 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 58372
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp
r27015 r27057 25 25 #include <QApplication> 26 26 #include <QDesktopWidget> 27 #include <QTimer> 28 #ifdef Q_WS_MAC 27 29 #include <QMenuBar> 28 #include <QTimer> 30 #endif 31 #ifdef Q_WS_X11 32 #include <limits.h> 33 #endif 29 34 30 35 /* Local includes */ 31 #include "VBoxGlobal.h"32 36 #include "UISession.h" 33 37 #include "UIActionsPool.h" … … 50 54 #endif 51 55 , uMonitor) 52 , m_bIsGuestAutoresizeEnabled(pMachineWindow->machineLogic()->actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize)->isChecked()) 56 , m_fIsInitialResizeEventProcessed(false) 57 , m_bIsGuestAutoresizeEnabled(pMachineWindow->machineLogic()->actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize)->isChecked()) 53 58 , m_fShouldWeDoResize(false) 54 59 { … … 82 87 /* Cleanup frame buffer: */ 83 88 cleanupFrameBuffer(); 84 }85 86 void UIMachineViewFullscreen::sltAdditionsStateChanged()87 {88 /* Check if we should restrict minimum size: */89 maybeRestrictMinimumSize();90 89 } 91 90 … … 105 104 AssertMsg(newSize.isValid(), ("This size should be valid!\n")); 106 105 107 /* Subtracting frame in case we basing on machine view size: */108 if (!toSize.isValid())109 newSize -= QSize(frameWidth() * 2, frameWidth() * 2);110 111 106 /* Do not send the same hints as we already have: */ 112 107 if ((newSize.width() == storedConsoleSize().width()) && (newSize.height() == storedConsoleSize().height())) 113 108 return; 114 109 115 /* We only actually send the hint if 116 * 1) the autoresize property is set to true and 117 * 2) either an explicit new size was given (e.g. if the request 118 * was triggered directly by a console resize event) or if no 119 * explicit size was specified but a resize is flagged as being 120 * needed (e.g. the autoresize was just enabled and the console 121 * was resized while it was disabled). */ 110 /* We only actually send the hint if either an explicit new size was given 111 * (e.g. if the request was triggered directly by a console resize event) or 112 * if no explicit size was specified but a resize is flagged as being needed 113 * (e.g. the autoresize was just enabled and the console was resized while it was disabled). */ 122 114 if (toSize.isValid() || m_fShouldWeDoResize) 123 115 { 124 /* Remember the new size .*/116 /* Remember the new size: */ 125 117 storeConsoleSize(newSize.width(), newSize.height()); 126 118 … … 128 120 session().GetConsole().GetDisplay().SetVideoModeHint(newSize.width(), newSize.height(), 0, screenId()); 129 121 } 130 /* We had requested resize now, rejecting accident requests: */ 122 123 /* We had requested resize now, rejecting other accident requests: */ 131 124 m_fShouldWeDoResize = false; 132 125 } 133 126 } 134 127 135 /* If the desktop geometry is set automatically, this will update it: */ 128 void UIMachineViewFullscreen::sltAdditionsStateChanged() 129 { 130 /* Check if we should restrict minimum size: */ 131 maybeRestrictMinimumSize(); 132 } 133 136 134 void UIMachineViewFullscreen::sltDesktopResized() 137 135 { 136 /* If the desktop geometry is set automatically, this will update it: */ 138 137 calculateDesktopGeometry(); 139 138 } 140 139 141 void UIMachineViewFullscreen::prepareCommon()142 {143 UIMachineView::prepareCommon();144 145 /* Maximum size of the screen */146 setMaximumSize(availableGeometry().size());147 /* Minimum size is ignored too */148 setMinimumSize(0, 0);149 /* No scrollbars */150 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);151 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);152 }153 154 void UIMachineViewFullscreen::prepareFilters()155 {156 /* Base-class filters: */157 UIMachineView::prepareFilters();158 159 /* Normal window filters: */160 qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->menuBar()->installEventFilter(this);161 }162 163 void UIMachineViewFullscreen::prepareConsoleConnections()164 {165 /* Base class connections: */166 UIMachineView::prepareConsoleConnections();167 168 /* Guest additions state-change updater: */169 connect(uisession(), SIGNAL(sigAdditionsStateChange()), this, SLOT(sltAdditionsStateChanged()));170 }171 172 void UIMachineViewFullscreen::loadMachineViewSettings()173 {174 /* Base class settings: */175 UIMachineView::loadMachineViewSettings();176 177 /* Global settings: */178 {179 connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(sltDesktopResized()));180 }181 }182 183 void UIMachineViewFullscreen::setGuestAutoresizeEnabled(bool fEnabled)184 {185 if (m_bIsGuestAutoresizeEnabled != fEnabled)186 {187 m_bIsGuestAutoresizeEnabled = fEnabled;188 189 maybeRestrictMinimumSize();190 191 sltPerformGuestResize();192 }193 }194 195 void UIMachineViewFullscreen::normalizeGeometry(bool bAdjustPosition /* = false */)196 {197 QWidget *pTopLevelWidget = window();198 199 /* Make no normalizeGeometry in case we are in manual resize mode or main window is maximized: */200 if (pTopLevelWidget->isMaximized())201 return;202 203 /* Calculate client window offsets: */204 QRect frameGeo = pTopLevelWidget->frameGeometry();205 QRect geo = pTopLevelWidget->geometry();206 int dl = geo.left() - frameGeo.left();207 int dt = geo.top() - frameGeo.top();208 int dr = frameGeo.right() - geo.right();209 int db = frameGeo.bottom() - geo.bottom();210 211 /* Get the best size w/o scroll bars: */212 QSize s = pTopLevelWidget->sizeHint();213 214 /* Resize the frame to fit the contents: */215 s -= pTopLevelWidget->size();216 frameGeo.setRight(frameGeo.right() + s.width());217 frameGeo.setBottom(frameGeo.bottom() + s.height());218 219 if (bAdjustPosition)220 {221 QRegion availableGeo;222 QDesktopWidget *dwt = QApplication::desktop();223 if (dwt->isVirtualDesktop())224 /* Compose complex available region */225 for (int i = 0; i < dwt->numScreens(); ++ i)226 availableGeo += dwt->availableGeometry(i);227 else228 /* Get just a simple available rectangle */229 availableGeo = dwt->availableGeometry(pTopLevelWidget->pos());230 231 frameGeo = VBoxGlobal::normalizeGeometry(frameGeo, availableGeo, mode() != VBoxDefs::SDLMode /* canResize */);232 }233 234 #if 0235 /* Center the frame on the desktop: */236 frameGeo.moveCenter(availableGeo.center());237 #endif238 239 /* Finally, set the frame geometry */240 pTopLevelWidget->setGeometry(frameGeo.left() + dl, frameGeo.top() + dt, frameGeo.width() - dl - dr, frameGeo.height() - dt - db);241 }242 243 QRect UIMachineViewFullscreen::availableGeometry()244 {245 return QApplication::desktop()->screenGeometry(this);246 }247 248 void UIMachineViewFullscreen::maybeRestrictMinimumSize()249 {250 /* Sets the minimum size restriction depending on the auto-resize feature state and the current rendering mode.251 * Currently, the restriction is set only in SDL mode and only when the auto-resize feature is inactive.252 * We need to do that because we cannot correctly draw in a scrolled window in SDL mode.253 * In all other modes, or when auto-resize is in force, this function does nothing. */254 if (mode() == VBoxDefs::SDLMode)255 {256 if (!uisession()->isGuestSupportsGraphics() || !m_bIsGuestAutoresizeEnabled)257 setMinimumSize(sizeHint());258 else259 setMinimumSize(0, 0);260 }261 }262 263 140 bool UIMachineViewFullscreen::event(QEvent *pEvent) 264 141 { … … 267 144 case VBoxDefs::ResizeEventType: 268 145 { 269 /* Some situations require initial VGA Resize Request 270 * to be ignored at all, leaving previous framebuffer, 271 * machine view and machine window sizes preserved: */ 146 /* Some situations require framebuffer resize events to be ignored, 147 * leaving machine window & machine view & framebuffer sizes preserved: */ 272 148 if (uisession()->isGuestResizeIgnored()) 273 149 return true; 274 150 151 /* We are starting to perform machine view resize: */ 275 152 bool oldIgnoreMainwndResize = isMachineWindowResizeIgnored(); 276 153 setMachineWindowResizeIgnored(true); 277 154 155 /* Get guest resize-event: */ 278 156 UIResizeEvent *pResizeEvent = static_cast<UIResizeEvent*>(pEvent); 279 157 280 /* Store the new size to prevent unwanted resize hints being sent back. */ 158 /* Perform framebuffer resize: */ 159 frameBuffer()->resizeEvent(pResizeEvent); 160 161 /* Reapply maximum size restriction for machine view: */ 162 setMaximumSize(sizeHint()); 163 164 /* Store the new size to prevent unwanted resize hints being sent back: */ 281 165 storeConsoleSize(pResizeEvent->width(), pResizeEvent->height()); 282 166 283 /* Unfortunately restoreOverrideCursor() is broken in Qt 4.4.0 if WA_PaintOnScreen widgets are present. 284 * This is the case on linux with SDL. As workaround we save/restore the arrow cursor manually. 285 * See http://trolltech.com/developer/task-tracker/index_html?id=206165&method=entry for details. 286 * Moreover the current cursor, which could be set by the guest, should be restored after resize: */ 287 QCursor cursor; 288 if (uisession()->isHidingHostPointer()) 289 cursor = QCursor(Qt::BlankCursor); 290 else 291 cursor = viewport()->cursor(); 292 frameBuffer()->resizeEvent(pResizeEvent); 293 viewport()->setCursor(cursor); 294 295 #ifdef Q_WS_MAC 296 // TODO_NEW_CORE 297 // mDockIconPreview->setOriginalSize(pResizeEvent->width(), pResizeEvent->height()); 298 #endif /* Q_WS_MAC */ 299 300 /* This event appears in case of guest video was changed for somehow even without video resolution change. 301 * In this last case the host VM window will not be resized according this event and the host mouse cursor 302 * which was unset to default here will not be hidden in capture state. So it is necessary to perform 303 * updateMouseClipping() for the guest resize event if the mouse cursor was captured: */ 304 if (uisession()->isMouseCaptured()) 305 updateMouseClipping(); 306 307 /* Apply maximum size restriction: */ 308 setMaximumSize(sizeHint()); 309 310 /* May be we have to restrict minimum size? */ 311 maybeRestrictMinimumSize(); 312 313 /* Resize the guest canvas: */ 314 if (!isFrameBufferResizeIgnored()) 315 resize(pResizeEvent->width(), pResizeEvent->height()); 316 updateSliders(); 167 /* Perform machine view resize: */ 168 resize(pResizeEvent->width(), pResizeEvent->height()); 317 169 318 170 /* Let our toplevel widget calculate its sizeHint properly. */ … … 326 178 #endif /* Q_WS_X11 */ 327 179 328 if (!isFrameBufferResizeIgnored()) 329 normalizeGeometry(true /* adjustPosition */); 180 #ifdef Q_WS_MAC 181 // TODO_NEW_CORE 182 // mDockIconPreview->setOriginalSize(pResizeEvent->width(), pResizeEvent->height()); 183 #endif /* Q_WS_MAC */ 184 185 /* Unfortunately restoreOverrideCursor() is broken in Qt 4.4.0 if WA_PaintOnScreen widgets are present. 186 * This is the case on linux with SDL. As workaround we save/restore the arrow cursor manually. 187 * See http://trolltech.com/developer/task-tracker/index_html?id=206165&method=entry for details. 188 * Moreover the current cursor, which could be set by the guest, should be restored after resize: */ 189 if (uisession()->isValidPointerShapePresent()) 190 viewport()->setCursor(uisession()->cursor()); 191 else if (uisession()->isHidingHostPointer()) 192 viewport()->setCursor(Qt::BlankCursor); 193 /* This event appears in case of guest video was changed for somehow even without video resolution change. 194 * In this last case the host VM window will not be resized according this event and the host mouse cursor 195 * which was unset to default here will not be hidden in capture state. So it is necessary to perform 196 * updateMouseClipping() for the guest resize event if the mouse cursor was captured: */ 197 if (uisession()->isMouseCaptured()) 198 updateMouseClipping(); 199 200 /* May be we have to restrict minimum size? */ 201 maybeRestrictMinimumSize(); 330 202 331 203 /* Report to the VM thread that we finished resizing */ 332 204 session().GetConsole().GetDisplay().ResizeCompleted(screenId()); 333 205 206 /* We are finishing to perform machine view resize: */ 334 207 setMachineWindowResizeIgnored(oldIgnoreMainwndResize); 335 336 /* Update geometry after entering fullscreen */337 updateGeometry();338 208 339 209 /* Make sure that all posted signals are processed: */ 340 210 qApp->processEvents(); 341 211 212 /* We also recalculate the desktop geometry if this is determined automatically. 213 * In fact, we only need this on the first resize, 214 * but it is done every time to keep the code simpler. */ 215 calculateDesktopGeometry(); 216 342 217 /* Emit a signal about guest was resized: */ 343 218 emit resizeHintDone(); 344 345 /* We also recalculate the desktop geometry if this is determined346 * automatically. In fact, we only need this on the first resize,347 * but it is done every time to keep the code simpler. */348 calculateDesktopGeometry();349 350 // TODO_NEW_CORE: try to understand this, cause this is bullshit in fullscreen351 /* Enable frame-buffer resize watching: */352 // if (isFrameBufferResizeIgnored())353 // setFrameBufferResizeIgnored(false);354 219 355 220 return true; … … 365 230 if (pKeyEvent->key() == Qt::Key_Home) 366 231 { 367 /* In Qt4 it is not enough to just set the focus to menu-bar. 368 * So to get the menu-bar we have to send Qt::Key_Alt press/release events directly: */ 369 QKeyEvent e1(QEvent::KeyPress, Qt::Key_Alt, Qt::NoModifier); 370 QKeyEvent e2(QEvent::KeyRelease, Qt::Key_Alt, Qt::NoModifier); 371 QMenuBar *pMenuBar = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ? 372 qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->menuBar() : 0; 373 QApplication::sendEvent(pMenuBar, &e1); 374 QApplication::sendEvent(pMenuBar, &e2); 232 #if 0 // TODO: Activate Main Menu! 233 // should we create it first? 234 #endif 375 235 } 376 236 else … … 386 246 bool UIMachineViewFullscreen::eventFilter(QObject *pWatched, QEvent *pEvent) 387 247 { 388 /* Who are we watchin? */389 248 QIMainDialog *pMainDialog = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ? 390 249 qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0; 391 QMenuBar *pMenuBar = pMainDialog ? qobject_cast<QIMainDialog*>(pMainDialog)->menuBar() : 0;392 393 250 if (pWatched != 0 && pWatched == pMainDialog) 394 251 { … … 397 254 case QEvent::Resize: 398 255 { 256 /* Ignore initial resize event: */ 257 if (!m_fIsInitialResizeEventProcessed) 258 { 259 m_fIsInitialResizeEventProcessed = true; 260 break; 261 } 262 399 263 /* Set the "guest needs to resize" hint. 400 264 * This hint is acted upon when (and only when) the autoresize property is "true": */ 401 265 m_fShouldWeDoResize = uisession()->isGuestSupportsGraphics(); 402 266 if (!isMachineWindowResizeIgnored() && m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics()) 403 QTimer::singleShot( 300, this, SLOT(sltPerformGuestResize()));267 QTimer::singleShot(0, this, SLOT(sltPerformGuestResize())); 404 268 break; 405 269 } 406 #if defined (Q_WS_WIN32)407 # if defined (VBOX_GUI_USE_DDRAW)408 case QEvent::Move:409 {410 /* Notification from our parent that it has moved. We need this in order411 * to possibly adjust the direct screen blitting: */412 if (frameBuffer())413 frameBuffer()->moveEvent(static_cast<QMoveEvent*>(pEvent));414 break;415 }416 # endif417 #endif /* defined (Q_WS_WIN32) */418 270 default: 419 271 break; 420 272 } 421 273 } 422 else if (pWatched != 0 && pWatched == pMenuBar) 274 #ifdef Q_WS_MAC // TODO: Is it really needed? 275 QMenuBar *pMenuBar = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ? 276 qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->menuBar() : 0; 277 if (pWatched != 0 && pWatched == pMenuBar) 423 278 { 424 279 /* Sometimes when we press ESC in the menu it brings the focus away (Qt bug?) … … 445 300 } 446 301 } 302 #endif /* Q_WS_MAC */ 447 303 return UIMachineView::eventFilter(pWatched, pEvent); 448 304 } 449 305 306 void UIMachineViewFullscreen::prepareCommon() 307 { 308 /* Base class common settings: */ 309 UIMachineView::prepareCommon(); 310 311 /* Store old machine view size before bramebuffer resized: */ 312 m_normalSize = QSize(frameBuffer()->width(), frameBuffer()->height()); 313 314 /* Minimum size is ignored: */ 315 setMinimumSize(0, 0); 316 /* No scrollbars: */ 317 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 318 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 319 } 320 321 void UIMachineViewFullscreen::prepareFilters() 322 { 323 /* Base class filters: */ 324 UIMachineView::prepareFilters(); 325 326 #ifdef Q_WS_MAC // TODO: Is it really needed? See UIMachineViewSeamless::eventFilter(...); 327 /* Menu bar filter: */ 328 qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->menuBar()->installEventFilter(this); 329 #endif 330 } 331 332 void UIMachineViewFullscreen::prepareConnections() 333 { 334 connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(sltDesktopResized())); 335 } 336 337 void UIMachineViewFullscreen::prepareConsoleConnections() 338 { 339 /* Base class connections: */ 340 UIMachineView::prepareConsoleConnections(); 341 342 /* Guest additions state-change updater: */ 343 connect(uisession(), SIGNAL(sigAdditionsStateChange()), this, SLOT(sltAdditionsStateChanged())); 344 } 345 346 void UIMachineViewFullscreen::setGuestAutoresizeEnabled(bool fEnabled) 347 { 348 if (m_bIsGuestAutoresizeEnabled != fEnabled) 349 { 350 m_bIsGuestAutoresizeEnabled = fEnabled; 351 352 maybeRestrictMinimumSize(); 353 354 sltPerformGuestResize(); 355 } 356 } 357 358 QRect UIMachineViewFullscreen::availableGeometry() 359 { 360 return QApplication::desktop()->screenGeometry(this); 361 } 362 363 void UIMachineViewFullscreen::maybeRestrictMinimumSize() 364 { 365 /* Sets the minimum size restriction depending on the auto-resize feature state and the current rendering mode. 366 * Currently, the restriction is set only in SDL mode and only when the auto-resize feature is inactive. 367 * We need to do that because we cannot correctly draw in a scrolled window in SDL mode. 368 * In all other modes, or when auto-resize is in force, this function does nothing. */ 369 if (mode() == VBoxDefs::SDLMode) 370 { 371 if (!uisession()->isGuestSupportsGraphics() || !m_bIsGuestAutoresizeEnabled) 372 setMinimumSize(sizeHint()); 373 else 374 setMinimumSize(0, 0); 375 } 376 } 377 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h
r27012 r27057 44 44 private slots: 45 45 46 /* Slot to perform guest resize: */ 47 void sltPerformGuestResize(const QSize &aSize = QSize()); 48 46 49 /* Console callback handlers: */ 47 50 void sltAdditionsStateChanged(); 48 49 /* Slot to perform guest resize: */50 void sltPerformGuestResize(const QSize &aSize = QSize());51 51 52 52 /* Watch dog for desktop resizes: */ … … 55 55 private: 56 56 57 /* Event handlers: */ 58 bool event(QEvent *pEvent); 59 bool eventFilter(QObject *pWatched, QEvent *pEvent); 60 57 61 /* Prepare routines: */ 58 62 void prepareCommon(); 59 63 void prepareFilters(); 64 void prepareConnections(); 60 65 void prepareConsoleConnections(); 61 void loadMachineViewSettings(); 66 67 /* Cleanup routines: */ 68 //void cleanupConsoleConnections() {} 69 //void cleanupConnections() {} 70 //void cleanupFilters() {} 71 //void cleanupCommon() {} 62 72 63 73 /* Private setters: */ … … 65 75 66 76 /* Private helpers: */ 67 void normalizeGeometry(bool bAdjustPosition = false);68 77 QRect availableGeometry(); 69 78 void maybeRestrictMinimumSize(); 70 79 71 bool event(QEvent *pEvent);72 bool eventFilter(QObject *pWatched, QEvent *pEvent);73 74 80 /* Private members: */ 81 bool m_fIsInitialResizeEventProcessed : 1; 75 82 bool m_bIsGuestAutoresizeEnabled : 1; 76 83 bool m_fShouldWeDoResize : 1; 84 QSize m_normalSize; 77 85 78 86 /* Friend classes: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r27027 r27057 24 24 /* Global includes */ 25 25 #include <QDesktopWidget> 26 #i nclude <QMenuBar>27 # include <QTimer>28 # include <QContextMenuEvent>26 #ifdef Q_WS_MAC 27 # include <QMenuBar> 28 #endif /* Q_WS_MAC */ 29 29 30 30 /* Local includes */ 31 31 #include "VBoxGlobal.h" 32 32 33 #ifdef Q_WS_MAC 33 34 #include "UISession.h" 34 # include "UIActionsPool.h"35 #endif /* Q_WS_MAC */ 35 36 #include "UIMachineLogic.h" 36 37 #include "UIMachineView.h" … … 38 39 39 40 UIMachineWindowFullscreen::UIMachineWindowFullscreen(UIMachineLogic *pMachineLogic, ulong uScreenId) 40 : QIWithRetranslateUI <QIMainDialog>(0)41 : QIWithRetranslateUI2<QIMainDialog>(0, Qt::Window) 41 42 , UIMachineWindow(pMachineLogic, uScreenId) 42 43 { … … 64 65 prepareMachineView(); 65 66 67 #ifdef Q_WS_MAC 66 68 /* Load normal window settings: */ 67 69 loadWindowSettings(); 70 #endif /* Q_WS_MAC */ 68 71 69 72 /* Update all the elements: */ … … 71 74 72 75 /* Show window: */ 73 // show();76 showFullScreen(); 74 77 } 75 78 76 79 UIMachineWindowFullscreen::~UIMachineWindowFullscreen() 77 80 { 78 /* Save normal window settings: */79 saveWindowSettings();80 81 81 /* Cleanup normal machine view: */ 82 82 cleanupMachineView(); … … 148 148 149 149 /* Set central widget: */ 150 setCentralWidget(new QWidget (this));150 setCentralWidget(new QWidget); 151 151 152 152 /* Set central widget layout: */ … … 163 163 /* Add machine view into layout: */ 164 164 m_pMachineViewContainer->addWidget(m_pMachineView, 1, 1, Qt::AlignVCenter | Qt::AlignHCenter); 165 }166 165 167 void UIMachineWindowFullscreen::loadWindowSettings() 168 { 169 /* Toggle console to manual resize mode. */ 170 m_pMachineView->setFrameBufferResizeIgnored(true); 171 172 /* The background has to go black */ 166 /* The background has to go black: */ 173 167 QPalette palette(centralWidget()->palette()); 174 168 palette.setColor(centralWidget()->backgroundRole(), Qt::black); … … 176 170 centralWidget()->setAutoFillBackground(true); 177 171 setAutoFillBackground(true); 178 179 /* Here we are going really fullscreen */180 setWindowState(windowState() | Qt::WindowFullScreen);181 182 /* Show the window */183 show();184 /* Make sure it is really on the right place (especially on the Mac) */185 move(0, 0);186 172 } 187 173 188 void UIMachineWindowFullscreen::saveWindowSettings() 174 #ifdef Q_WS_MAC 175 void UIMachineWindowFullscreen::loadWindowSettings() 189 176 { 177 /* Load global settings: */ 178 { 179 VBoxGlobalSettings settings = vboxGlobal().settings(); 180 menuBar()->setHidden(settings.isFeatureActive("noMenuBar")); 181 } 190 182 } 183 #endif 191 184 192 185 void UIMachineWindowFullscreen::cleanupMachineView() -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
r27027 r27057 24 24 #define __UIMachineWindowFullscreen_h__ 25 25 26 /* Global includes */27 #include <QLabel>28 29 26 /* Local includes */ 30 #include "VBoxDefs.h"31 27 #include "QIWithRetranslateUI.h" 32 28 #include "QIMainDialog.h" … … 36 32 #endif 37 33 38 #ifdef Q_WS_MAC 39 # include <ApplicationServices/ApplicationServices.h> 40 #endif /* Q_WS_MAC */ 41 42 /* Local forwards */ 43 class CMediumAttachment; 44 45 class UIMachineWindowFullscreen : public QIWithRetranslateUI<QIMainDialog>, public UIMachineWindow 34 class UIMachineWindowFullscreen : public QIWithRetranslateUI2<QIMainDialog>, public UIMachineWindow 46 35 { 47 36 Q_OBJECT; … … 49 38 protected: 50 39 51 /* Normalmachine window constructor/destructor: */40 /* Fullscreen machine window constructor/destructor: */ 52 41 UIMachineWindowFullscreen(UIMachineLogic *pMachineLogic, ulong uScreenId); 53 42 virtual ~UIMachineWindowFullscreen(); … … 69 58 #ifdef Q_WS_X11 70 59 bool x11Event(XEvent *pEvent); 71 #endif 60 #endif /* Q_WS_X11 */ 72 61 void closeEvent(QCloseEvent *pEvent); 73 62 … … 77 66 #endif /* Q_WS_MAC */ 78 67 void prepareMachineView(); 68 #ifdef Q_WS_MAC 79 69 void loadWindowSettings(); 70 #endif /* Q_WS_MAC */ 80 71 81 72 /* Cleanup helpers: */ 82 void saveWindowSettings(); 73 #ifdef Q_WS_MAC 74 //void saveWindowSettings() {} 75 #endif /* Q_WS_MAC */ 83 76 void cleanupMachineView(); 77 #ifdef Q_WS_MAC 84 78 //void cleanupMenu() {} 85 //void cleanupConsoleConnections() {} 86 87 /* Other members: */ 88 QRect m_normalGeometry; 79 #endif /* Q_WS_MAC */ 89 80 90 81 /* Factory support: */
Note:
See TracChangeset
for help on using the changeset viewer.