bool UIMachineViewSeamless::eventFilter(QObject *pWatched, QEvent *pEvent) { if (pWatched != 0 && pWatched == machineWindow()) { switch (pEvent->type()) { case QEvent::Resize: { /* Send guest-resize hint only if top window resizing to required dimension: */ QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent); if (pResizeEvent->size() != workingArea().size()) break; /* Recalculate max guest size: */ setMaxGuestSize(); /* And resize guest to that size: */ if (uisession()->isGuestSupportsGraphics()) QTimer::singleShot(0, this, SLOT(sltPerformGuestResize())); break; } default: break; } } return UIMachineView::eventFilter(pWatched, pEvent); }
bool UIMachineViewNormal::eventFilter(QObject *pWatched, QEvent *pEvent) { if (pWatched != 0 && pWatched == machineWindow()) { switch (pEvent->type()) { case QEvent::Resize: { /* We call this on every resize as: * * Window frame geometry can change on resize. * * On X11 we set information here which becomes available * asynchronously at an unknown time after window * creation. As long as the information is not available * we make a best guess. */ setMaxGuestSize(); if (pEvent->spontaneous() && m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics()) QTimer::singleShot(300, this, SLOT(sltPerformGuestResize())); break; } #if defined (Q_WS_WIN32) # if defined (VBOX_GUI_USE_DDRAW) case QEvent::Move: { /* Notification from our parent that it has moved. We need this in order * to possibly adjust the direct screen blitting: */ if (frameBuffer()) frameBuffer()->moveEvent(static_cast<QMoveEvent*>(pEvent)); break; } # endif /* defined (VBOX_GUI_USE_DDRAW) */ #endif /* defined (Q_WS_WIN32) */ default: break; } } #ifdef Q_WS_WIN else if (pWatched != 0 && pWatched == machineWindow()->menuBar()) { /* Due to windows host uses separate 'focus set' to let menubar to * operate while popped up (see UIMachineViewNormal::event() for details), * it also requires backward processing: */ switch (pEvent->type()) { /* If menubar gets the focus while not popped up => give it back: */ case QEvent::FocusIn: { if (!QApplication::activePopupWidget()) setFocus(); } default: break; } } #endif /* Q_WS_WIN */ return UIMachineView::eventFilter(pWatched, pEvent); }
bool UIMachineViewNormal::eventFilter(QObject *pWatched, QEvent *pEvent) { if (pWatched != 0 && pWatched == machineWindow()) { switch (pEvent->type()) { case QEvent::Resize: { /* Recalculate max guest size: */ setMaxGuestSize(); /* And resize guest to current window size: */ if (pEvent->spontaneous() && m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics()) QTimer::singleShot(300, this, SLOT(sltPerformGuestResize())); break; } default: break; } } return UIMachineView::eventFilter(pWatched, pEvent); }
void UIMachineViewNormal::resendSizeHint() { /* Get the last guest-screen size-hint, taking the scale factor into account. */ const QSize sizeHint = scaledBackward(guestScreenSizeHint()); LogRel(("GUI: UIMachineViewNormal::resendSizeHint: Restoring guest size-hint for screen %d to %dx%d\n", (int)screenId(), sizeHint.width(), sizeHint.height())); /* Expand current limitations: */ setMaxGuestSize(sizeHint); /* Temporarily restrict the size to prevent a brief resize to the * frame-buffer dimensions when we exit full-screen. This is only * applied if the frame-buffer is at full-screen dimensions and * until the first machine view resize. */ m_sizeHintOverride = QSize(800, 600).expandedTo(sizeHint); /* Send saved size-hint to the guest: */ /// @todo What if not m_bIsGuestAutoresizeEnabled? /// Just let the guest start at the default 800x600? display().SetVideoModeHint(screenId(), guestScreenVisibilityStatus(), false, 0, 0, sizeHint.width(), sizeHint.height(), 0); uisession()->setScreenVisibleHostDesires(screenId(), guestScreenVisibilityStatus()); }