Changeset 46225 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 22, 2013 7:32:28 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 85954
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
r44952 r46225 84 84 case SetRegionEventType: 85 85 { 86 /* Get region-update event: */86 /* Apply new seamless-region: */ 87 87 UISetRegionEvent *pSetRegionEvent = static_cast<UISetRegionEvent*>(pEvent); 88 89 /* Apply new region: */ 90 if (pSetRegionEvent->region() != m_lastVisibleRegion) 91 { 92 m_lastVisibleRegion = pSetRegionEvent->region(); 93 machineWindow()->setMask(m_lastVisibleRegion); 94 } 88 m_lastVisibleRegion = pSetRegionEvent->region(); 89 machineWindow()->setMask(m_lastVisibleRegion); 95 90 return true; 96 91 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
r46224 r46225 97 97 /* This might be required to correctly mask: */ 98 98 centralWidget()->setAutoFillBackground(false); 99 100 #ifdef Q_WS_WIN101 /* Get corresponding screen: */102 int iScreen = qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);103 /* Prepare previous region: */104 m_prevRegion = vboxGlobal().availableGeometry(iScreen);105 #endif /* Q_WS_WIN */106 99 107 100 #ifdef Q_WS_MAC … … 280 273 #endif /* Q_WS_MAC */ 281 274 282 void UIMachineWindowSeamless::setMask(const QRegion &constRegion) 283 { 284 /* Could be unused under Mac: */ 285 Q_UNUSED(constRegion); 286 287 #ifndef Q_WS_MAC 288 /* Copy mask: */ 289 QRegion region = constRegion; 290 275 void UIMachineWindowSeamless::setMask(const QRegion &incomingRegion) 276 { 277 /* Copy region: */ 278 QRegion region(incomingRegion); 279 280 #ifndef Q_WS_MAC 291 281 /* Shift region if left spacer width is NOT zero or top spacer height is NOT zero: */ 292 282 if (m_pLeftSpacer->geometry().width() || m_pTopSpacer->geometry().height()) … … 304 294 #endif /* !Q_WS_MAC */ 305 295 306 #if defined (Q_WS_WIN) 307 # if 0 /* This code is disabled for a long time already, need analisys... */ 308 QRegion difference = m_prevRegion.subtract(region); 309 310 /* Region offset calculation */ 311 int fleft = 0, ftop = 0; 312 313 /* Visible region calculation */ 314 HRGN newReg = CreateRectRgn(0, 0, 0, 0); 315 CombineRgn(newReg, region.handle(), 0, RGN_COPY); 316 OffsetRgn(newReg, fleft, ftop); 317 318 /* Invisible region calculation */ 319 HRGN diffReg = CreateRectRgn(0, 0, 0, 0); 320 CombineRgn(diffReg, difference.handle(), 0, RGN_COPY); 321 OffsetRgn(diffReg, fleft, ftop); 322 323 /* Set the current visible region and clean the previous */ 324 SetWindowRgn(winId(), newReg, FALSE); 325 RedrawWindow(0, 0, diffReg, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); 326 if (machineView()) 327 RedrawWindow(machineView()->viewport()->winId(), 0, 0, RDW_INVALIDATE); 328 329 m_prevRegion = region; 330 # endif /* This code is disabled for a long time already, need analisys... */ 331 UIMachineWindow::setMask(region); 332 #elif defined (Q_WS_MAC) 333 # ifdef VBOX_GUI_USE_QUARTZ2D 296 #ifdef VBOX_GUI_USE_QUARTZ2D 334 297 if (vboxGlobal().vmRenderMode() == Quartz2DMode) 335 298 { … … 338 301 ::darwinWindowInvalidateShape(m_pMachineView->viewport()); 339 302 } 340 # else /* VBOX_GUI_USE_QUARTZ2D */ 341 UIMachineWindow::setMask(constRegion); 342 # endif /* !VBOX_GUI_USE_QUARTZ2D */ 343 #else /* !Q_WS_MAC */ 344 UIMachineWindow::setMask(region); 345 #endif 346 } 347 303 #else /* VBOX_GUI_USE_QUARTZ2D */ 304 /* Seamless-window for empty region should be empty too, 305 * but native API wrapped by the QWidget::setMask() doesn't allow this. 306 * Instead, we have a full painted screen of seamless-geometry size visible. 307 * Moreover, we can't just hide the empty seamless-window as 'hiding' 308 * 1. will collide with the multi-screen layout behavior and 309 * 2. will cause a task-bar flicker on moving window from one screen to another. 310 * As a temporary though quite a dirty workaround we have to make sure 311 * region have at least one pixel. */ 312 if (region.isEmpty()) 313 region += QRect(0, 0, 1, 1); 314 /* Make sure region had changed: */ 315 if (m_previousRegion != region) 316 { 317 /* Remember new region: */ 318 m_previousRegion = region; 319 /* Assign new region: */ 320 UIMachineWindow::setMask(m_previousRegion); 321 /* Update viewport contents: */ 322 m_pMachineView->viewport()->update(); 323 } 324 #endif /* !VBOX_GUI_USE_QUARTZ2D */ 325 } 326 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h
r46224 r46225 96 96 97 97 /* Variables: */ 98 #ifdef Q_WS_WIN 99 QRegion m_prevRegion; 100 #endif /* Q_WS_WIN */ 98 QRegion m_previousRegion; 101 99 102 100 /* Factory support: */
Note:
See TracChangeset
for help on using the changeset viewer.