VirtualBox

Changeset 30259 in vbox for trunk/src


Ignore:
Timestamp:
Jun 16, 2010 4:43:39 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt: New running VM core: Fixed bug in VBoxDefs::ResizeEventType event processing for fullscreen, seamless modes; Some common code moved into specific normal, fullscreen, seamless parts.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r30211 r30259  
    793793            }
    794794            break;
    795         }
    796 
    797         case VBoxDefs::ResizeEventType:
    798         {
    799             /* Some situations require framebuffer resize events to be ignored,
    800              * leaving machine window & machine view & framebuffer sizes preserved: */
    801             if (uisession()->isGuestResizeIgnored())
    802                 return true;
    803 
    804             /* We are starting to perform machine view resize: */
    805             bool oldIgnoreMainwndResize = isMachineWindowResizeIgnored();
    806             setMachineWindowResizeIgnored(true);
    807 
    808             /* Get guest resize-event: */
    809             UIResizeEvent *pResizeEvent = static_cast<UIResizeEvent*>(pEvent);
    810 
    811             /* Perform framebuffer resize: */
    812             frameBuffer()->resizeEvent(pResizeEvent);
    813 
    814             /* Reapply maximum size restriction for machine view: */
    815             setMaximumSize(sizeHint());
    816 
    817             /* Store the new size to prevent unwanted resize hints being sent back: */
    818             storeConsoleSize(pResizeEvent->width(), pResizeEvent->height());
    819 
    820             /* Perform machine-view resize: */
    821             resize(pResizeEvent->width(), pResizeEvent->height());
    822 
    823             /* Let our toplevel widget calculate its sizeHint properly. */
    824 #ifdef Q_WS_X11
    825             /* We use processEvents rather than sendPostedEvents & set the time out value to max cause on X11 otherwise
    826              * the layout isn't calculated correctly. Dosn't find the bug in Qt, but this could be triggered through
    827              * the async nature of the X11 window event system. */
    828             QCoreApplication::processEvents(QEventLoop::AllEvents, INT_MAX);
    829 #else /* Q_WS_X11 */
    830             QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
    831 #endif /* Q_WS_X11 */
    832 
    833 #ifdef Q_WS_MAC
    834             machineLogic()->updateDockIconSize(screenId(), pResizeEvent->width(), pResizeEvent->height());
    835 #endif /* Q_WS_MAC */
    836 
    837             /* Update mouse cursor shape: */
    838             updateMouseCursorShape();
    839 
    840             /* May be we have to restrict minimum size? */
    841             maybeRestrictMinimumSize();
    842 
    843             /* Update machine-view sliders: */
    844             updateSliders();
    845 
    846             /* Normalize geometry: */
    847             normalizeGeometry(true /* adjustPosition */);
    848 
    849             /* Report to the VM thread that we finished resizing */
    850             session().GetConsole().GetDisplay().ResizeCompleted(screenId());
    851 
    852             /* We are finishing to perform machine-view resize: */
    853             setMachineWindowResizeIgnored(oldIgnoreMainwndResize);
    854 
    855             /* Make sure that all posted signals are processed: */
    856             qApp->processEvents();
    857 
    858             /* We also recalculate the desktop geometry if this is determined
    859              * automatically.  In fact, we only need this on the first resize,
    860              * but it is done every time to keep the code simpler. */
    861             calculateDesktopGeometry();
    862 
    863             /* Emit a signal about guest was resized: */
    864             emit resizeHintDone();
    865 
    866             return true;
    867795        }
    868796
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp

    r28800 r30259  
    149149    switch (pEvent->type())
    150150    {
     151        case VBoxDefs::ResizeEventType:
     152        {
     153            /* Some situations requires framebuffer resize events to be ignored at all,
     154             * leaving machine-window, machine-view and framebuffer sizes preserved: */
     155            if (uisession()->isGuestResizeIgnored())
     156                return true;
     157
     158            /* We are starting to perform machine-view resize: */
     159            bool oldIgnoreMainwndResize = isMachineWindowResizeIgnored();
     160            setMachineWindowResizeIgnored(true);
     161
     162            /* Get guest resize-event: */
     163            UIResizeEvent *pResizeEvent = static_cast<UIResizeEvent*>(pEvent);
     164
     165            /* Perform framebuffer resize: */
     166            frameBuffer()->resizeEvent(pResizeEvent);
     167
     168            /* Reapply maximum size restriction for machine-view: */
     169            setMaximumSize(sizeHint());
     170
     171            /* Store the new size to prevent unwanted resize hints being sent back: */
     172            storeConsoleSize(pResizeEvent->width(), pResizeEvent->height());
     173
     174            /* Perform machine-view resize: */
     175            resize(pResizeEvent->width(), pResizeEvent->height());
     176
     177            /* Let our toplevel widget calculate its sizeHint properly. */
     178#ifdef Q_WS_X11
     179            /* We use processEvents rather than sendPostedEvents & set the time out value to max cause on X11 otherwise
     180             * the layout isn't calculated correctly. Dosn't find the bug in Qt, but this could be triggered through
     181             * the async nature of the X11 window event system. */
     182            QCoreApplication::processEvents(QEventLoop::AllEvents, INT_MAX);
     183#else /* Q_WS_X11 */
     184            QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
     185#endif /* Q_WS_X11 */
     186
     187#ifdef Q_WS_MAC
     188            machineLogic()->updateDockIconSize(screenId(), pResizeEvent->width(), pResizeEvent->height());
     189#endif /* Q_WS_MAC */
     190
     191            /* Update mouse cursor shape: */
     192            updateMouseCursorShape();
     193
     194            /* May be we have to restrict minimum size? */
     195            maybeRestrictMinimumSize();
     196
     197            /* Update machine-view sliders: */
     198            updateSliders();
     199
     200            /* Report to the VM thread that we finished resizing */
     201            session().GetConsole().GetDisplay().ResizeCompleted(screenId());
     202
     203            /* We are finishing to perform machine-view resize: */
     204            setMachineWindowResizeIgnored(oldIgnoreMainwndResize);
     205
     206            /* Make sure that all posted signals are processed: */
     207            qApp->processEvents();
     208
     209            /* We also recalculate the desktop geometry if this is determined
     210             * automatically.  In fact, we only need this on the first resize,
     211             * but it is done every time to keep the code simpler. */
     212            calculateDesktopGeometry();
     213
     214            /* Emit a signal about guest was resized: */
     215            emit resizeHintDone();
     216
     217            /* Unlock after processing guest resize event: */
     218            if (m_pSyncBlocker && m_pSyncBlocker->isRunning())
     219                m_pSyncBlocker->quit();
     220
     221            return true;
     222        }
     223
    151224        case QEvent::KeyPress:
    152225        case QEvent::KeyRelease:
     
    163236                    pEvent->ignore();
    164237            }
    165         }
    166 
    167         case VBoxDefs::ResizeEventType:
    168         {
    169             /* Unlock after processing guest resize event: */
    170             bool fResult = UIMachineView::event(pEvent);
    171             if (m_pSyncBlocker && m_pSyncBlocker->isRunning())
    172                 m_pSyncBlocker->quit();
    173             return fResult;
     238
     239            break;
    174240        }
    175241
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r28800 r30259  
    137137bool UIMachineViewNormal::event(QEvent *pEvent)
    138138{
    139     /* We don't want this on the Mac, cause there the menu bar isn't within the
    140      * window and popping up a menu there looks really ugly. */
     139    switch (pEvent->type())
     140    {
     141        case VBoxDefs::ResizeEventType:
     142        {
     143            /* Some situations require framebuffer resize events to be ignored at all,
     144             * leaving machine-window, machine-view and framebuffer sizes preserved: */
     145            if (uisession()->isGuestResizeIgnored())
     146                return true;
     147
     148            /* We are starting to perform machine-view resize: */
     149            bool oldIgnoreMainwndResize = isMachineWindowResizeIgnored();
     150            setMachineWindowResizeIgnored(true);
     151
     152            /* Get guest resize-event: */
     153            UIResizeEvent *pResizeEvent = static_cast<UIResizeEvent*>(pEvent);
     154
     155            /* Perform framebuffer resize: */
     156            frameBuffer()->resizeEvent(pResizeEvent);
     157
     158            /* Reapply maximum size restriction for machine-view: */
     159            setMaximumSize(sizeHint());
     160
     161            /* Store the new size to prevent unwanted resize hints being sent back: */
     162            storeConsoleSize(pResizeEvent->width(), pResizeEvent->height());
     163
     164            /* Perform machine-view resize: */
     165            resize(pResizeEvent->width(), pResizeEvent->height());
     166
     167            /* Let our toplevel widget calculate its sizeHint properly. */
     168#ifdef Q_WS_X11
     169            /* We use processEvents rather than sendPostedEvents & set the time out value to max cause on X11 otherwise
     170             * the layout isn't calculated correctly. Dosn't find the bug in Qt, but this could be triggered through
     171             * the async nature of the X11 window event system. */
     172            QCoreApplication::processEvents(QEventLoop::AllEvents, INT_MAX);
     173#else /* Q_WS_X11 */
     174            QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
     175#endif /* Q_WS_X11 */
     176
     177#ifdef Q_WS_MAC
     178            machineLogic()->updateDockIconSize(screenId(), pResizeEvent->width(), pResizeEvent->height());
     179#endif /* Q_WS_MAC */
     180
     181            /* Update mouse cursor shape: */
     182            updateMouseCursorShape();
     183
     184            /* May be we have to restrict minimum size? */
     185            maybeRestrictMinimumSize();
     186
     187            /* Update machine-view sliders: */
     188            updateSliders();
     189
     190            /* Normalize geometry: */
     191            normalizeGeometry(true /* adjustPosition */);
     192
     193            /* Report to the VM thread that we finished resizing */
     194            session().GetConsole().GetDisplay().ResizeCompleted(screenId());
     195
     196            /* We are finishing to perform machine-view resize: */
     197            setMachineWindowResizeIgnored(oldIgnoreMainwndResize);
     198
     199            /* Make sure that all posted signals are processed: */
     200            qApp->processEvents();
     201
     202            /* We also recalculate the desktop geometry if this is determined
     203             * automatically.  In fact, we only need this on the first resize,
     204             * but it is done every time to keep the code simpler. */
     205            calculateDesktopGeometry();
     206
     207            /* Emit a signal about guest was resized: */
     208            emit resizeHintDone();
     209
     210            return true;
     211        }
     212
    141213#ifndef Q_WS_MAC
    142     switch (pEvent->type())
    143     {
     214        /* We don't want this on the Mac, cause there the menu bar isn't within the
     215         * window and popping up a menu there looks really ugly. */
    144216        case QEvent::KeyPress:
    145217        case QEvent::KeyRelease:
     
    186258                    pEvent->ignore();
    187259            }
     260
     261            break;
    188262        }
     263#endif /* !Q_WS_MAC */
     264
    189265        default:
    190266            break;
    191267    }
    192 #endif /* !Q_WS_MAC */
    193268    return UIMachineView::event(pEvent);
    194269}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp

    r28800 r30259  
    161161        }
    162162
     163        case VBoxDefs::ResizeEventType:
     164        {
     165            /* Some situations require framebuffer resize events to be ignored at all,
     166             * leaving machine-window, machine-view and framebuffer sizes preserved: */
     167            if (uisession()->isGuestResizeIgnored())
     168                return true;
     169
     170            /* We are starting to perform machine-view resize: */
     171            bool oldIgnoreMainwndResize = isMachineWindowResizeIgnored();
     172            setMachineWindowResizeIgnored(true);
     173
     174            /* Get guest resize-event: */
     175            UIResizeEvent *pResizeEvent = static_cast<UIResizeEvent*>(pEvent);
     176
     177            /* Perform framebuffer resize: */
     178            frameBuffer()->resizeEvent(pResizeEvent);
     179
     180            /* Reapply maximum size restriction for machine-view: */
     181            setMaximumSize(sizeHint());
     182
     183            /* Store the new size to prevent unwanted resize hints being sent back: */
     184            storeConsoleSize(pResizeEvent->width(), pResizeEvent->height());
     185
     186            /* Perform machine-view resize: */
     187            resize(pResizeEvent->width(), pResizeEvent->height());
     188
     189            /* Let our toplevel widget calculate its sizeHint properly. */
     190#ifdef Q_WS_X11
     191            /* We use processEvents rather than sendPostedEvents & set the time out value to max cause on X11 otherwise
     192             * the layout isn't calculated correctly. Dosn't find the bug in Qt, but this could be triggered through
     193             * the async nature of the X11 window event system. */
     194            QCoreApplication::processEvents(QEventLoop::AllEvents, INT_MAX);
     195#else /* Q_WS_X11 */
     196            QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
     197#endif /* Q_WS_X11 */
     198
     199#ifdef Q_WS_MAC
     200            machineLogic()->updateDockIconSize(screenId(), pResizeEvent->width(), pResizeEvent->height());
     201#endif /* Q_WS_MAC */
     202
     203            /* Update mouse cursor shape: */
     204            updateMouseCursorShape();
     205
     206            /* Update machine-view sliders: */
     207            updateSliders();
     208
     209            /* Report to the VM thread that we finished resizing */
     210            session().GetConsole().GetDisplay().ResizeCompleted(screenId());
     211
     212            /* We are finishing to perform machine-view resize: */
     213            setMachineWindowResizeIgnored(oldIgnoreMainwndResize);
     214
     215            /* Make sure that all posted signals are processed: */
     216            qApp->processEvents();
     217
     218            /* We also recalculate the desktop geometry if this is determined
     219             * automatically.  In fact, we only need this on the first resize,
     220             * but it is done every time to keep the code simpler. */
     221            calculateDesktopGeometry();
     222
     223            /* Emit a signal about guest was resized: */
     224            emit resizeHintDone();
     225
     226            /* Unlock after processing guest resize event: */
     227            if (m_pSyncBlocker && m_pSyncBlocker->isRunning())
     228                m_pSyncBlocker->quit();
     229
     230            return true;
     231        }
     232
    163233        case QEvent::KeyPress:
    164234        case QEvent::KeyRelease:
     
    175245                    pEvent->ignore();
    176246            }
    177         }
    178 
    179         case VBoxDefs::ResizeEventType:
    180         {
    181             /* Unlock after processing guest resize event: */
    182             bool fResult = UIMachineView::event(pEvent);
    183             if (m_pSyncBlocker && m_pSyncBlocker->isRunning())
    184                 m_pSyncBlocker->quit();
    185             return fResult;
     247
     248            break;
    186249        }
    187250
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette