Changeset 44859 in vbox
- Timestamp:
- Feb 28, 2013 10:38:28 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
r44827 r44859 131 131 /* Friend classes: */ 132 132 friend class UIMachineLogic; 133 friend class UIMachineLogicFullscreen; 134 friend class UIMachineLogicSeamless; 133 135 }; 134 136 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r44848 r44859 106 106 } 107 107 108 bool UIMachineLogicFullscreen::hasHostScreenForGuestScreen(int iScreenId) const 109 { 110 return m_pScreenLayout->hasHostScreenForGuestScreen(iScreenId); 111 } 112 108 113 #ifdef Q_WS_MAC 109 114 void UIMachineLogicFullscreen::sltChangePresentationMode(bool /* fEnabled */) … … 165 170 for (int i = 0; i < machineWindows().size(); ++i) 166 171 connect(m_pScreenLayout, SIGNAL(sigScreenLayoutChanged()), 167 static_cast<UIMachineWindowFullscreen*>(machineWindows()[i]), SLOT(slt PlaceOnScreen()));172 static_cast<UIMachineWindowFullscreen*>(machineWindows()[i]), SLOT(sltShowInNecessaryMode())); 168 173 169 174 #ifdef Q_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
r44848 r44859 45 45 /* Multi-screen stuff: */ 46 46 int hostScreenForGuestScreen(int iScreenId) const; 47 bool hasHostScreenForGuestScreen(int iScreenId) const; 47 48 48 49 private slots: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r43666 r44859 7 7 8 8 /* 9 * Copyright (C) 2010-201 2Oracle Corporation9 * Copyright (C) 2010-2013 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 52 52 /* Update mini-toolbar: */ 53 53 updateAppearanceOf(UIVisualElement_MiniToolBar); 54 }55 56 void UIMachineWindowFullscreen::sltPlaceOnScreen()57 {58 /* Get corresponding screen: */59 int iScreen = qobject_cast<UIMachineLogicFullscreen*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);60 /* Calculate working area: */61 QRect workingArea = QApplication::desktop()->screenGeometry(iScreen);62 /* Move to the appropriate position: */63 move(workingArea.topLeft());64 /* Resize to the appropriate size: */65 resize(workingArea.size());66 /* Process pending move & resize events: */67 qApp->processEvents();68 54 } 69 55 … … 168 154 } 169 155 156 void UIMachineWindowFullscreen::placeOnScreen() 157 { 158 /* Get corresponding screen: */ 159 int iScreen = qobject_cast<UIMachineLogicFullscreen*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId); 160 /* Calculate working area: */ 161 QRect workingArea = QApplication::desktop()->screenGeometry(iScreen); 162 /* Move to the appropriate position: */ 163 move(workingArea.topLeft()); 164 /* Resize to the appropriate size: */ 165 resize(workingArea.size()); 166 /* Process pending move & resize events: */ 167 qApp->processEvents(); 168 } 169 170 170 void UIMachineWindowFullscreen::showInNecessaryMode() 171 171 { 172 /* Sho w window if we have to: */172 /* Should we show window?: */ 173 173 if (uisession()->isScreenVisible(m_uScreenId)) 174 174 { 175 /* Make sure the window is placed on valid screen 176 * before we are show fullscreen window: */ 177 sltPlaceOnScreen(); 175 /* Do we have the seamless logic? */ 176 if (UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic())) 177 { 178 /* Is this guest screen has own host screen? */ 179 if (pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId)) 180 { 181 /* Make sure the window is placed on valid screen 182 * before we are show fullscreen window: */ 183 placeOnScreen(); 178 184 179 185 #ifdef Q_WS_WIN 180 /* On Windows we should activate main window first,181 * because entering fullscreen there doesn't means window will be auto-activated,182 * so no window-activation event will be received183 * and no keyboard-hook created otherwise... */184 if (m_uScreenId == 0)185 setWindowState(windowState() | Qt::WindowActive);186 /* On Windows we should activate main window first, 187 * because entering fullscreen there doesn't means window will be auto-activated, 188 * so no window-activation event will be received 189 * and no keyboard-hook created otherwise... */ 190 if (m_uScreenId == 0) 191 setWindowState(windowState() | Qt::WindowActive); 186 192 #endif /* Q_WS_WIN */ 187 193 188 /* Show window fullscreen: */189 showFullScreen();190 191 /* Make sure the window is placed on valid screen again192 * after window is shown & window's decorations applied.193 * That is required due to X11 Window Geometry Rules. */194 sltPlaceOnScreen();194 /* Show window fullscreen: */ 195 showFullScreen(); 196 197 /* Make sure the window is placed on valid screen again 198 * after window is shown & window's decorations applied. 199 * That is required due to X11 Window Geometry Rules. */ 200 placeOnScreen(); 195 201 196 202 #ifdef Q_WS_MAC 197 /* Make sure it is really on the right place (especially on the Mac): */198 QRect r = QApplication::desktop()->screenGeometry(qobject_cast<UIMachineLogicFullscreen*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId));199 move(r.topLeft());203 /* Make sure it is really on the right place (especially on the Mac): */ 204 QRect r = QApplication::desktop()->screenGeometry(qobject_cast<UIMachineLogicFullscreen*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId)); 205 move(r.topLeft()); 200 206 #endif /* Q_WS_MAC */ 207 208 /* Return early: */ 209 return; 210 } 211 } 201 212 } 202 /* Else hide window: */203 elsehide();213 /* Hide in other cases: */ 214 hide(); 204 215 } 205 216 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
r41114 r44859 6 6 7 7 /* 8 * Copyright (C) 2010-201 2Oracle Corporation8 * Copyright (C) 2010-2013 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 41 41 void sltMachineStateChanged(); 42 42 43 /* Places window on screen: */44 void slt PlaceOnScreen();43 /* Show in necessary mode: */ 44 void sltShowInNecessaryMode() { showInNecessaryMode(); } 45 45 46 46 /* Popup main-menu: */ … … 60 60 61 61 /* Show stuff: */ 62 void placeOnScreen(); 62 63 void showInNecessaryMode(); 63 64 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
r44848 r44859 92 92 } 93 93 94 bool UIMachineLogicSeamless::hasHostScreenForGuestScreen(int iScreenId) const 95 { 96 return m_pScreenLayout->hasHostScreenForGuestScreen(iScreenId); 97 } 98 94 99 void UIMachineLogicSeamless::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo) 95 100 { … … 145 150 for (int i = 0; i < machineWindows().size(); ++i) 146 151 connect(m_pScreenLayout, SIGNAL(sigScreenLayoutChanged()), 147 static_cast<UIMachineWindowSeamless*>(machineWindows()[i]), SLOT(slt PlaceOnScreen()));152 static_cast<UIMachineWindowSeamless*>(machineWindows()[i]), SLOT(sltShowInNecessaryMode())); 148 153 149 154 /* Remember what machine window(s) created: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.h
r44848 r44859 42 42 /* Multi-screen stuff: */ 43 43 int hostScreenForGuestScreen(int iScreenId) const; 44 bool hasHostScreenForGuestScreen(int iScreenId) const; 44 45 45 46 private slots: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
r41689 r44859 7 7 8 8 /* 9 * Copyright (C) 2010-201 2Oracle Corporation9 * Copyright (C) 2010-2013 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 62 62 } 63 63 #endif /* !Q_WS_MAC */ 64 65 void UIMachineWindowSeamless::sltPlaceOnScreen()66 {67 /* Get corresponding screen: */68 int iScreen = qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);69 /* Calculate working area: */70 QRect workingArea = vboxGlobal().availableGeometry(iScreen);71 /* Move to the appropriate position: */72 move(workingArea.topLeft());73 /* Resize to the appropriate size: */74 resize(workingArea.size());75 /* Process pending move & resize events: */76 qApp->processEvents();77 }78 64 79 65 void UIMachineWindowSeamless::sltPopupMainMenu() … … 220 206 } 221 207 208 void UIMachineWindowSeamless::placeOnScreen() 209 { 210 /* Get corresponding screen: */ 211 int iScreen = qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId); 212 /* Calculate working area: */ 213 QRect workingArea = vboxGlobal().availableGeometry(iScreen); 214 /* Move to the appropriate position: */ 215 move(workingArea.topLeft()); 216 /* Resize to the appropriate size: */ 217 resize(workingArea.size()); 218 /* Process pending move & resize events: */ 219 qApp->processEvents(); 220 } 221 222 222 void UIMachineWindowSeamless::showInNecessaryMode() 223 223 { 224 /* Sho w window if we have to: */224 /* Should we show window?: */ 225 225 if (uisession()->isScreenVisible(m_uScreenId)) 226 226 { 227 /* Show manually maximized window: */ 228 sltPlaceOnScreen(); 229 230 /* Show normal window: */ 231 show(); 232 233 #ifdef Q_WS_MAC 234 /* Make sure it is really on the right place (especially on the Mac): */ 235 int iScreen = qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId); 236 QRect r = vboxGlobal().availableGeometry(iScreen); 237 move(r.topLeft()); 238 #endif /* Q_WS_MAC */ 239 } 240 /* Else hide window: */ 241 else hide(); 227 /* Do we have the seamless logic? */ 228 if (UIMachineLogicSeamless *pSeamlessLogic = qobject_cast<UIMachineLogicSeamless*>(machineLogic())) 229 { 230 /* Is this guest screen has own host screen? */ 231 if (pSeamlessLogic->hasHostScreenForGuestScreen(m_uScreenId)) 232 { 233 /* Show manually maximized window: */ 234 placeOnScreen(); 235 236 /* Show normal window: */ 237 show(); 238 239 #ifdef Q_WS_MAC 240 /* Make sure it is really on the right place (especially on the Mac): */ 241 QRect r = vboxGlobal().availableGeometry(qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId)); 242 move(r.topLeft()); 243 #endif /* Q_WS_MAC */ 244 245 /* Return early: */ 246 return; 247 } 248 } 249 } 250 /* Hide in other cases: */ 251 hide(); 242 252 } 243 253 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h
r41115 r44859 6 6 7 7 /* 8 * Copyright (C) 2010-201 2Oracle Corporation8 * Copyright (C) 2010-2013 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 43 43 #endif /* !Q_WS_MAC */ 44 44 45 /* Places window on screen: */46 void slt PlaceOnScreen();45 /* Show in necessary mode: */ 46 void sltShowInNecessaryMode() { showInNecessaryMode(); } 47 47 48 48 /* Popup main menu: */ … … 79 79 80 80 /* Show stuff: */ 81 void placeOnScreen(); 81 82 void showInNecessaryMode(); 82 83
Note:
See TracChangeset
for help on using the changeset viewer.