VirtualBox

Ignore:
Timestamp:
Dec 8, 2017 11:02:07 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8694: X11: Adjusting mouse cursor shape to be HiPDI aware and take host-screen scale-factor into account.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r69958 r70009  
    17791779    /* Create cursor-pixmap from the image: */
    17801780    QPixmap cursorPixmap = QPixmap::fromImage(image);
    1781 # ifdef VBOX_WS_MAC
     1781
     1782# if defined(VBOX_WS_MAC)
    17821783    /* Adjust device-pixel-ratio: */
    17831784    /// @todo In case of multi-monitor setup check whether device-pixel-ratio and cursor are screen specific.
     
    17931794        cursorPixmap.setDevicePixelRatio(dDevicePixelRatio);
    17941795    }
    1795 # endif /* VBOX_WS_MAC */
     1796# elif defined(VBOX_WS_X11)
     1797    /* Adjust device-pixel-ratio: */
     1798    /// @todo In case of multi-monitor setup check whether device-pixel-ratio and cursor are screen specific.
     1799    /* Get screen-id of main-window: */
     1800    const ulong uScreenID = machineLogic()->activeMachineWindow()->screenId();
     1801    /* Get device-pixel-ratio: */
     1802    const double dDevicePixelRatio = frameBuffer(uScreenID)->devicePixelRatio();
     1803    /* Adjust device-pixel-ratio if necessary: */
     1804    if (dDevicePixelRatio > 1.0 && !frameBuffer(uScreenID)->useUnscaledHiDPIOutput())
     1805    {
     1806        uXHot *= dDevicePixelRatio;
     1807        uYHot *= dDevicePixelRatio;
     1808        cursorPixmap = cursorPixmap.scaled(cursorPixmap.width() * dDevicePixelRatio, cursorPixmap.height() * dDevicePixelRatio,
     1809                                           Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
     1810    }
     1811# endif /* VBOX_WS_X11 */
     1812
    17961813    /* Set the new cursor: */
    17971814    m_cursor = QCursor(cursorPixmap, uXHot, uYHot);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette