- Timestamp:
- May 21, 2008 7:34:43 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h
r8902 r9036 98 98 void fixModifierState (LONG *codes, uint *count); 99 99 100 void toggleFSMode ();100 void toggleFSMode (const QSize &aSize = QSize()); 101 101 102 102 void setIgnoreMainwndResize (bool aYes) { mIgnoreMainwndResize = aYes; } … … 249 249 250 250 QTimer *resize_hint_timer; 251 QTimer *mToggleFSModeTimer;252 251 253 252 VBoxDefs::RenderMode mode; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r8813 r9036 190 190 void dbgLoggingToggled (bool); 191 191 192 void onEnterFullscreen();193 192 void onExitFullscreen(); 194 void exitFullscreen(); 195 void exitSeamless(); 193 void unlockActionsSwitch(); 196 194 197 195 void setViewInSeamlessMode (const QRect &aTargetRect); … … 329 327 bool mIsSeamlessSupported : 1; 330 328 bool mIsGraphicsSupported : 1; 329 bool mIsWaitingModeResize : 1; 331 330 int normal_wflags; 332 331 bool was_max : 1; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r8902 r9036 684 684 this, SLOT (doResizeHint())); 685 685 686 /* This timer is used as 'last resort' which toggles f/s mode687 in case of guest additions are not responding. */688 mToggleFSModeTimer = new QTimer (this);689 connect (mToggleFSModeTimer, SIGNAL (timeout()),690 this, SIGNAL (resizeHintDone()));691 692 686 /* setup rendering */ 693 687 … … 783 777 setDesktopGeometry (DesktopGeo_Fixed, width, height); 784 778 } 785 connect (QApplication::desktop(), SIGNAL ( workAreaResized (int)),779 connect (QApplication::desktop(), SIGNAL (resized (int)), 786 780 this, SLOT (doResizeDesktop (int))); 787 781 … … 1071 1065 LogFlow (("VBoxDefs::ResizeEventType: %d x %d x %d bpp\n", 1072 1066 re->width(), re->height(), re->bitsPerPixel())); 1073 1074 if (mToggleFSModeTimer->isActive())1075 mToggleFSModeTimer->stop();1076 1067 1077 1068 /* do frame buffer dependent resize */ … … 2251 2242 * Called on enter/exit seamless/fullscreen mode. 2252 2243 */ 2253 void VBoxConsoleView::toggleFSMode ()2244 void VBoxConsoleView::toggleFSMode (const QSize &aSize) 2254 2245 { 2255 2246 if ((mIsAdditionsActive && mAutoresizeGuest) || 2256 2247 mMainWnd->isTrueFullscreen()) 2257 2248 { 2258 QSize newSize = QSize();2259 if ( mMainWnd->isTrueFullscreen() || mMainWnd->isTrueSeamless())2260 { 2261 mNormalSize = frameSize();2249 QSize newSize; 2250 if (aSize.isValid()) 2251 { 2252 mNormalSize = aSize; 2262 2253 newSize = maximumSize(); 2263 2254 } … … 2266 2257 doResizeHint (newSize); 2267 2258 } 2268 /* Currently there is 2000 msec pause before timer transfers2269 * console into desired mode "if GA are active and auto-resize2270 * feature enabled" and 100 msec pause before it transfers2271 * console into this mode "if GA are not active or auto-resize2272 * feature disabled". 100 msec pause required for resizing2273 * before normalizing geometry. */2274 mToggleFSModeTimer->start (mIsAdditionsActive && mAutoresizeGuest ?2275 2000 : 100, true);2276 2277 /// @todo (r=dsen) perform roll-back after 'entering' mode in case2278 // we got no resizing response from the guest.2279 2259 } 2280 2260 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r9028 r9036 122 122 , mIsSeamlessSupported (false) 123 123 , mIsGraphicsSupported (false) 124 , mIsWaitingModeResize (false) 124 125 , normal_wflags (getWFlags()) 125 126 , was_max (false) … … 1034 1035 1035 1036 /** 1036 * This slot is called just after entering the fullscreen/seamless mode,1037 * when the console was resized to required size.1038 */1039 void VBoxConsoleWnd::onEnterFullscreen()1040 {1041 disconnect (console, SIGNAL (resizeHintDone()), 0, 0);1042 /* It isn't guaranteed that the guest os set the video mode that1043 * we requested. So after all the resizing stuff set the clipping1044 * mask and the spacing shifter to the corresponding values. */1045 setViewInSeamlessMode (QRect (console->mapToGlobal (QPoint (0, 0)), console->size()));1046 #ifdef Q_WS_MAC1047 if (!mIsSeamless)1048 {1049 /* Fade back to the normal gamma */1050 CGDisplayFade (mFadeToken, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, false);1051 CGReleaseDisplayFadeReservation (mFadeToken);1052 }1053 #endif1054 1055 vmSeamlessAction->setEnabled (mIsSeamless);1056 vmFullscreenAction->setEnabled (mIsFullscreen);1057 if (mIsSeamless)1058 connect (console, SIGNAL (resizeHintDone()),1059 this, SLOT (exitSeamless()));1060 /* disabled for now */1061 //else if (mIsFullscreen)1062 // connect (console, SIGNAL (resizeHintDone()),1063 // this, SLOT (exitFullscreen()));1064 }1065 1066 /**1067 1037 * This slot is called just after leaving the fullscreen/seamless mode, 1068 1038 * when the console was resized to previous size. … … 1070 1040 void VBoxConsoleWnd::onExitFullscreen() 1071 1041 { 1072 disconnect (console, SIGNAL (resizeHintDone()), 0, 0); 1042 console->setIgnoreMainwndResize (false); 1043 } 1044 1045 void VBoxConsoleWnd::unlockActionsSwitch() 1046 { 1047 if (mIsSeamless) 1048 vmSeamlessAction->setEnabled (true); 1049 else if (mIsFullscreen) 1050 vmFullscreenAction->setEnabled (true); 1051 else 1052 { 1053 vmSeamlessAction->setEnabled (mIsSeamlessSupported && mIsGraphicsSupported); 1054 vmFullscreenAction->setEnabled (true); 1055 } 1056 1073 1057 #ifdef Q_WS_MAC 1074 1058 if (!mIsSeamless) … … 1079 1063 } 1080 1064 #endif 1081 1082 vmSeamlessAction->setEnabled (mIsSeamlessSupported && mIsGraphicsSupported);1083 vmFullscreenAction->setEnabled (true);1084 1085 console->setIgnoreMainwndResize (false);1086 console->normalizeGeometry (true /* adjustPosition */);1087 }1088 1089 /**1090 * This slot is called if the guest changes resolution while in fullscreen1091 * mode.1092 */1093 void VBoxConsoleWnd::exitFullscreen()1094 {1095 Assert (0); /* disabled for now */1096 if (mIsFullscreen && vmFullscreenAction->isEnabled())1097 vmFullscreenAction->toggle();1098 }1099 1100 /**1101 * This slot is called if the guest changes resolution while in seamless1102 * mode.1103 */1104 void VBoxConsoleWnd::exitSeamless()1105 {1106 if (mIsSeamless && vmSeamlessAction->isEnabled())1107 vmSeamlessAction->toggle();1108 1065 } 1109 1066 … … 1158 1115 QResizeEvent *re = (QResizeEvent *) e; 1159 1116 1160 if (!isMaximized() && !isTrueFullscreen() && !isTrueSeamless()) 1117 if (!mIsWaitingModeResize && !isMaximized() && 1118 !isTrueFullscreen() && !isTrueSeamless()) 1161 1119 { 1162 1120 normal_size = re->size(); … … 1164 1122 dbgAdjustRelativePos(); 1165 1123 #endif 1124 } 1125 1126 if (mIsWaitingModeResize) 1127 { 1128 if (!mIsFullscreen && !mIsSeamless) 1129 { 1130 mIsWaitingModeResize = false; 1131 QTimer::singleShot (0, this, SLOT (onExitFullscreen())); 1132 } 1166 1133 } 1167 1134 break; … … 1975 1942 bool VBoxConsoleWnd::toggleFullscreenMode (bool aOn, bool aSeamless) 1976 1943 { 1977 disconnect (console, SIGNAL (resizeHintDone()), 0, 0); 1978 /* Check if the Guest Video RAM enough for the fullscreen/seamless mode. */ 1944 QSize initialSize = size(); 1979 1945 if (aSeamless || console->isAutoresizeGuestActive()) 1980 1946 { … … 2073 2039 bool wasHidden = isHidden(); 2074 2040 2041 /* Temporarily disable the mode-related action to make sure 2042 * user can not leave the mode before he enter it and inside out. */ 2043 aSeamless ? vmSeamlessAction->setEnabled (false) : 2044 vmFullscreenAction->setEnabled (false); 2045 2046 /* Calculate initial console size */ 2047 QSize consoleSize; 2048 2075 2049 if (aOn) 2076 2050 { 2077 /* Temporarily disable the mode-related action to make sure 2078 * user can not leave the mode before he enter it. */ 2079 aSeamless ? vmSeamlessAction->setEnabled (false) : 2080 vmFullscreenAction->setEnabled (false); 2051 consoleSize = console->frameSize(); 2052 consoleSize -= QSize (console->frameWidth() * 2, console->frameWidth() * 2); 2053 2081 2054 /* Toggle console to manual resize mode. */ 2082 2055 console->setIgnoreMainwndResize (true); 2083 connect (console, SIGNAL (resizeHintDone()),2084 this, SLOT (onEnterFullscreen()));2085 2056 2086 2057 /* Memorize the maximized state. */ … … 2104 2075 * we requested. So after all the resizing stuff set the clipping 2105 2076 * mask and the spacing shifter to the corresponding values. */ 2106 setViewInSeamlessMode (dtw->availableGeometry (this)); 2077 if (aSeamless) 2078 setViewInSeamlessMode (scrGeo); 2107 2079 2108 2080 #ifdef Q_WS_WIN32 … … 2145 2117 console->setHScrollBarMode (QScrollView::AlwaysOff); 2146 2118 2147 /* Going fullscreen */2148 setWindowState (windowState() ^ WindowFullScreen);2149 2119 #ifdef Q_WS_MAC /* setMask seems to not include the far border pixels. */ 2150 2120 // QRect maskRect = dtw->screenGeometry (this); … … 2180 2150 // setMask (dtw->screenGeometry (this)); 2181 2151 #endif 2182 2183 qApp->processEvents();2184 console->toggleFSMode();2185 2152 } 2186 2153 else 2187 2154 { 2188 /* Temporarily disable the mode-related action to make sure 2189 * user can not enter the mode before he leave it. */ 2190 aSeamless ? vmSeamlessAction->setEnabled (false) : 2191 vmFullscreenAction->setEnabled (false); 2192 /* Toggle console to manual resize mode. */ 2193 connect (console, SIGNAL (resizeHintDone()), this, SLOT (onExitFullscreen())); 2194 2195 /* Reset the shifting spacer. */ 2155 /* Reset the shifting spacers. */ 2196 2156 mShiftingSpacerLeft->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed); 2197 2157 mShiftingSpacerTop->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed); … … 2236 2196 ((QWidget *) obj)->show(); 2237 2197 hidden_children.clear(); 2238 2239 /* Going normal || maximized */ 2240 setWindowState (windowState() ^ WindowFullScreen); 2241 2242 qApp->processEvents(); 2243 console->toggleFSMode(); 2244 } 2198 } 2199 2200 /* Process all console attributes changes and sub-widget hidings */ 2201 qApp->processEvents(); 2202 2203 /* Send guest size hint */ 2204 console->toggleFSMode (consoleSize); 2205 2206 /* Waiting for host resize if it awaited during mode entering/exiting */ 2207 if ((mIsFullscreen || mIsSeamless) && (consoleSize != initialSize)) 2208 mIsWaitingModeResize = true; 2209 2210 if (!mIsWaitingModeResize) 2211 onExitFullscreen(); 2212 2213 setWindowState (windowState() ^ WindowFullScreen); 2214 2215 /* Unlock FS actions locked during modes toggling */ 2216 QTimer::singleShot (300, this, SLOT (unlockActionsSwitch())); 2245 2217 2246 2218 #ifdef Q_WS_MAC /* wasHidden is wrong on the mac it seems. */ … … 2276 2248 void VBoxConsoleWnd::setViewInSeamlessMode (const QRect &aTargetRect) 2277 2249 { 2278 LogFlowThisFunc(("mIsSeamless=%s\n", mIsSeamless ? "true" : "false")); 2279 if (mIsSeamless) 2280 { 2281 /* It isn't guaranteed that the guest os set the video mode that 2282 * we requested. So after all the resizing stuff set the clipping 2283 * mask and the spacing shifter to the corresponding values. */ 2284 QDesktopWidget *dtw = QApplication::desktop(); 2285 QRect sRect = dtw->screenGeometry (this); 2286 QRect aRect (aTargetRect); 2287 mMaskShift.scale (aTargetRect.left(), aTargetRect.top(), QSize::ScaleFree); 2250 /* It isn't guaranteed that the guest os set the video mode that 2251 * we requested. So after all the resizing stuff set the clipping 2252 * mask and the spacing shifter to the corresponding values. */ 2253 QDesktopWidget *dtw = QApplication::desktop(); 2254 QRect sRect = dtw->screenGeometry (this); 2255 QRect aRect (aTargetRect); 2256 mMaskShift.scale (aTargetRect.left(), aTargetRect.top(), QSize::ScaleFree); 2288 2257 #ifdef Q_WS_MAC 2289 2290 2291 2258 /* On mac os x this isn't necessary cause the screen starts 2259 * by y=0 always regardless if there is the global menubar or not. */ 2260 aRect.setRect (aRect.left(), 0, aRect.width(), aRect.height() + aRect.top()); 2292 2261 #endif // Q_WS_MAC 2293 /* Set the clipping mask */ 2294 mStrictedRegion = aRect; 2295 /* Set the shifting spacer */ 2296 mShiftingSpacerLeft->changeSize (RT_ABS (sRect.left() - aRect.left()), 0, 2297 QSizePolicy::Fixed, QSizePolicy::Preferred); 2298 mShiftingSpacerTop->changeSize (0, RT_ABS (sRect.top() - aRect.top()), 2299 QSizePolicy::Preferred, QSizePolicy::Fixed); 2300 mShiftingSpacerRight->changeSize (RT_ABS (sRect.right() - aRect.right()), 0, 2301 QSizePolicy::Fixed, QSizePolicy::Preferred); 2302 mShiftingSpacerBottom->changeSize (0, RT_ABS (sRect.bottom() - aRect.bottom()), 2303 QSizePolicy::Preferred, QSizePolicy::Fixed); 2304 } 2305 LogFlowFuncLeave(); 2262 /* Set the clipping mask */ 2263 mStrictedRegion = aRect; 2264 /* Set the shifting spacer */ 2265 mShiftingSpacerLeft->changeSize (RT_ABS (sRect.left() - aRect.left()), 0, 2266 QSizePolicy::Fixed, QSizePolicy::Preferred); 2267 mShiftingSpacerTop->changeSize (0, RT_ABS (sRect.top() - aRect.top()), 2268 QSizePolicy::Preferred, QSizePolicy::Fixed); 2269 mShiftingSpacerRight->changeSize (RT_ABS (sRect.right() - aRect.right()), 0, 2270 QSizePolicy::Fixed, QSizePolicy::Preferred); 2271 mShiftingSpacerBottom->changeSize (0, RT_ABS (sRect.bottom() - aRect.bottom()), 2272 QSizePolicy::Preferred, QSizePolicy::Fixed); 2306 2273 } 2307 2274
Note:
See TracChangeset
for help on using the changeset viewer.