Changeset 6474 in vbox for trunk/src/VBox
- Timestamp:
- Jan 24, 2008 10:28:59 AM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r6462 r6474 254 254 QSpacerItem *mShiftingSpacerRight; 255 255 QSpacerItem *mShiftingSpacerBottom; 256 QSize mMaskShift; 256 257 257 258 #ifdef VBOX_WITH_DEBUGGER_GUI … … 300 301 #ifdef Q_WS_WIN32 301 302 QRegion mPrevRegion; 303 #endif 304 305 #ifdef Q_WS_MAC 306 QRegion mCurrRegion; 307 EventHandlerRef mDarwinRegionEventHandlerRef; 302 308 #endif 303 309 -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h
r6462 r6474 256 256 CGImageRef DarwinCreateDockBadge (const char *aSource); 257 257 CGImageRef DarwinCreateDockPreview (VBoxFrameBuffer *aFrameBuffer); 258 OSStatus DarwinRegionHandler (EventHandlerCallRef aInHandlerCallRef, EventRef aInEvent, void *aInUserData); 258 259 #endif /* Q_WS_MAC */ 259 260 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r6462 r6474 583 583 OverlayApplicationDockTileImage (dockImgStateRunning); 584 584 #endif 585 mMaskShift.scale (0, 0, QSize::ScaleFree); 585 586 } 586 587 … … 1007 1008 { 1008 1009 disconnect (console, SIGNAL (resizeHintDone()), 0, 0); 1009 #ifndef Q_WS_MAC1010 1010 /* It isn't guaranteed that the guest os set the video mode that 1011 1011 * we requested. So after all the resizing stuff set the clipping 1012 1012 * mask and the spacing shifter to the corresponding values. */ 1013 1013 setViewInSeamlessMode (QRect(console->mapToGlobal (QPoint(0, 0)), console->size())); 1014 #endif1015 1014 #ifdef Q_WS_MAC 1016 1015 if (!mIsSeamless) … … 2088 2087 // maskRect.setBottom (maskRect.bottom() + 1); 2089 2088 // setMask (maskRect); 2089 if (aSeamless) 2090 { 2091 OSStatus status; 2092 WindowPtr WindowRef = reinterpret_cast<WindowPtr>(winId()); 2093 EventTypeSpec wNonCompositingEvent = { kEventClassWindow, kEventWindowGetRegion }; 2094 status = InstallWindowEventHandler (WindowRef, DarwinRegionHandler, GetEventTypeCount (wNonCompositingEvent), &wNonCompositingEvent, &mCurrRegion, &mDarwinRegionEventHandlerRef); 2095 Assert (status == noErr); 2096 status = ReshapeCustomWindow (WindowRef); 2097 Assert (status == noErr); 2098 UInt32 features; 2099 status = GetWindowFeatures (WindowRef, &features); 2100 Assert (status == noErr); 2101 if (( features & kWindowIsOpaque ) != 0) 2102 { 2103 status = HIWindowChangeFeatures (WindowRef, 0, kWindowIsOpaque); 2104 Assert(status == noErr); 2105 } 2106 status = SetWindowAlpha(WindowRef, 0.999); 2107 Assert (status == noErr); 2108 } 2090 2109 #else 2091 2110 // setMask (dtw->screenGeometry (this)); … … 2118 2137 if (!aSeamless) 2119 2138 SetSystemUIMode (kUIModeNormal, 0); 2139 2140 if (aSeamless) 2141 { 2142 /* Undo all mac specific installations */ 2143 OSStatus status; 2144 WindowPtr WindowRef = reinterpret_cast<WindowPtr>(winId()); 2145 status = RemoveEventHandler (mDarwinRegionEventHandlerRef); 2146 Assert (status == noErr); 2147 status = ReshapeCustomWindow (WindowRef); 2148 Assert (status == noErr); 2149 status = SetWindowAlpha (WindowRef, 1); 2150 Assert (status == noErr); 2151 } 2120 2152 #endif 2121 2153 … … 2162 2194 * we requested. So after all the resizing stuff set the clipping 2163 2195 * mask and the spacing shifter to the corresponding values. */ 2164 QDesktopWidget *dtw = QApplication::desktop ();2196 QDesktopWidget *dtw = QApplication::desktop (); 2165 2197 QRect sRect = dtw->screenGeometry (this); 2166 2198 QRect aRect (aTargetRect); 2167 QRect a1Rect (aTargetRect);2199 mMaskShift.scale (aTargetRect.left(), aTargetRect.top(), QSize::ScaleFree); 2168 2200 #ifdef Q_WS_MAC 2169 2201 /* On mac os x this isn't necessary cause the screen starts 2170 2202 * by y=0 always regardless if there is the global menubar or not. */ 2171 2203 aRect.setRect (aRect.left(), 0, aRect.width(), aRect.height() + aRect.top()); 2172 a1Rect.setRect (a1Rect.left(), 0, a1Rect.width(), a1Rect.height());2173 2204 #endif // Q_WS_MAC 2174 2205 /* Set the clipping mask */ 2175 mStrictedRegion = QRegion (sRect) - a1Rect;2206 mStrictedRegion = aRect; 2176 2207 /* Set the shifting spacer */ 2177 2208 mShiftingSpacerLeft->changeSize (RT_ABS (sRect.left() - aRect.left()), 0, … … 2578 2609 { 2579 2610 QRegion region = aRegion; 2580 region.translate (mShiftingSpacerLeft->sizeHint().width(), mShiftingSpacerTop->sizeHint().height()); 2581 region -= mStrictedRegion; 2582 2583 #ifdef Q_WS_MAC 2584 /* This is necessary to avoid the flicker by 2585 * an mask update. 2586 * See http://lists.apple.com/archives/Carbon-development/2001/Apr/msg01651.html 2587 * for the hint. 2588 * There *must* be a better solution. */ 2589 if(!region.isEmpty()) 2590 region |= QRect(0, 0, 1, 1); 2591 #endif 2611 /* The global mask shift cause of toolbars and such thinks. */ 2612 region.translate (mMaskShift.width(), mMaskShift.height()); 2613 /* Restrict the drawing to the available space on the screen. 2614 * (The &operator is better than the previous used -operator, 2615 * because this excludes space around the real screen also. 2616 * This is necessary for the mac.) */ 2617 region &= mStrictedRegion; 2592 2618 2593 2619 #ifdef Q_WS_WIN … … 2620 2646 2621 2647 mPrevRegion = region; 2648 #elif defined(Q_WS_MAC) 2649 /* This is necessary to avoid the flicker by an mask update. 2650 * See http://lists.apple.com/archives/Carbon-development/2001/Apr/msg01651.html 2651 * for the hint. 2652 * There *must* be a better solution. */ 2653 if(!region.isEmpty ()) 2654 region |= QRect (0, 0, 1, 1); 2655 /* Save the current region for later processing in the darwin event handler. */ 2656 mCurrRegion = region; 2657 /* We repaint the screen before the ReshapeCustomWindow command. Unfortunately 2658 * this command flushes a copy of the backbuffer to the screen after the new 2659 * mask is set. This leads into a missplaced drawing of the content. Currently 2660 * no alternative to this and also this is not 100% perfect. */ 2661 repaint (); 2662 qApp->processEvents (); 2663 /* Now force the reshaping of the window. This is definitly necessary. */ 2664 ReshapeCustomWindow (reinterpret_cast<WindowPtr>(winId())); 2622 2665 #else 2623 2666 QMainWindow::setMask (region); -
trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp
r6462 r6474 196 196 } 197 197 198 OSStatus DarwinRegionHandler (EventHandlerCallRef aInHandlerCallRef, EventRef aInEvent, void *aInUserData) 199 { 200 NOREF(aInHandlerCallRef); 201 202 OSStatus status = eventNotHandledErr; 203 204 switch(GetEventKind (aInEvent)) 205 { 206 case kEventWindowGetRegion: 207 { 208 WindowRegionCode code; 209 RgnHandle rgn; 210 211 /* which region code is being queried? */ 212 GetEventParameter (aInEvent, kEventParamWindowRegionCode, typeWindowRegionCode, NULL, sizeof(code), NULL, &code); 213 214 /* if it is the opaque region code then set the region to Empty and return noErr to stop the propagation */ 215 if (code == kWindowOpaqueRgn) 216 { 217 GetEventParameter (aInEvent, kEventParamRgnHandle, typeQDRgnHandle, NULL, sizeof(rgn), NULL, &rgn); 218 SetEmptyRgn (rgn); 219 status = noErr; 220 } 221 /* if the content of the whole window is queried return a copy of our saved region. */ 222 else if (code == (kWindowStructureRgn))// || kWindowGlobalPortRgn || kWindowUpdateRgn)) 223 { 224 GetEventParameter (aInEvent, kEventParamRgnHandle, typeQDRgnHandle, NULL, sizeof(rgn), NULL, &rgn); 225 QRegion *pRegion = static_cast<QRegion*>(aInUserData); 226 if(!pRegion->isNull () && pRegion) 227 { 228 CopyRgn (pRegion->handle(), rgn); 229 status = noErr; 230 } 231 } 232 break; 233 } 234 } 235 236 return status; 237 } 238
Note:
See TracChangeset
for help on using the changeset viewer.