Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h	(revision 6481)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h	(revision 6482)
@@ -77,4 +77,8 @@
 
     void setMask (const QRegion &aRegion);
+
+#ifdef Q_WS_MAC
+    CGImageRef dockImageState () const;
+#endif
 
 public slots:
Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h	(revision 6481)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h	(revision 6482)
@@ -255,5 +255,5 @@
 CGImageRef DarwinQPixmapFromMimeSourceToCGImage (const char *aSource);
 CGImageRef DarwinCreateDockBadge (const char *aSource);
-CGImageRef DarwinCreateDockPreview (VBoxFrameBuffer *aFrameBuffer);
+CGImageRef DarwinCreateDockPreview (VBoxFrameBuffer *aFrameBuffer, CGImageRef aOverlayImage);
 OSStatus DarwinRegionHandler (EventHandlerCallRef aInHandlerCallRef, EventRef aInEvent, void *aInUserData);
 #endif /* Q_WS_MAC */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp	(revision 6481)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp	(revision 6482)
@@ -2808,5 +2808,5 @@
             /* Update the dock icon if we are in the running state */
             if (isRunning())
-                SetApplicationDockTileImage(::DarwinCreateDockPreview(mFrameBuf));
+                SetApplicationDockTileImage (::DarwinCreateDockPreview(mFrameBuf, mMainWnd->dockImageState ()));
 #endif
             return;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 6481)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 6482)
@@ -1898,24 +1898,8 @@
     }
 #ifdef Q_WS_MAC
-    if (1)//(element & DockTile)
-    {
-        //CGContextDrawImage
-        //HIViewDrawCGImage();
-        //CGImageAlphaInfo
-        CGImageRef img;
-        if (machine_state == CEnums::Running)
-            img = dockImgStateRunning;
-        else if (machine_state == CEnums::Paused)
-            img = dockImgStatePaused;
-        else if (machine_state == CEnums::Restoring)
-            img = dockImgStateRestoring;
-        else if (machine_state == CEnums::Saving)
-            img = dockImgStateSaving;
-        else
-            img = NULL;
         SetApplicationDockTileImage (dockImgOS);
+        CGImageRef img = dockImageState ();
         if (img)
             OverlayApplicationDockTileImage (img);
-    }
 #endif
 }
@@ -2183,4 +2167,22 @@
     return true;
 }
+
+#ifdef Q_WS_MAC
+CGImageRef VBoxConsoleWnd::dockImageState () const
+{
+    CGImageRef img;
+    if (machine_state == CEnums::Running)
+        img = dockImgStateRunning;
+    else if (machine_state == CEnums::Paused)
+        img = dockImgStatePaused;
+    else if (machine_state == CEnums::Restoring)
+        img = dockImgStateRestoring;
+    else if (machine_state == CEnums::Saving)
+        img = dockImgStateSaving;
+    else
+        img = NULL;
+    return img;
+}
+#endif 
 
 //
Index: /trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp	(revision 6481)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp	(revision 6482)
@@ -136,5 +136,5 @@
  * @param   aFrameBuffer    The guest frame buffer.
  */
-CGImageRef DarwinCreateDockPreview (VBoxFrameBuffer *aFrameBuffer)
+CGImageRef DarwinCreateDockPreview (VBoxFrameBuffer *aFrameBuffer, CGImageRef aOverlayImage)
 {
     CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
@@ -143,5 +143,5 @@
     CGDataProviderRef dp = CGDataProviderCreateWithData (aFrameBuffer, aFrameBuffer->address(), aFrameBuffer->bitsPerPixel() / 8 * aFrameBuffer->width() * aFrameBuffer->height() , NULL);
     CGImageRef ir = CGImageCreate (aFrameBuffer->width(), aFrameBuffer->height(), 8, 32, aFrameBuffer->bytesPerLine(), cs,
-                                   kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host, dp, 0 /* decode */, 0 /* shouldInterpolate */,
+                                   kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host, dp, 0, false,
                                    kCGRenderingIntentDefault);
 
@@ -153,21 +153,20 @@
     int targetWidth = 128;
     int targetHeight = 128;
+    int scaledWidth;
+    int scaledHeight;
     float aspect = static_cast<float>(aFrameBuffer->width()) / aFrameBuffer->height();
-    CGRect rect;
     if (aspect > 1.0)
     {
-        rect.origin.x = 0;
-        rect.origin.y = (targetHeight - targetHeight / aspect) / 2;
-        rect.size.width = targetWidth;
-        rect.size.height = targetHeight / aspect;
+        scaledWidth = targetWidth;
+        scaledHeight = targetHeight / aspect;
     }
     else
     {
-        rect.origin.x = (targetWidth - targetWidth * aspect) / 2;
-        rect.origin.y = 0;
-        rect.size.width = targetWidth*aspect;
-        rect.size.height = targetHeight;
+        scaledWidth = targetWidth * aspect;
+        scaledHeight = targetHeight;
     }
-
+    CGRect iconRect = CGRectMake ((targetWidth - scaledWidth) / 2.0, 
+                                  (targetHeight - scaledHeight) / 2.0, 
+                                  scaledWidth, scaledHeight);
     /* Create a bitmap context to draw on */
     CGImageRef dockImage = NULL;
@@ -178,8 +177,27 @@
     {
         CGContextRef context = CGBitmapContextCreate (bitmapData, targetWidth, targetHeight, 8, bitmapBytesPerRow, cs, kCGImageAlphaPremultipliedLast);
-
-        /* Draw on the bitmap */
-        CGContextDrawImage (context, rect, ir);
-
+        /* rounded corners */
+//        CGContextSetLineJoin (context, kCGLineJoinRound);
+//        CGContextSetShadow (context, CGSizeMake(10, 5), 1);
+//        CGContextSetAllowsAntialiasing (context, true);
+        /* some little boarder */
+        iconRect = CGRectInset (iconRect, 1, 1);
+        /* gray stroke */
+        CGContextSetRGBStrokeColor (context, 225.0/255.0, 218.0/255.0, 211.0/255.0, 1);
+        iconRect = CGRectInset (iconRect, 6, 6);
+        CGContextStrokeRectWithWidth (context, iconRect, 12);
+        iconRect = CGRectInset (iconRect, 5, 5);
+        /* black stroke */
+        CGContextSetRGBStrokeColor (context, 0.0, 0.0, 0.0, 1.0);
+        CGContextStrokeRectWithWidth (context, iconRect, 2);
+        /* vm content */
+        iconRect = CGRectInset (iconRect, 1, 1);
+        CGContextDrawImage (context, iconRect, ir);
+        /* the overlay image */
+        if (aOverlayImage)
+        {
+            CGRect overlayRect = CGRectMake (targetWidth - CGImageGetWidth (aOverlayImage), 0, CGImageGetWidth (aOverlayImage), CGImageGetHeight (aOverlayImage));
+            CGContextDrawImage (context, overlayRect, aOverlayImage);
+        }
         /* Create the preview image ref from the bitmap */
         dockImage = CGBitmapContextCreateImage (context);
