Changeset 15493 in vbox
- Timestamp:
- Dec 15, 2008 11:00:58 AM (16 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxUtils.h
r14977 r15493 211 211 /* Special routines for the dock handling */ 212 212 CGImageRef darwinCreateDockBadge (const char *aSource); 213 void darwinUpdateDockPreview ( CGImageRef aVMImage, CGImageRef aOverlayImage, CGImageRef aStateImage = NULL);214 void darwinUpdateDockPreview ( VBoxFrameBuffer *aFrameBuffer, CGImageRef aOverlayImage);213 void darwinUpdateDockPreview (QWidget *aMainWindow, CGImageRef aVMImage, CGImageRef aOverlayImage, CGImageRef aStateImage = NULL); 214 void darwinUpdateDockPreview (QWidget *aMainWindow, VBoxFrameBuffer *aFrameBuffer, CGImageRef aOverlayImage); 215 215 216 216 /* Icons in the menu of an mac application are unusual. */ -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleView.cpp
r15467 r15493 3085 3085 #ifdef VBOX_GUI_USE_QUARTZ2D 3086 3086 if (mode == VBoxDefs::Quartz2DMode && mFrameBuf) 3087 { 3087 3088 mFrameBuf->paintEvent (pe); 3089 ::darwinUpdateDockPreview (mMainWnd, 3090 ::darwinToCGImageRef (&mPausedShot), 3091 mVirtualBoxLogo, 3092 mMainWnd->dockImageState()); 3093 } 3088 3094 else 3089 3095 #endif … … 3101 3107 viewport()->setAttribute (Qt::WA_PaintOnScreen, paintOnScreen); 3102 3108 #ifdef Q_WS_MAC 3103 ::darwinUpdateDockPreview (::darwinToCGImageRef (&mPausedShot), 3109 ::darwinUpdateDockPreview (mMainWnd, 3110 ::darwinToCGImageRef (&mPausedShot), 3104 3111 mVirtualBoxLogo, 3105 3112 mMainWnd->dockImageState()); … … 3885 3892 CGImageRef ir = 3886 3893 static_cast <VBoxQuartz2DFrameBuffer *> (mFrameBuf)->imageRef(); 3887 ::darwinUpdateDockPreview ( ir, mVirtualBoxLogo);3894 ::darwinUpdateDockPreview (mMainWnd, ir, mVirtualBoxLogo); 3888 3895 } 3889 3896 else 3890 3897 # endif 3891 ::darwinUpdateDockPreview (m FrameBuf, mVirtualBoxLogo);3892 } 3893 } 3894 #endif 3895 3898 ::darwinUpdateDockPreview (mMainWnd, mFrameBuf, mVirtualBoxLogo); 3899 } 3900 } 3901 #endif 3902 -
trunk/src/VBox/Frontends/VirtualBox4/src/darwin/VBoxUtils-darwin.cpp
r14977 r15493 187 187 * @param aStateImage an optional state overlay image to add at the center of the icon 188 188 */ 189 void darwinUpdateDockPreview ( CGImageRef aVMImage, CGImageRef aOverlayImage, CGImageRef aStateImage /*= NULL*/)189 void darwinUpdateDockPreview (QWidget *aMainWindow, CGImageRef aVMImage, CGImageRef aOverlayImage, CGImageRef aStateImage /*= NULL*/) 190 190 { 191 191 Assert (aVMImage); … … 237 237 CGContextDrawImage (context, iconRect, aVMImage); 238 238 /* Process the content of any external OpenGL windows. */ 239 WindowRef w = FrontNonFloatingWindow();239 WindowRef w = darwinToWindowRef (aMainWindow); 240 240 WindowGroupRef g = GetWindowGroup (w); 241 241 WindowGroupContentOptions wgco = kWindowGroupContentsReturnWindows | kWindowGroupContentsRecurse | kWindowGroupContentsVisible; … … 254 254 wc != w) 255 255 { 256 Rect tmpR1; 257 GetWindowBounds (wc, kWindowContentRgn, &tmpR1); 258 HIRect rect; 259 rect.size.width = (tmpR1.right-tmpR1.left) * a1; 260 rect.size.height = (tmpR1.bottom-tmpR1.top) * a2; 261 rect.origin.x = iconRect.origin.x + (tmpR1.left - mainRect.origin.x) * a1; 262 rect.origin.y = targetHeight - (iconRect.origin.y + (tmpR1.top - mainRect.origin.y) * a2) - rect.size.height; 263 /* This is a big, bad hack. The following functions aren't 264 * documented nor official supported by apple. But its the only way 265 * to capture the OpenGL content of a window without fiddling 266 * around with gPixelRead or something like that. */ 267 CGSWindowID wid = GetNativeWindowFromWindowRef(wc); 268 CGContextCopyWindowCaptureContentsToRect(context, rect, CGSMainConnectionID(), wid, 0); 256 WindowClass winClass; 257 status = GetWindowClass (wc, &winClass); 258 if (status == noErr && 259 winClass == kOverlayWindowClass) 260 { 261 Rect tmpR1; 262 GetWindowBounds (wc, kWindowContentRgn, &tmpR1); 263 HIRect rect; 264 rect.size.width = (tmpR1.right-tmpR1.left) * a1; 265 rect.size.height = (tmpR1.bottom-tmpR1.top) * a2; 266 rect.origin.x = iconRect.origin.x + (tmpR1.left - mainRect.origin.x) * a1; 267 rect.origin.y = targetHeight - (iconRect.origin.y + (tmpR1.top - mainRect.origin.y) * a2) - rect.size.height; 268 /* This is a big, bad hack. The following functions aren't 269 * documented nor official supported by apple. But its the only way 270 * to capture the OpenGL content of a window without fiddling 271 * around with gPixelRead or something like that. */ 272 CGSWindowID wid = GetNativeWindowFromWindowRef(wc); 273 CGContextCopyWindowCaptureContentsToRect(context, rect, CGSMainConnectionID(), wid, 0); 274 } 269 275 } 270 276 } … … 304 310 * @param aOverlayImage an optional icon overlay image to add at the bottom right of the icon 305 311 */ 306 void darwinUpdateDockPreview ( VBoxFrameBuffer *aFrameBuffer, CGImageRef aOverlayImage)312 void darwinUpdateDockPreview (QWidget *aMainWindow, VBoxFrameBuffer *aFrameBuffer, CGImageRef aOverlayImage) 307 313 { 308 314 CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB(); … … 315 321 kCGRenderingIntentDefault); 316 322 /* Update the dock preview icon */ 317 ::darwinUpdateDockPreview ( ir, aOverlayImage);323 ::darwinUpdateDockPreview (aMainWindow, ir, aOverlayImage); 318 324 /* Release the temp data and image */ 319 325 CGDataProviderRelease (dp);
Note:
See TracChangeset
for help on using the changeset viewer.