Changeset 46360 in vbox
- Timestamp:
- Jun 3, 2013 12:42:17 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r46359 r46360 205 205 } 206 206 207 void UIMachineView::sltHandleNotifyUpdate(int iX, int iY, int iW, int iH) 207 bool UIMachineView::guestResizeEvent(QEvent *pEvent, 208 bool fFullscreenOrSeamless) 209 { 210 /* Some situations require framebuffer resize events to be ignored at all, 211 * leaving machine-window, machine-view and framebuffer sizes preserved: */ 212 if (uisession()->isGuestResizeIgnored()) 213 return true; 214 215 /* Get guest resize-event: */ 216 UIResizeEvent *pResizeEvent = static_cast<UIResizeEvent*>(pEvent); 217 218 /** If only the pitch has changed (or nothing at all!) we only update the 219 * framebuffer and don't touch the window. This prevents unwanted resizes 220 * when entering or exiting fullscreen on X.Org guests and when 221 * re-attaching the framebuffer on a view switch. */ 222 bool fResize = pResizeEvent->width() != frameBuffer()->width() 223 || pResizeEvent->height() != frameBuffer()->height(); 224 225 /* Perform framebuffer resize if parent window is visible: */ 226 if (uisession()->isScreenVisible(m_uScreenId)) 227 frameBuffer()->resizeEvent(pResizeEvent); 228 229 if (fResize && uisession()->isScreenVisible(m_uScreenId)) 230 { 231 /* Reapply maximum size restriction for machine-view: */ 232 setMaximumSize(sizeHint()); 233 234 /* Disable the resize hint override hack: */ 235 m_sizeHintOverride = QSize(-1, -1); 236 237 /* Perform machine-view resize: */ 238 resize(pResizeEvent->width(), pResizeEvent->height()); 239 240 /* Let our toplevel widget calculate its sizeHint properly: */ 241 QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest); 242 243 #ifdef Q_WS_MAC 244 machineLogic()->updateDockIconSize(screenId(), pResizeEvent->width(), pResizeEvent->height()); 245 #endif /* Q_WS_MAC */ 246 247 /* Update machine-view sliders: */ 248 updateSliders(); 249 250 /* Normalize machine-window geometry: */ 251 if (!fFullscreenOrSeamless) 252 normalizeGeometry(true /* Adjust Position? */); 253 } 254 255 /* Report to the VM thread that we finished resizing: */ 256 session().GetConsole().GetDisplay().ResizeCompleted(screenId()); 257 258 /* Emit a signal about guest was resized: */ 259 emit resizeHintDone(); 260 261 pEvent->accept(); 262 return true; 263 } 264 265 void UIMachineView::sltHandleNotifyUpdate(int iX, int iY, int iWidth, int iHeight) 208 266 { 209 267 /* Update corresponding viewport part: */ 210 viewport()->update(iX - contentsX(), iY - contentsY(), iW , iH);268 viewport()->update(iX - contentsX(), iY - contentsY(), iWidth, iHeight); 211 269 } 212 270 … … 843 901 #endif /* Q_WS_MAC */ 844 902 845 bool UIMachineView::guestResizeEvent(QEvent *pEvent,846 bool fFullscreenOrSeamless)847 {848 /* Some situations require framebuffer resize events to be ignored at all,849 * leaving machine-window, machine-view and framebuffer sizes preserved: */850 if (uisession()->isGuestResizeIgnored())851 return true;852 853 /* Get guest resize-event: */854 UIResizeEvent *pResizeEvent = static_cast<UIResizeEvent*>(pEvent);855 856 /** If only the pitch has changed (or nothing at all!) we only update the857 * framebuffer and don't touch the window. This prevents unwanted resizes858 * when entering or exiting fullscreen on X.Org guests and when859 * re-attaching the framebuffer on a view switch. */860 bool fResize = pResizeEvent->width() != frameBuffer()->width()861 || pResizeEvent->height() != frameBuffer()->height();862 863 /* Perform framebuffer resize if parent window is visible: */864 if (uisession()->isScreenVisible(m_uScreenId))865 frameBuffer()->resizeEvent(pResizeEvent);866 867 if (fResize && uisession()->isScreenVisible(m_uScreenId))868 {869 /* Reapply maximum size restriction for machine-view: */870 setMaximumSize(sizeHint());871 872 /* Disable the resize hint override hack: */873 m_sizeHintOverride = QSize(-1, -1);874 875 /* Perform machine-view resize: */876 resize(pResizeEvent->width(), pResizeEvent->height());877 878 /* Let our toplevel widget calculate its sizeHint properly: */879 QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);880 881 #ifdef Q_WS_MAC882 machineLogic()->updateDockIconSize(screenId(), pResizeEvent->width(), pResizeEvent->height());883 #endif /* Q_WS_MAC */884 885 /* Update machine-view sliders: */886 updateSliders();887 888 /* Normalize machine-window geometry: */889 if (!fFullscreenOrSeamless)890 normalizeGeometry(true /* Adjust Position? */);891 }892 893 /* Report to the VM thread that we finished resizing: */894 session().GetConsole().GetDisplay().ResizeCompleted(screenId());895 896 /* Emit a signal about guest was resized: */897 emit resizeHintDone();898 899 pEvent->accept();900 return true;901 }902 903 903 UIVisualStateType UIMachineView::visualStateType() const 904 904 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r46293 r46360 93 93 94 94 /* Handler: Frame-buffer NotifyUpdate stuff: */ 95 v irtual void sltHandleNotifyUpdate(int iX, int iY, int iW, int iH);95 void sltHandleNotifyUpdate(int iX, int iY, int iWidth, int iHeight); 96 96 97 97 /* Watch dog for desktop resizes: */
Note:
See TracChangeset
for help on using the changeset viewer.