Changeset 81622 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Nov 1, 2019 5:58:34 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 134379
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r81593 r81622 1694 1694 1695 1695 m_cursorPixmap = QPixmap::fromImage(image); 1696 updateMousePointerPixmapScaling(m_cursorPixmap, uXHot, uYHot); 1696 1697 m_cursor = QCursor(m_cursorPixmap, uXHot, uYHot); 1697 1698 } … … 1784 1785 1785 1786 m_cursorPixmap = QBitmap::fromImage(bitmap); 1787 updateMousePointerPixmapScaling(m_cursorPixmap, uXHot, uYHot); 1786 1788 m_cursor = QCursor(m_cursorPixmap, QBitmap::fromImage(mask), uXHot, uYHot); 1787 1789 } … … 1815 1817 1816 1818 m_cursorPixmap = QPixmap::fromImage(image); 1819 updateMousePointerPixmapScaling(m_cursorPixmap, uXHot, uYHot); 1817 1820 m_cursor = QCursor(m_cursorPixmap, uXHot, uYHot); 1818 1821 } … … 1885 1888 /* Cache cursor pixmap size: */ 1886 1889 m_cursorSize = m_cursorPixmap.size(); 1890 } 1891 1892 void UISession::updateMousePointerPixmapScaling(QPixmap &pixmap, uint &uXHot, uint &uYHot) 1893 { 1894 #if defined(VBOX_WS_WIN) 1895 1896 /* Get screen-id of active machine-window: */ 1897 /// @todo In case of multi-monitor setup check whether parameters are screen specific. 1898 const ulong uScreenID = activeMachineWindow()->screenId(); 1899 1900 /* We want to scale the pixmap just once, so let's prepare cumulative multiplier: */ 1901 double dScaleMultiplier = 1.0; 1902 1903 /* Take into account scale-factor if necessary: */ 1904 const double dScaleFactor = frameBuffer(uScreenID)->scaleFactor(); 1905 //printf("Scale-factor: %f\n", dScaleFactor); 1906 if (dScaleFactor > 1.0) 1907 dScaleMultiplier *= dScaleFactor; 1908 1909 /* Take into account device-pixel-ratio if necessary: */ 1910 const double dDevicePixelRatio = frameBuffer(uScreenID)->devicePixelRatio(); 1911 const double dDevicePixelRatioActual = frameBuffer(uScreenID)->devicePixelRatioActual(); 1912 const bool fUseUnscaledHiDPIOutput = frameBuffer(uScreenID)->useUnscaledHiDPIOutput(); 1913 //printf("Device-pixel-ratio/actual: %f/%f, Unscaled HiDPI Output: %d\n", 1914 // dDevicePixelRatio, dDevicePixelRatioActual, fUseUnscaledHiDPIOutput); 1915 if (dDevicePixelRatioActual > 1.0 && !fUseUnscaledHiDPIOutput) 1916 dScaleMultiplier *= dDevicePixelRatioActual; 1917 1918 /* If scale multiplier was set: */ 1919 if (dScaleMultiplier > 1.0) 1920 { 1921 /* Scale the pixmap up: */ 1922 pixmap = pixmap.scaled(pixmap.width() * dScaleMultiplier, pixmap.height() * dScaleMultiplier, 1923 Qt::IgnoreAspectRatio, Qt::SmoothTransformation); 1924 uXHot *= dScaleMultiplier; 1925 uYHot *= dScaleMultiplier; 1926 } 1927 1928 /* If device pixel ratio was set: */ 1929 if (dDevicePixelRatio > 1.0) 1930 { 1931 /* Scale the pixmap down: */ 1932 pixmap.setDevicePixelRatio(dDevicePixelRatio); 1933 uXHot /= dDevicePixelRatio; 1934 uYHot /= dDevicePixelRatio; 1935 } 1936 1937 #else 1938 1939 Q_UNUSED(pixmap); 1940 Q_UNUSED(uXHot); 1941 Q_UNUSED(uYHot); 1942 1943 #endif 1887 1944 } 1888 1945 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r81592 r81622 444 444 #endif /* VBOX_WS_MAC */ 445 445 446 /* Common helpers: */447 446 /** Updates mouse pointer shape. */ 448 447 void updateMousePointerShape(); 448 /** Updates mouse pointer @a pixmap, @a uXHot and @a uYHot according to scaling attributes. */ 449 void updateMousePointerPixmapScaling(QPixmap &pixmap, uint &uXHot, uint &uYHot); 450 451 /* Common helpers: */ 449 452 bool preprocessInitialization(); 450 453 bool mountAdHocImage(KDeviceType enmDeviceType, UIMediumDeviceType enmMediumType, const QString &strMediumName);
Note:
See TracChangeset
for help on using the changeset viewer.