[vlc-commits] [Git][videolan/vlc][master] qt: remove incorrect mouse event scaling

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Fri Apr 8 22:18:36 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
02fcb4a0 by Romain Vimont at 2022-04-08T21:10:28+00:00
qt: remove incorrect mouse event scaling

Since commit 66e86e159eb18b151a5deab0c07775477c3dd197, m_sourceSize is
never written, and no scaling must be applied.

This makes hoverMoveEvent() consistent with mouseMoveEvent(), which did
not apply any scaling.

Fixes #25385
Fixes #26799

- - - - -


2 changed files:

- modules/gui/qt/maininterface/videosurface.cpp
- modules/gui/qt/maininterface/videosurface.hpp


Changes:

=====================================
modules/gui/qt/maininterface/videosurface.cpp
=====================================
@@ -150,11 +150,6 @@ void VideoSurface::setCtx(MainCtx* ctx)
     emit ctxChanged(ctx);
 }
 
-QSize VideoSurface::getSourceSize() const
-{
-    return m_sourceSize;
-}
-
 int VideoSurface::qtMouseButton2VLC( Qt::MouseButton qtButton )
 {
     switch( qtButton )
@@ -206,9 +201,7 @@ void VideoSurface::hoverMoveEvent(QHoverEvent* event)
     QPointF current_pos = event->posF();
     if (current_pos != m_oldHoverPos)
     {
-        float scaleW = m_sourceSize.width() / width();
-        float scaleH = m_sourceSize.height() / height();
-        emit mouseMoved(current_pos.x() * scaleW, current_pos.y() * scaleH);
+        emit mouseMoved(current_pos.x(), current_pos.y());
         m_oldHoverPos = current_pos;
     }
     event->accept();


=====================================
modules/gui/qt/maininterface/videosurface.hpp
=====================================
@@ -66,7 +66,6 @@ class VideoSurface : public QQuickItem
 {
     Q_OBJECT
     Q_PROPERTY(MainCtx* ctx READ getCtx WRITE setCtx NOTIFY ctxChanged FINAL)
-    Q_PROPERTY(QSize sourceSize READ getSourceSize NOTIFY sourceSizeChanged FINAL)
     Q_PROPERTY(Qt::CursorShape cursorShape READ getCursorShape WRITE setCursorShape RESET unsetCursor FINAL)
 
 public:
@@ -75,8 +74,6 @@ public:
     MainCtx* getCtx();
     void setCtx(MainCtx* ctx);
 
-    QSize getSourceSize() const;
-
 protected:
     int qtMouseButton2VLC( Qt::MouseButton qtButton );
 
@@ -100,7 +97,6 @@ protected:
 
 signals:
     void ctxChanged(MainCtx*);
-    void sourceSizeChanged(QSize);
     void surfaceSizeChanged(QSizeF);
     void surfacePositionChanged(QPointF);
 
@@ -120,8 +116,6 @@ protected slots:
 private:
     MainCtx* m_ctx = nullptr;
 
-    bool m_sourceSizeChanged = false;
-    QSize m_sourceSize;
     QPointF m_oldHoverPos;
 
     VideoSurfaceProvider* m_provider = nullptr;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/02fcb4a00867ec607c8700b5fa9d5f21b92efce6

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/02fcb4a00867ec607c8700b5fa9d5f21b92efce6
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list