Changeset 65417 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 24, 2017 10:50:34 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
r63054 r65417 172 172 void UIMachineWindowSeamless::placeOnScreen() 173 173 { 174 /* Make sure this window has seamless logic: */ 175 UIMachineLogicSeamless *pSeamlessLogic = qobject_cast<UIMachineLogicSeamless*>(machineLogic()); 176 AssertPtrReturnVoid(pSeamlessLogic); 177 174 178 /* Get corresponding host-screen: */ 175 const int iHostScreen = qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);179 const int iHostScreen = pSeamlessLogic->hostScreenForGuestScreen(m_uScreenId); 176 180 /* And corresponding working area: */ 177 181 const QRect workingArea = gpDesktop->availableGeometry(iHostScreen); 178 179 /* Set appropriate geometry for window: */ 180 resize(workingArea.size()); 181 move(workingArea.topLeft()); 182 Q_UNUSED(workingArea); 183 184 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 185 186 /* Make sure we are located on corresponding host-screen: */ 187 if ( gpDesktop->screenCount() > 1 188 && (x() != workingArea.x() || y() != workingArea.y())) 189 { 190 // WORKAROUND: 191 // With Qt5 on X11 we can't just move the window onto desired host-screen if 192 // window size is more than the available geometry (working area) of that 193 // host-screen. So we are resizing it to a smaller size first of all: 194 const QSize newSize = workingArea.size() * .9; 195 LogRel(("GUI: UIMachineWindowSeamless::placeOnScreen: Resize window: %d to smaller size: %dx%d\n", 196 m_uScreenId, newSize.width(), newSize.height())); 197 resize(newSize); 198 /* Move window onto required screen: */ 199 const QPoint newPosition = workingArea.topLeft(); 200 LogRel(("GUI: UIMachineWindowSeamless::placeOnScreen: Move window: %d to: %dx%d\n", 201 m_uScreenId, newPosition.x(), newPosition.y())); 202 move(newPosition); 203 } 204 205 #else 206 207 /* Set appropriate window geometry: */ 208 const QSize newSize = workingArea.size(); 209 LogRel(("GUI: UIMachineWindowSeamless::placeOnScreen: Resize window: %d to: %dx%d\n", 210 m_uScreenId, newSize.width(), newSize.height())); 211 resize(newSize); 212 const QPoint newPosition = workingArea.topLeft(); 213 LogRel(("GUI: UIMachineWindowSeamless::placeOnScreen: Move window: %d to: %dx%d\n", 214 m_uScreenId, newPosition.x(), newPosition.y())); 215 move(newPosition); 216 217 #endif 182 218 } 183 219 … … 212 248 placeOnScreen(); 213 249 214 /* Show window in normal mode: */ 250 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 251 /* Show window: */ 252 if (!isMaximized()) 253 showMaximized(); 254 #else 255 /* Show window: */ 215 256 show(); 257 #endif 216 258 217 259 /* Restore minimized state if necessary: */
Note:
See TracChangeset
for help on using the changeset viewer.