Changeset 108367 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Feb 25, 2025 11:12:06 AM (8 weeks ago)
- svn:sync-xref-src-repo-rev:
- 167728
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.cpp
r107472 r108367 4120 4120 /* Get device-pixel-ratio: */ 4121 4121 bool fDevicePixelRatioMentioned = false; 4122 const double dDevicePixelRatio Actual = qMin(UIDesktopWidgetWatchdog::devicePixelRatioActual(m_mapHostScreenForGuestScreen.value(iGuestScreenIndex)),4123 4122 const double dDevicePixelRatio = qMin(UIDesktopWidgetWatchdog::devicePixelRatio(m_mapHostScreenForGuestScreen.value(iGuestScreenIndex)), 4123 10.0 /* meh, who knows? */); 4124 4124 4125 4125 /* Calculate minimum, maximum and step: */ 4126 4126 const double dMinimum = 1.0; 4127 const double dMaximum = ceil(dMinimum + dDevicePixelRatio Actual);4127 const double dMaximum = ceil(dMinimum + dDevicePixelRatio); 4128 4128 const double dStep = 0.25; 4129 4129 … … 4141 4141 { 4142 4142 pAction->setProperty("Requested Scale Factor", dScaleFactor); 4143 if (dDevicePixelRatio Actual== 1.0)4143 if (dDevicePixelRatio == 1.0) 4144 4144 pAction->setText(QApplication::translate("UIActionPool", "Scale to %1%", "scale-factor") 4145 4145 .arg(dScaleFactor * 100)); … … 4149 4149 } 4150 4150 /* For the 'autoscaled' action: */ 4151 else if ( (dScaleFactor >= dDevicePixelRatio Actual)4152 && (dDevicePixelRatio Actual!= 1.0)4151 else if ( (dScaleFactor >= dDevicePixelRatio) 4152 && (dDevicePixelRatio != 1.0) 4153 4153 && !fDevicePixelRatioMentioned) 4154 4154 { 4155 pAction->setProperty("Requested Scale Factor", dDevicePixelRatio Actual);4155 pAction->setProperty("Requested Scale Factor", dDevicePixelRatio); 4156 4156 pAction->setText(QApplication::translate("UIActionPool", "Scale to %1% (autoscaled output)", "scale-factor") 4157 .arg(dDevicePixelRatio Actual* 100));4157 .arg(dDevicePixelRatio * 100)); 4158 4158 fDevicePixelRatioMentioned = true; 4159 4159 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp
r107669 r108367 485 485 /* Redirect call to wrapper above: */ 486 486 return devicePixelRatio(screenNumber(pWidget)); 487 }488 489 /* static */490 double UIDesktopWidgetWatchdog::devicePixelRatioActual(int iHostScreenIndex /* = -1 */)491 {492 /* First, we should check whether the screen is valid: */493 QScreen *pScreen = 0;494 if (iHostScreenIndex == -1)495 {496 pScreen = QGuiApplication::primaryScreen();497 iHostScreenIndex = QGuiApplication::screens().indexOf(pScreen);498 }499 else500 pScreen = QGuiApplication::screens().value(iHostScreenIndex);501 AssertPtrReturn(pScreen, 1.0);502 503 #ifdef VBOX_WS_WIN504 /* Enumerate available monitors through EnumDisplayMonitors if GetDpiForMonitor is available: */505 if (ResolveDynamicImports())506 {507 QList<QPair<int, int> > listOfScreenDPI;508 EnumDisplayMonitors(0, 0, MonitorEnumProcF, (LPARAM)&listOfScreenDPI);509 if (iHostScreenIndex >= 0 && iHostScreenIndex < listOfScreenDPI.size())510 {511 const QPair<int, int> dpiPair = listOfScreenDPI.at(iHostScreenIndex);512 if (dpiPair.first > 0)513 return (double)dpiPair.first / 96 /* dpi unawarness value */;514 }515 }516 #else /* !VBOX_WS_WIN */517 Q_UNUSED(iHostScreenIndex);518 #endif /* !VBOX_WS_WIN */519 520 /* Then acquire device-pixel-ratio: */521 return pScreen->devicePixelRatio();522 }523 524 /* static */525 double UIDesktopWidgetWatchdog::devicePixelRatioActual(QWidget *pWidget)526 {527 /* Redirect call to wrapper above: */528 return devicePixelRatioActual(screenNumber(pWidget));529 487 } 530 488 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h
r106061 r108367 139 139 /** Returns device-pixel-ratio of the host-screen which contains @a pWidget. */ 140 140 static double devicePixelRatio(QWidget *pWidget); 141 142 /** Returns actual device-pixel-ratio of the host-screen with @a iHostScreenIndex. */143 static double devicePixelRatioActual(int iHostScreenIndex = -1);144 /** Returns actual device-pixel-ratio of the host-screen which contains @a pWidget. */145 static double devicePixelRatioActual(QWidget *pWidget);146 141 147 142 /** Search position for @a rectangle to make sure it is fully -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.cpp
r108157 r108367 225 225 QWidget *pParentWidget = qobject_cast<QWidget*>(parent()); 226 226 pixmap.setDevicePixelRatio( pParentWidget 227 ? UIDesktopWidgetWatchdog::devicePixelRatio Actual(pParentWidget)228 : UIDesktopWidgetWatchdog::devicePixelRatio Actual());227 ? UIDesktopWidgetWatchdog::devicePixelRatio(pParentWidget) 228 : UIDesktopWidgetWatchdog::devicePixelRatio()); 229 229 /* Use the filtered pixmap: */ 230 230 pPainter->drawPixmap(offset, pixmap); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r108075 r108367 145 145 /** Defines device-pixel-ratio set for HiDPI frame-buffer. */ 146 146 void setDevicePixelRatio(double dDevicePixelRatio) { m_dDevicePixelRatio = dDevicePixelRatio; } 147 /** Returns actual device-pixel-ratio set for HiDPI frame-buffer. */148 double devicePixelRatioActual() const { return m_dDevicePixelRatioActual; }149 /** Defines actual device-pixel-ratio set for HiDPI frame-buffer. */150 void setDevicePixelRatioActual(double dDevicePixelRatioActual) { m_dDevicePixelRatioActual = dDevicePixelRatioActual; }151 147 152 148 /** Returns whether frame-buffer should use unscaled HiDPI output. */ … … 364 360 * @{ */ 365 361 /** Holds device-pixel-ratio set for HiDPI frame-buffer. */ 366 double m_dDevicePixelRatio; 367 /** Holds actual device-pixel-ratio set for HiDPI frame-buffer. */ 368 double m_dDevicePixelRatioActual; 362 double m_dDevicePixelRatio; 369 363 /** Holds whether frame-buffer should use unscaled HiDPI output. */ 370 bool m_fUseUnscaledHiDPIOutput;364 bool m_fUseUnscaledHiDPIOutput; 371 365 /** @} */ 372 366 … … 401 395 , m_enmScalingOptimizationType(ScalingOptimizationType_None) 402 396 , m_dDevicePixelRatio(1.0) 403 , m_dDevicePixelRatioActual(1.0)404 397 , m_fUseUnscaledHiDPIOutput(false) 405 398 { … … 1170 1163 /* Take the device-pixel-ratio into account: */ 1171 1164 if (!useUnscaledHiDPIOutput()) 1172 cursorHotspot /= devicePixelRatio Actual();1165 cursorHotspot /= devicePixelRatio(); 1173 1166 1174 1167 /* Acquire cursor position and size: */ … … 1179 1172 cursorSize *= scaleFactor(); 1180 1173 /* Take the device-pixel-ratio into account: */ 1181 if ( !useUnscaledHiDPIOutput())1174 if (useUnscaledHiDPIOutput()) 1182 1175 { 1183 cursorPosition *= devicePixelRatioActual();1184 cursorSize *= devicePixelRatioActual();1176 cursorPosition /= devicePixelRatio(); 1177 cursorSize /= devicePixelRatio(); 1185 1178 } 1186 cursorPosition /= devicePixelRatio();1187 cursorSize /= devicePixelRatio();1188 1179 1189 1180 /* Call for a viewport update, we need to update cumulative … … 1251 1242 1252 1243 /* Take the device-pixel-ratio into account: */ 1253 if (!useUnscaledHiDPIOutput()) 1254 m_transform = m_transform.scale(devicePixelRatioActual(), devicePixelRatioActual()); 1255 m_transform = m_transform.scale(1.0 / devicePixelRatio(), 1.0 / devicePixelRatio()); 1244 if (useUnscaledHiDPIOutput()) 1245 m_transform = m_transform.scale(1.0 / devicePixelRatio(), 1.0 / devicePixelRatio()); 1256 1246 } 1257 1247 … … 1298 1288 /* But if we should scale image by some reason: */ 1299 1289 if ( scaledSize().isValid() 1300 || (!useUnscaledHiDPIOutput() && devicePixelRatio Actual() != 1.0))1290 || (!useUnscaledHiDPIOutput() && devicePixelRatio() != 1.0)) 1301 1291 { 1302 1292 /* Calculate final scaled size: */ 1303 1293 QSize effectiveSize = !scaledSize().isValid() ? pSourceImage->size() : scaledSize(); 1304 1294 /* Take the device-pixel-ratio into account: */ 1305 if (!useUnscaledHiDPIOutput() && devicePixelRatio Actual() != 1.0)1306 effectiveSize *= devicePixelRatio Actual();1295 if (!useUnscaledHiDPIOutput() && devicePixelRatio() != 1.0) 1296 effectiveSize *= devicePixelRatio(); 1307 1297 /* We scale the image to requested size and retain it 1308 1298 * by making heap shallow copy of that temporary object: */ … … 1354 1344 /* If we had to scale image for some reason: */ 1355 1345 if ( scaledSize().isValid() 1356 || (!useUnscaledHiDPIOutput() && devicePixelRatio Actual() != 1.0))1346 || (!useUnscaledHiDPIOutput() && devicePixelRatio() != 1.0)) 1357 1347 { 1358 1348 /* Wipe out copied image: */ … … 1393 1383 /* But if we should scale image by some reason: */ 1394 1384 if ( scaledSize().isValid() 1395 || (!useUnscaledHiDPIOutput() && devicePixelRatio Actual() != 1.0))1385 || (!useUnscaledHiDPIOutput() && devicePixelRatio() != 1.0)) 1396 1386 { 1397 1387 /* Calculate final scaled size: */ 1398 1388 QSize effectiveSize = !scaledSize().isValid() ? pSourceImage->size() : scaledSize(); 1399 1389 /* Take the device-pixel-ratio into account: */ 1400 if (!useUnscaledHiDPIOutput() && devicePixelRatio Actual() != 1.0)1401 effectiveSize *= devicePixelRatio Actual();1390 if (!useUnscaledHiDPIOutput() && devicePixelRatio() != 1.0) 1391 effectiveSize *= devicePixelRatio(); 1402 1392 /* We scale the image to requested size and retain it 1403 1393 * by making heap shallow copy of that temporary object: */ … … 1465 1455 /* If we had to scale image for some reason: */ 1466 1456 if ( scaledSize().isValid() 1467 || (!useUnscaledHiDPIOutput() && devicePixelRatio Actual() != 1.0))1457 || (!useUnscaledHiDPIOutput() && devicePixelRatio() != 1.0)) 1468 1458 { 1469 1459 /* Wipe out copied image: */ … … 1667 1657 } 1668 1658 1669 double UIFrameBuffer::devicePixelRatioActual() const1670 {1671 return m_pFrameBuffer->devicePixelRatioActual();1672 }1673 1674 void UIFrameBuffer::setDevicePixelRatioActual(double dDevicePixelRatioActual)1675 {1676 m_pFrameBuffer->setDevicePixelRatioActual(dDevicePixelRatioActual);1677 }1678 1679 1659 bool UIFrameBuffer::useUnscaledHiDPIOutput() const 1680 1660 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
r107411 r108367 108 108 /** Defines device-pixel-ratio set for HiDPI frame-buffer. */ 109 109 void setDevicePixelRatio(double dDevicePixelRatio); 110 /** Returns actual device-pixel-ratio set for HiDPI frame-buffer. */111 double devicePixelRatioActual() const;112 /** Defines actual device-pixel-ratio set for HiDPI frame-buffer. */113 void setDevicePixelRatioActual(double dDevicePixelRatioActual);114 110 115 111 /** Returns whether frame-buffer should use unscaled HiDPI output. */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r107641 r108367 302 302 /* Take the device-pixel-ratio into account: */ 303 303 frameBuffer()->setDevicePixelRatio(UIDesktopWidgetWatchdog::devicePixelRatio(machineWindow())); 304 frameBuffer()->setDevicePixelRatioActual(UIDesktopWidgetWatchdog::devicePixelRatioActual(machineWindow())); 305 const double dDevicePixelRatioActual = frameBuffer()->devicePixelRatioActual(); 306 const bool fUseUnscaledHiDPIOutput = dScaleFactor != dDevicePixelRatioActual; 304 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 305 const bool fUseUnscaledHiDPIOutput = dScaleFactor != dDevicePixelRatio; 307 306 dScaleFactor = fUseUnscaledHiDPIOutput ? dScaleFactor : 1.0; 308 307 … … 322 321 // not 3D overlay itself, so for auto scale-up mode we have to take that into account. 323 322 if (!fUseUnscaledHiDPIOutput) 324 dScaleFactorFor3D *= dDevicePixelRatio Actual;323 dScaleFactorFor3D *= dDevicePixelRatio; 325 324 #endif /* VBOX_WS_WIN || VBOX_WS_NIX */ 326 325 uimachine()->notifyScaleFactorChange(m_uScreenId, … … 389 388 390 389 /* Take the device-pixel-ratio into account: */ 391 const double dDevicePixelRatioFormal = frameBuffer()->devicePixelRatio(); 392 const double dDevicePixelRatioActual = frameBuffer()->devicePixelRatioActual(); 393 if (!frameBuffer()->useUnscaledHiDPIOutput()) 394 { 395 iContentsX *= dDevicePixelRatioActual; 396 iContentsY *= dDevicePixelRatioActual; 397 } 398 iContentsX /= dDevicePixelRatioFormal; 399 iContentsY /= dDevicePixelRatioFormal; 390 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 391 if (frameBuffer()->useUnscaledHiDPIOutput()) 392 { 393 iContentsX /= dDevicePixelRatio; 394 iContentsY /= dDevicePixelRatio; 395 } 400 396 401 397 /* Return point shifted according scroll-bars: */ … … 701 697 /* Assign new frame-buffer logical-size: */ 702 698 QSize scaledSize = size(); 703 const double dDevicePixelRatioFormal = frameBuffer()->devicePixelRatio(); 704 const double dDevicePixelRatioActual = frameBuffer()->devicePixelRatioActual(); 705 scaledSize *= dDevicePixelRatioFormal; 706 if (!frameBuffer()->useUnscaledHiDPIOutput()) 707 scaledSize /= dDevicePixelRatioActual; 699 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 700 if (frameBuffer()->useUnscaledHiDPIOutput()) 701 scaledSize *= dDevicePixelRatio; 708 702 frameBuffer()->setScaledSize(scaledSize); 709 703 … … 803 797 804 798 /* Take the device-pixel-ratio into account: */ 805 const double dDevicePixelRatioFormal = frameBuffer()->devicePixelRatio(); 806 const double dDevicePixelRatioActual = frameBuffer()->devicePixelRatioActual(); 807 if (!frameBuffer()->useUnscaledHiDPIOutput() && dDevicePixelRatioActual != 1.0) 808 { 809 rect.moveTo((int)floor((double)rect.x() * dDevicePixelRatioActual) - 1, 810 (int)floor((double)rect.y() * dDevicePixelRatioActual) - 1); 811 rect.setSize(QSize((int)ceil((double)rect.width() * dDevicePixelRatioActual) + 2, 812 (int)ceil((double)rect.height() * dDevicePixelRatioActual) + 2)); 813 } 814 if (dDevicePixelRatioFormal != 1.0) 815 { 816 rect.moveTo((int)floor((double)rect.x() / dDevicePixelRatioFormal) - 1, 817 (int)floor((double)rect.y() / dDevicePixelRatioFormal) - 1); 818 rect.setSize(QSize((int)ceil((double)rect.width() / dDevicePixelRatioFormal) + 2, 819 (int)ceil((double)rect.height() / dDevicePixelRatioFormal) + 2)); 799 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 800 if (frameBuffer()->useUnscaledHiDPIOutput() && dDevicePixelRatio != 1.0) 801 { 802 rect.moveTo((int)floor((double)rect.x() / dDevicePixelRatio) - 1, 803 (int)floor((double)rect.y() / dDevicePixelRatio) - 1); 804 rect.setSize(QSize((int)ceil((double)rect.width() / dDevicePixelRatio) + 2, 805 (int)ceil((double)rect.height() / dDevicePixelRatio) + 2)); 820 806 } 821 807 … … 1066 1052 1067 1053 /* Take the device-pixel-ratio into account: */ 1068 const double dDevicePixelRatio Actual = frameBuffer()->devicePixelRatioActual();1069 const bool fUseUnscaledHiDPIOutput = dScaleFactor != dDevicePixelRatio Actual;1054 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 1055 const bool fUseUnscaledHiDPIOutput = dScaleFactor != dDevicePixelRatio; 1070 1056 dScaleFactor = fUseUnscaledHiDPIOutput ? dScaleFactor : 1.0; 1071 1057 … … 1085 1071 // not 3D overlay itself, so for auto scale-up mode we have to take that into account. 1086 1072 if (!fUseUnscaledHiDPIOutput) 1087 dScaleFactorFor3D *= frameBuffer()->devicePixelRatio Actual();1073 dScaleFactorFor3D *= frameBuffer()->devicePixelRatio(); 1088 1074 #endif /* VBOX_WS_WIN || VBOX_WS_NIX */ 1089 1075 uimachine()->notifyScaleFactorChange(m_uScreenId, … … 1604 1590 /* Assign new frame-buffer logical-size: */ 1605 1591 QSize scaledSize = size(); 1606 const double dDevicePixelRatioFormal = frameBuffer()->devicePixelRatio(); 1607 const double dDevicePixelRatioActual = frameBuffer()->devicePixelRatioActual(); 1608 scaledSize *= dDevicePixelRatioFormal; 1609 if (!frameBuffer()->useUnscaledHiDPIOutput()) 1610 scaledSize /= dDevicePixelRatioActual; 1592 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 1593 if (frameBuffer()->useUnscaledHiDPIOutput()) 1594 scaledSize *= dDevicePixelRatio; 1611 1595 frameBuffer()->setScaledSize(scaledSize); 1612 1596 } … … 1660 1644 1661 1645 /* Take the device-pixel-ratio into account: */ 1662 const double dDevicePixelRatio Actual = frameBuffer()->devicePixelRatioActual();1663 if (!frameBuffer()->useUnscaledHiDPIOutput() && dDevicePixelRatio Actual!= 1.0)1664 screenShot = screenShot.scaled(screenShot.size() * dDevicePixelRatio Actual,1646 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 1647 if (!frameBuffer()->useUnscaledHiDPIOutput() && dDevicePixelRatio != 1.0) 1648 screenShot = screenShot.scaled(screenShot.size() * dDevicePixelRatio, 1665 1649 Qt::IgnoreAspectRatio, Qt::SmoothTransformation); 1666 1650 … … 1698 1682 1699 1683 /* Take the device-pixel-ratio into account: */ 1700 const double dDevicePixelRatio Actual = frameBuffer()->devicePixelRatioActual();1701 if (!frameBuffer()->useUnscaledHiDPIOutput() && dDevicePixelRatio Actual!= 1.0)1702 effectiveSize *= dDevicePixelRatio Actual;1684 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 1685 if (!frameBuffer()->useUnscaledHiDPIOutput() && dDevicePixelRatio != 1.0) 1686 effectiveSize *= dDevicePixelRatio; 1703 1687 1704 1688 /* Create a screen-shot on the basis of the screen-data we have in saved-state: */ … … 1732 1716 1733 1717 /* Take the device-pixel-ratio into account: */ 1734 const double dDevicePixelRatio Actual = frameBuffer()->devicePixelRatioActual();1735 if (!frameBuffer()->useUnscaledHiDPIOutput() && dDevicePixelRatio Actual!= 1.0)1736 scaledSize *= dDevicePixelRatio Actual;1718 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 1719 if (!frameBuffer()->useUnscaledHiDPIOutput() && dDevicePixelRatio != 1.0) 1720 scaledSize *= dDevicePixelRatio; 1737 1721 1738 1722 /* Update pause pixmap finally: */ … … 1768 1752 1769 1753 /* Take the device-pixel-ratio into account: */ 1770 const double dDevicePixelRatioFormal = frameBuffer()->devicePixelRatio(); 1771 const double dDevicePixelRatioActual = frameBuffer()->devicePixelRatioActual(); 1772 xRange *= dDevicePixelRatioFormal; 1773 yRange *= dDevicePixelRatioFormal; 1774 if (!frameBuffer()->useUnscaledHiDPIOutput()) 1775 { 1776 xRange /= dDevicePixelRatioActual; 1777 yRange /= dDevicePixelRatioActual; 1754 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 1755 if (frameBuffer()->useUnscaledHiDPIOutput()) 1756 { 1757 xRange *= dDevicePixelRatio; 1758 yRange *= dDevicePixelRatio; 1778 1759 } 1779 1760 … … 2176 2157 2177 2158 /* Take the device-pixel-ratio into account: */ 2178 const double dDevicePixelRatioFormal = frameBuffer()->devicePixelRatio(); 2179 const double dDevicePixelRatioActual = frameBuffer()->devicePixelRatioActual(); 2180 if (!frameBuffer()->useUnscaledHiDPIOutput()) 2181 size = QSize((int)(size.width() * dDevicePixelRatioActual), (int)(size.height() * dDevicePixelRatioActual)); 2182 size = QSize((int)(size.width() / dDevicePixelRatioFormal), (int)(size.height() / dDevicePixelRatioFormal)); 2159 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 2160 if (frameBuffer()->useUnscaledHiDPIOutput()) 2161 size = QSize((int)(size.width() / dDevicePixelRatio), (int)(size.height() / dDevicePixelRatio)); 2183 2162 2184 2163 /* Return result: */ … … 2189 2168 { 2190 2169 /* Take the device-pixel-ratio into account: */ 2191 const double dDevicePixelRatioFormal = frameBuffer()->devicePixelRatio(); 2192 const double dDevicePixelRatioActual = frameBuffer()->devicePixelRatioActual(); 2193 size = QSize((int)(size.width() * dDevicePixelRatioFormal), (int)(size.height() * dDevicePixelRatioFormal)); 2194 if (!frameBuffer()->useUnscaledHiDPIOutput()) 2195 size = QSize(size.width() / dDevicePixelRatioActual, size.height() / dDevicePixelRatioActual); 2170 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 2171 if (frameBuffer()->useUnscaledHiDPIOutput()) 2172 size = QSize((int)(size.width() * dDevicePixelRatio), (int)(size.height() * dDevicePixelRatio)); 2196 2173 2197 2174 /* Take the scale-factor into account: */ … … 2245 2222 2246 2223 /* Take into account device-pixel-ratio if necessary: */ 2247 # ifdef VBOX_WS_WIN2248 2224 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 2249 # endif2250 const double dDevicePixelRatioActual = frameBuffer()->devicePixelRatioActual();2251 2225 const bool fUseUnscaledHiDPIOutput = frameBuffer()->useUnscaledHiDPIOutput(); 2252 //printf("Device-pixel-ratio/actual: %f/%f, Unscaled HiDPI Output: %d\n", 2253 // dDevicePixelRatio, dDevicePixelRatioActual, fUseUnscaledHiDPIOutput); 2254 if (dDevicePixelRatioActual > 1.0 && !fUseUnscaledHiDPIOutput) 2255 dScaleMultiplier *= dDevicePixelRatioActual; 2226 if (dDevicePixelRatio > 1.0 && !fUseUnscaledHiDPIOutput) 2227 dScaleMultiplier *= dDevicePixelRatio; 2256 2228 2257 2229 /* If scale multiplier was set: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
r106349 r108367 1092 1092 1093 1093 /* Take the device-pixel-ratio into account: */ 1094 const double dDevicePixelRatioFormal = pFrameBuffer->devicePixelRatio(); 1095 const double dDevicePixelRatioActual = pFrameBuffer->devicePixelRatioActual(); 1096 cpnt.setX(cpnt.x() * dDevicePixelRatioFormal); 1097 cpnt.setY(cpnt.y() * dDevicePixelRatioFormal); 1098 if (!pFrameBuffer->useUnscaledHiDPIOutput()) 1094 const double dDevicePixelRatio = pFrameBuffer->devicePixelRatio(); 1095 if (pFrameBuffer->useUnscaledHiDPIOutput()) 1099 1096 { 1100 cpnt.setX(cpnt.x() / dDevicePixelRatioActual);1101 cpnt.setY(cpnt.y() / dDevicePixelRatioActual);1097 cpnt.setX(cpnt.x() * dDevicePixelRatio); 1098 cpnt.setY(cpnt.y() * dDevicePixelRatio); 1102 1099 } 1103 1100 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
r106061 r108367 56 56 /* Assign new frame-buffer logical-size: */ 57 57 QSize scaledSize = size(); 58 const double dDevicePixelRatioFormal = frameBuffer()->devicePixelRatio();59 const double dDevicePixelRatioActual = frameBuffer()->devicePixelRatioActual();60 58 const bool fUseUnscaledHiDPIOutput = frameBuffer()->useUnscaledHiDPIOutput(); 61 scaledSize *= dDevicePixelRatioFormal;62 if ( !fUseUnscaledHiDPIOutput)63 scaledSize /= dDevicePixelRatioActual;59 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 60 if (fUseUnscaledHiDPIOutput) 61 scaledSize *= dDevicePixelRatio; 64 62 frameBuffer()->setScaledSize(scaledSize); 65 63 frameBuffer()->performRescale(); … … 81 79 if (!fUseUnscaledHiDPIOutput) 82 80 { 83 xScaleFactor *= dDevicePixelRatio Actual;84 yScaleFactor *= dDevicePixelRatio Actual;81 xScaleFactor *= dDevicePixelRatio; 82 yScaleFactor *= dDevicePixelRatio; 85 83 } 86 84 #endif /* VBOX_WS_WIN || VBOX_WS_NIX */ … … 125 123 /* If scaled-size is valid: */ 126 124 const QSize scaledSize = frameBuffer()->scaledSize(); 127 const double dDevicePixelRatioActual = frameBuffer()->devicePixelRatioActual(); Q_UNUSED(dDevicePixelRatioActual);128 125 const bool fUseUnscaledHiDPIOutput = frameBuffer()->useUnscaledHiDPIOutput(); 129 126 if (scaledSize.isValid()) … … 142 139 if (!fUseUnscaledHiDPIOutput) 143 140 { 144 xScaleFactor *= dDevicePixelRatioActual; 145 yScaleFactor *= dDevicePixelRatioActual; 141 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 142 xScaleFactor *= dDevicePixelRatio; 143 yScaleFactor *= dDevicePixelRatio; 146 144 } 147 145 #endif /* VBOX_WS_WIN || VBOX_WS_NIX */
Note:
See TracChangeset
for help on using the changeset viewer.