void UIMachineLogicSeamless::prepareMachineWindows() { /* Do not create machine-window(s) if they created already: */ if (isMachineWindowsCreated()) return; #ifdef VBOX_WS_MAC /* We have to make sure that we are getting the front most process. * This is necessary for Qt versions > 4.3.3: */ darwinSetFrontMostProcess(); #endif /* VBOX_WS_MAC */ /* Update the multi-screen layout: */ m_pScreenLayout->update(); /* Create machine-window(s): */ for (uint cScreenId = 0; cScreenId < machine().GetMonitorCount(); ++cScreenId) addMachineWindow(UIMachineWindow::create(this, cScreenId)); /* Listen for frame-buffer resize: */ foreach (UIMachineWindow *pMachineWindow, machineWindows()) connect(pMachineWindow, SIGNAL(sigFrameBufferResize()), this, SIGNAL(sigFrameBufferResize())); emit sigFrameBufferResize(); /* Connect multi-screen layout change handler: */ connect(m_pScreenLayout, SIGNAL(sigScreenLayoutChange()), this, SLOT(sltScreenLayoutChanged())); /* Mark machine-window(s) created: */ setMachineWindowsCreated(true); #ifdef VBOX_WS_X11 switch (vboxGlobal().typeOfWindowManager()) { case X11WMType_GNOMEShell: case X11WMType_Mutter: { // WORKAROUND: // Under certain WMs we can loose machine-window activation due to any Qt::Tool // overlay asynchronously shown above it. Qt is not become aware of such event. // We are going to ask to return machine-window activation in let's say 100ms. QTimer::singleShot(100, machineWindows().first(), SLOT(sltActivateWindow())); break; } default: break; } #endif /* VBOX_WS_X11 */ }
void UISlidingToolBar::prepareGeometry() { /* Prepare geometry based on parent and mdi-sub-window size-hints, * But move mdi-sub-window to initial position: */ const QSize sh = m_pEmbeddedWidget->sizeHint(); switch (m_position) { case Position_Top: { setGeometry(m_parentRect.x(), m_parentRect.y() + m_indentRect.height(), qMax(m_parentRect.width(), sh.width()), sh.height()); m_pEmbeddedWidget->setGeometry(0, -sh.height(), qMax(width(), sh.width()), sh.height()); break; } case Position_Bottom: { setGeometry(m_parentRect.x(), m_parentRect.y() + m_parentRect.height() - m_indentRect.height() - sh.height(), qMax(m_parentRect.width(), sh.width()), sh.height()); m_pEmbeddedWidget->setGeometry(0, sh.height(), qMax(width(), sh.width()), sh.height()); break; } } #ifdef Q_WS_X11 if (!QX11Info::isCompositingManagerRunning()) { /* Use Xshape otherwise: */ setMask(m_pEmbeddedWidget->geometry()); } #endif /* Q_WS_X11 */ #ifdef Q_WS_WIN /* Raise tool-window for proper z-order. */ raise(); #endif /* Q_WS_WIN */ /* Activate window after it was shown: */ connect(this, SIGNAL(sigShown()), this, SLOT(sltActivateWindow()), Qt::QueuedConnection); /* Update window geometry after parent geometry changed: */ connect(parent(), SIGNAL(sigGeometryChange(const QRect&)), this, SLOT(sltParentGeometryChanged(const QRect&))); }