Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp	(revision 71072)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp	(revision 71073)
@@ -1320,7 +1320,8 @@
         m_transform = m_transform.scale(scaleFactor(), scaleFactor());
 
-    /* Apply the device-pixel-ratio if necessary: */
-    if (useUnscaledHiDPIOutput() && devicePixelRatio() > 1.0)
-        m_transform = m_transform.scale(1.0 / devicePixelRatio(), 1.0 / devicePixelRatio());
+    /* Take the device-pixel-ratio into account: */
+    if (!useUnscaledHiDPIOutput())
+        m_transform = m_transform.scale(devicePixelRatio(), devicePixelRatio());
+    m_transform = m_transform.scale(1.0 / devicePixelRatio(), 1.0 / devicePixelRatio());
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 71072)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 71073)
@@ -367,6 +367,7 @@
         QSize scaledSize = size();
         const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
-        if (dDevicePixelRatio > 1.0 && frameBuffer()->useUnscaledHiDPIOutput())
-            scaledSize *= dDevicePixelRatio;
+        scaledSize *= dDevicePixelRatio;
+        if (!frameBuffer()->useUnscaledHiDPIOutput())
+            scaledSize /= dDevicePixelRatio;
         frameBuffer()->setScaledSize(scaledSize);
 
@@ -452,14 +453,18 @@
 
     /* Take the device-pixel-ratio into account: */
-    if (frameBuffer()->useUnscaledHiDPIOutput())
-    {
-        const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
-        if (dDevicePixelRatio > 1.0)
-        {
-            rect.moveTo((int)floor((double)rect.x() / dDevicePixelRatio) - 1,
-                        (int)floor((double)rect.y() / dDevicePixelRatio) - 1);
-            rect.setSize(QSize((int)ceil((double)rect.width()  / dDevicePixelRatio) + 2,
-                               (int)ceil((double)rect.height() / dDevicePixelRatio) + 2));
-        }
+    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
+    if (!frameBuffer()->useUnscaledHiDPIOutput() && dDevicePixelRatio != 1.0)
+    {
+        rect.moveTo((int)floor((double)rect.x() * dDevicePixelRatio) - 1,
+                    (int)floor((double)rect.y() * dDevicePixelRatio) - 1);
+        rect.setSize(QSize((int)ceil((double)rect.width()  * dDevicePixelRatio) + 2,
+                           (int)ceil((double)rect.height() * dDevicePixelRatio) + 2));
+    }
+    if (dDevicePixelRatio != 1.0)
+    {
+        rect.moveTo((int)floor((double)rect.x() / dDevicePixelRatio) - 1,
+                    (int)floor((double)rect.y() / dDevicePixelRatio) - 1);
+        rect.setSize(QSize((int)ceil((double)rect.width()  / dDevicePixelRatio) + 2,
+                           (int)ceil((double)rect.height() / dDevicePixelRatio) + 2));
     }
 
@@ -512,4 +517,5 @@
                                           (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
                                           (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
+        display().NotifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
     }
 
@@ -551,7 +557,5 @@
     /* Propagate the unscaled HiDPI output mode to 3D service if necessary: */
     if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
-    {
         display().NotifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
-    }
 
     /* Handle scale attributes change: */
@@ -794,9 +798,8 @@
 
 #ifdef VBOX_WITH_DRAG_AND_DROP
-    /* Enable drag & drop. */
+    /* Enable drag & drop: */
     setAcceptDrops(true);
 
-    /* Create the drag and drop handler instance.
-     * At the moment we only support one instance per machine window. */
+    /* Create the drag and drop handler instance: */
     m_pDnDHandler = new UIDnDHandler(uisession(), this /* pParent */);
 #endif /* VBOX_WITH_DRAG_AND_DROP */
@@ -1059,6 +1062,7 @@
             QSize scaledSize = size();
             const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
-            if (dDevicePixelRatio > 1.0 && frameBuffer()->useUnscaledHiDPIOutput())
-                scaledSize *= dDevicePixelRatio;
+            scaledSize *= dDevicePixelRatio;
+            if (!frameBuffer()->useUnscaledHiDPIOutput())
+                scaledSize /= dDevicePixelRatio;
             frameBuffer()->setScaledSize(scaledSize);
         }
@@ -1122,4 +1126,10 @@
     }
 
+    /* Take the device-pixel-ratio into account: */
+    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
+    if (!frameBuffer()->useUnscaledHiDPIOutput() && dDevicePixelRatio != 1.0)
+        screenShot = screenShot.scaled(screenShot.size() * dDevicePixelRatio,
+                                       Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+
     /* Dim screen-shot if it is Ok: */
     if (display().isOk() && !screenShot.isNull())
@@ -1128,8 +1138,7 @@
     /* Finally copy the screen-shot to pause-pixmap: */
     m_pausePixmap = QPixmap::fromImage(screenShot);
-    /* Adjust device-pixel-ratio if necessary: */
-    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
-    if (dDevicePixelRatio > 1.0 && frameBuffer()->useUnscaledHiDPIOutput())
-        m_pausePixmap.setDevicePixelRatio(dDevicePixelRatio);
+
+    /* Take the device-pixel-ratio into account: */
+    m_pausePixmap.setDevicePixelRatio(frameBuffer()->devicePixelRatio());
 
     /* Update scaled pause pixmap: */
@@ -1152,6 +1161,14 @@
     machine().QuerySavedGuestScreenInfo(m_uScreenId, uGuestOriginX, uGuestOriginY, uGuestWidth, uGuestHeight, fEnabled);
 
+    /* Calculate effective size: */
+    QSize effectiveSize = uGuestWidth > 0 ? QSize(uGuestWidth, uGuestHeight) : guestScreenSizeHint();
+
+    /* Take the device-pixel-ratio into account: */
+    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
+    if (!frameBuffer()->useUnscaledHiDPIOutput())
+        effectiveSize *= dDevicePixelRatio;
+
     /* Create a screen-shot on the basis of the screen-data we have in saved-state: */
-    QImage screenShot = QImage::fromData(screenData.data(), screenData.size(), "PNG").scaled(uGuestWidth > 0 ? QSize(uGuestWidth, uGuestHeight) : guestScreenSizeHint());
+    QImage screenShot = QImage::fromData(screenData.data(), screenData.size(), "PNG").scaled(effectiveSize);
 
     /* Dim screen-shot if it is Ok: */
@@ -1161,8 +1178,7 @@
     /* Finally copy the screen-shot to pause-pixmap: */
     m_pausePixmap = QPixmap::fromImage(screenShot);
-    /* Adjust device-pixel-ratio if necessary: */
-    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
-    if (dDevicePixelRatio > 1.0 && frameBuffer()->useUnscaledHiDPIOutput())
-        m_pausePixmap.setDevicePixelRatio(dDevicePixelRatio);
+
+    /* Take the device-pixel-ratio into account: */
+    m_pausePixmap.setDevicePixelRatio(frameBuffer()->devicePixelRatio());
 
     /* Update scaled pause pixmap: */
@@ -1177,14 +1193,18 @@
 
     /* Make sure scaled-size is not null: */
-    const QSize scaledSize = frameBuffer()->scaledSize();
+    QSize scaledSize = frameBuffer()->scaledSize();
     if (!scaledSize.isValid())
         return;
 
+    /* Take the device-pixel-ratio into account: */
+    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
+    if (!frameBuffer()->useUnscaledHiDPIOutput())
+        scaledSize *= dDevicePixelRatio;
+
     /* Update pause pixmap finally: */
     m_pausePixmapScaled = pausePixmap().scaled(scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-    /* Adjust device-pixel-ratio if necessary: */
-    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
-    if (dDevicePixelRatio > 1.0 && frameBuffer()->useUnscaledHiDPIOutput())
-        m_pausePixmapScaled.setDevicePixelRatio(dDevicePixelRatio);
+
+    /* Take the device-pixel-ratio into account: */
+    m_pausePixmapScaled.setDevicePixelRatio(frameBuffer()->devicePixelRatio());
 }
 
@@ -1210,12 +1230,11 @@
 
     /* Take the device-pixel-ratio into account: */
-    if (frameBuffer()->useUnscaledHiDPIOutput())
-    {
-        const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
-        if (dDevicePixelRatio > 1.0)
-        {
-            xRange *= dDevicePixelRatio;
-            yRange *= dDevicePixelRatio;
-        }
+    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
+    xRange *= dDevicePixelRatio;
+    yRange *= dDevicePixelRatio;
+    if (!frameBuffer()->useUnscaledHiDPIOutput())
+    {
+        xRange /= dDevicePixelRatio;
+        yRange /= dDevicePixelRatio;
     }
 
@@ -1234,13 +1253,12 @@
 
     /* Take the device-pixel-ratio into account: */
-    if (frameBuffer()->useUnscaledHiDPIOutput())
-    {
-        const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
-        if (dDevicePixelRatio > 1.0)
-        {
-            iContentsX /= dDevicePixelRatio;
-            iContentsY /= dDevicePixelRatio;
-        }
-    }
+    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
+    if (!frameBuffer()->useUnscaledHiDPIOutput())
+    {
+        iContentsX *= dDevicePixelRatio;
+        iContentsY *= dDevicePixelRatio;
+    }
+    iContentsX /= dDevicePixelRatio;
+    iContentsY /= dDevicePixelRatio;
 
     /* Return point shifted according scroll-bars: */
@@ -1300,5 +1318,4 @@
     updateViewport();
 }
-
 
 #ifdef VBOX_WS_MAC
@@ -1635,6 +1652,6 @@
     else if (!m_fIsDraggingFromGuest)
     {
-        /** @todo Add guest->guest DnD functionality here by getting
-         *        the source of guest B (when copying from B to A). */
+        // @todo Add guest->guest DnD functionality here by getting
+        //       the source of guest B (when copying from B to A).
         rc = m_pDnDHandler->dragCheckPending(screenId());
         if (RT_SUCCESS(rc))
@@ -1662,6 +1679,6 @@
     else
     {
-        /** @todo Add guest->guest DnD functionality here by getting
-         *        the source of guest B (when copying from B to A). */
+        // @todo Add guest->guest DnD functionality here by getting
+        //       the source of guest B (when copying from B to A).
         rc = m_pDnDHandler->dragStart(screenId());
 
@@ -1861,10 +1878,8 @@
 
     /* Take the device-pixel-ratio into account: */
-    if (frameBuffer()->useUnscaledHiDPIOutput())
-    {
-        const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
-        if (dDevicePixelRatio > 1.0)
-            size = QSize(size.width() / dDevicePixelRatio, size.height() / dDevicePixelRatio);
-    }
+    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
+    if (!frameBuffer()->useUnscaledHiDPIOutput())
+        size = QSize(size.width() * dDevicePixelRatio, size.height() * dDevicePixelRatio);
+    size = QSize(size.width() / dDevicePixelRatio, size.height() / dDevicePixelRatio);
 
     /* Return result: */
@@ -1875,10 +1890,8 @@
 {
     /* Take the device-pixel-ratio into account: */
-    if (frameBuffer()->useUnscaledHiDPIOutput())
-    {
-        const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
-        if (dDevicePixelRatio > 1.0)
-            size = QSize(size.width() * dDevicePixelRatio, size.height() * dDevicePixelRatio);
-    }
+    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
+    size = QSize(size.width() * dDevicePixelRatio, size.height() * dDevicePixelRatio);
+    if (!frameBuffer()->useUnscaledHiDPIOutput())
+        size = QSize(size.width() / dDevicePixelRatio, size.height() / dDevicePixelRatio);
 
     /* Take the scale-factor into account: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp	(revision 71072)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp	(revision 71073)
@@ -1045,12 +1045,11 @@
 
             /* Take the device-pixel-ratio into account: */
-            if (pFrameBuffer->useUnscaledHiDPIOutput())
+            const double dDevicePixelRatio = pFrameBuffer->devicePixelRatio();
+            cpnt.setX(cpnt.x() * dDevicePixelRatio);
+            cpnt.setY(cpnt.y() * dDevicePixelRatio);
+            if (!pFrameBuffer->useUnscaledHiDPIOutput())
             {
-                const double dDevicePixelRatio = pFrameBuffer->devicePixelRatio();
-                if (dDevicePixelRatio > 1.0)
-                {
-                    cpnt.setX((int)(cpnt.x() * dDevicePixelRatio));
-                    cpnt.setY((int)(cpnt.y() * dDevicePixelRatio));
-                }
+                cpnt.setX(cpnt.x() / dDevicePixelRatio);
+                cpnt.setY(cpnt.y() / dDevicePixelRatio);
             }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp	(revision 71072)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp	(revision 71073)
@@ -66,6 +66,7 @@
     const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
     const bool fUseUnscaledHiDPIOutput = frameBuffer()->useUnscaledHiDPIOutput();
-    if (dDevicePixelRatio > 1.0 && fUseUnscaledHiDPIOutput)
-        scaledSize *= dDevicePixelRatio;
+    scaledSize *= dDevicePixelRatio;
+    if (!fUseUnscaledHiDPIOutput)
+        scaledSize /= dDevicePixelRatio;
     frameBuffer()->setScaledSize(scaledSize);
     frameBuffer()->performRescale();
@@ -158,7 +159,5 @@
     /* Propagate unscaled-hidpi-output feature to 3D service if necessary: */
     if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
-    {
         display().NotifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
-    }
 
     /* Perform frame-buffer rescaling: */
