VirtualBox

Changeset 77726 in vbox


Ignore:
Timestamp:
Mar 15, 2019 2:13:17 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129374
Message:

FE/Qt: bugref:9376: Treat cursor hotspot position more carefully.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
3 edited

Legend:

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

    r77724 r77726  
    13121312    {
    13131313        /* Acquire cursor position and size: */
    1314         QPoint cursorPosition = QPoint(uX, uY);
     1314        QPoint cursorPosition = QPoint(uX, uY) - m_pMachineView->uisession()->cursorHotspot();
    13151315        QSize cursorSize = m_pMachineView->uisession()->cursorSize();
    13161316
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r77724 r77726  
    16441644            memcpy(image.scanLine(y), pu32SrcShapeScanline, uWidth * sizeof(uint32_t));
    16451645
    1646         m_cursor = QCursor(QPixmap::fromImage(image), uXHot, uYHot);
     1646        m_cursorPixmap = QPixmap::fromImage(image);
     1647        m_cursor = QCursor(m_cursorPixmap, uXHot, uYHot);
    16471648    }
    16481649    else
     
    17331734            }
    17341735
    1735             m_cursor = QCursor(QBitmap::fromImage(bitmap), QBitmap::fromImage(mask), uXHot, uYHot);
     1736            m_cursorPixmap = QBitmap::fromImage(bitmap);
     1737            m_cursor = QCursor(m_cursorPixmap, QBitmap::fromImage(mask), uXHot, uYHot);
    17361738        }
    17371739        else
     
    17631765            }
    17641766
    1765             m_cursor = QCursor(QPixmap::fromImage(image), uXHot, uYHot);
     1767            m_cursorPixmap = QPixmap::fromImage(image);
     1768            m_cursor = QCursor(m_cursorPixmap, uXHot, uYHot);
    17661769        }
    17671770    }
     
    17871790
    17881791    /* Create cursor-pixmap from the image: */
    1789     QPixmap cursorPixmap = QPixmap::fromImage(image);
     1792    m_cursorPixmap = QPixmap::fromImage(image);
    17901793
    17911794# if defined(VBOX_WS_MAC)
     
    18011804        uXHot /= dDevicePixelRatio;
    18021805        uYHot /= dDevicePixelRatio;
    1803         cursorPixmap.setDevicePixelRatio(dDevicePixelRatio);
     1806        m_cursorPixmap.setDevicePixelRatio(dDevicePixelRatio);
    18041807    }
    18051808# elif defined(VBOX_WS_X11)
     
    18151818        uXHot *= dDevicePixelRatio;
    18161819        uYHot *= dDevicePixelRatio;
    1817         cursorPixmap = cursorPixmap.scaled(cursorPixmap.width() * dDevicePixelRatio, cursorPixmap.height() * dDevicePixelRatio,
    1818                                            Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
     1820        m_cursorPixmap = m_cursorPixmap.scaled(m_cursorPixmap.width() * dDevicePixelRatio, m_cursorPixmap.height() * dDevicePixelRatio,
     1821                                               Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    18191822    }
    18201823# endif /* VBOX_WS_X11 */
    18211824
    18221825    /* Set the new cursor: */
    1823     m_cursor = QCursor(cursorPixmap, uXHot, uYHot);
     1826    m_cursor = QCursor(m_cursorPixmap, uXHot, uYHot);
    18241827    m_fIsValidPointerShapePresent = true;
    18251828    NOREF(srcShapePtrScan);
     
    18321835
    18331836    /* Cache cursor pixmap data: */
    1834     m_cursorPixmap = m_cursor.pixmap();
     1837    m_cursorHotspot = QPoint(uXHot, uYHot);
    18351838    m_cursorSize = m_cursorPixmap.size();
    18361839}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r77724 r77726  
    138138    /** Returns currently cached mouse cursor pixmap. */
    139139    QPixmap cursorPixmap() const { return m_cursorPixmap; }
     140    /** Returns currently cached mouse cursor hotspot. */
     141    QPoint cursorHotspot() const { return m_cursorHotspot; }
    140142    /** Returns currently cached mouse cursor size. */
    141143    QSize cursorSize() const { return m_cursorSize; }
     
    488490    /** Holds cached mouse cursor pixmap. */
    489491    QPixmap  m_cursorPixmap;
     492    /** Holds cached mouse cursor hotspot. */
     493    QPoint   m_cursorHotspot;
    490494    /** Holds cached mouse cursor size. */
    491495    QSize    m_cursorSize;
Note: See TracChangeset for help on using the changeset viewer.

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