Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h	(revision 53961)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h	(revision 53962)
@@ -92,5 +92,5 @@
 
     /** Applies machine-view scale-factor. */
-    void applyMachineViewScaleFactor();
+    virtual void applyMachineViewScaleFactor();
 
     /* Framebuffer aspect ratio: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp	(revision 53961)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp	(revision 53962)
@@ -66,6 +66,6 @@
     saveMachineViewSettings();
 
-    /* Return scaled-size to 'normal' mode: */
-    applyMachineViewScaleFactor();
+    /* Return scaled-size to 'default' mode: */
+    UIMachineView::applyMachineViewScaleFactor();
 
     /* Cleanup frame buffer: */
@@ -78,12 +78,17 @@
     frameBuffer()->setScaledSize(viewport()->size());
 
-    /* Propagate scale-factor to 3D service if necessary: */
-    if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
-    {
-        const double xRatio = (double)frameBuffer()->scaledSize().width() / frameBuffer()->width();
-        const double yRatio = (double)frameBuffer()->scaledSize().height() / frameBuffer()->height();
-        display().NotifyScaleFactorChange(m_uScreenId,
-                                          (uint32_t)(xRatio * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
-                                          (uint32_t)(yRatio * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
+    /* If scaled-size is valid: */
+    const QSize scaledSize = frameBuffer()->scaledSize();
+    if (scaledSize.isValid())
+    {
+        /* Propagate scale-factor to 3D service if necessary: */
+        if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
+        {
+            const double xScaleFactor = (double)scaledSize.width()  / frameBuffer()->width();
+            const double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height();
+            display().NotifyScaleFactorChange(m_uScreenId,
+                                              (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
+                                              (uint32_t)(yScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
+        }
     }
 
@@ -101,9 +106,7 @@
 {
     /* Initialize variables for scale mode: */
-    QSize scaledSize = frameBuffer()->scaledSize();
-    double xRatio = (double)scaledSize.width() / frameBuffer()->width();
-    double yRatio = (double)scaledSize.height() / frameBuffer()->height();
-    AssertMsg(contentsX() == 0, ("This can't be, else notify Dsen!\n"));
-    AssertMsg(contentsY() == 0, ("This can't be, else notify Dsen!\n"));
+    const QSize scaledSize = frameBuffer()->scaledSize();
+    const double xScaleFactor = (double)scaledSize.width()  / frameBuffer()->width();
+    const double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height();
 
     /* Update corresponding viewport part,
@@ -111,8 +114,8 @@
      * catch all rounding errors. (use 1 time the ratio factor and
      * round down on top/left, but round up for the width/height) */
-    viewport()->update((int)(iX * xRatio) - ((int)xRatio) - 1,
-                       (int)(iY * yRatio) - ((int)yRatio) - 1,
-                       (int)(iW * xRatio) + ((int)xRatio + 2) * 2,
-                       (int)(iH * yRatio) + ((int)yRatio + 2) * 2);
+    viewport()->update((int)(iX * xScaleFactor) - ((int)xScaleFactor) - 1,
+                       (int)(iY * yScaleFactor) - ((int)yScaleFactor) - 1,
+                       (int)(iW * xScaleFactor) + ((int)xScaleFactor + 2) * 2,
+                       (int)(iH * yScaleFactor) + ((int)yScaleFactor + 2) * 2);
 }
 
@@ -142,4 +145,26 @@
     if (uisession()->isScreenVisible(screenId()))
         storeGuestSizeHint(QSize(frameBuffer()->width(), frameBuffer()->height()));
+}
+
+void UIMachineViewScale::applyMachineViewScaleFactor()
+{
+    /* If scaled-size is valid: */
+    const QSize scaledSize = frameBuffer()->scaledSize();
+    if (scaledSize.isValid())
+    {
+        /* Propagate scale-factor to 3D service if necessary: */
+        if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
+        {
+            const double xScaleFactor = (double)scaledSize.width()  / frameBuffer()->width();
+            const double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height();
+            display().NotifyScaleFactorChange(m_uScreenId,
+                                              (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
+                                              (uint32_t)(yScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
+        }
+    }
+
+    /* Take unscaled HiDPI output mode into account: */
+    const bool fUseUnscaledHiDPIOutput = gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid());
+    frameBuffer()->setUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput);
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h	(revision 53961)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h	(revision 53962)
@@ -56,4 +56,7 @@
     void saveMachineViewSettings();
 
+    /** Applies machine-view scale-factor. */
+    void applyMachineViewScaleFactor();
+
     /** Resends guest size-hint if necessary. */
     void maybeResendSizeHint();
