Bug 348637 - Infinite moving picture - possible patch
Summary: Infinite moving picture - possible patch
Status: RESOLVED INTENTIONAL
Alias: None
Product: gwenview
Classification: Applications
Component: general (other bugs)
Version First Reported In: 5.0.0
Platform: Compiled Sources Linux
: NOR minor
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-03 14:05 UTC by Błażej Szczygieł
Modified: 2020-11-11 00:47 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Patch for infinite moving picture (Qt5 bug workaround) (1.66 KB, patch)
2015-06-03 14:16 UTC, Błażej Szczygieł
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Błażej Szczygieł 2015-06-03 14:05:03 UTC
Mouse when moving picture out of imageview doesn't wraps like in KDE4. This is very useful.

Reproducible: Always

Steps to Reproduce:
Move the image by mouse out of image view.

Actual Results:  
Mouse doesn't wrap.

Expected Results:  
Mouse wraps like in KDE4.

Patch tested on Arch Linux, Qt 5.4.2:

--- abstractimageview.cpp.orig  2015-06-03 16:00:49.241659454 +0200
+++ abstractimageview.cpp       2015-06-03 16:00:55.708326391 +0200
@@ -306,7 +306,6 @@
     QPointF mousePos = event->pos();
     QPointF newScrollPos = d->mScrollPos + d->mLastDragPos - mousePos;
 
-#if 0 // commented out due to mouse pointer warping around, bug in Qt?
     // Wrap mouse pos
     qreal maxWidth = boundingRect().width();
     qreal maxHeight = boundingRect().height();
@@ -315,22 +314,28 @@
     // The mouse get placed 1 pixel before/after the margin to avoid getting
     // considered as needing to wrap the other way in next mouseMoveEvent
     // (because we don't check the move vector)
+    bool setCursorPos = false;
     const int margin = 5;
     if (mousePos.x() <= margin) {
         mousePos.setX(maxWidth - margin - 1);
+        setCursorPos = true;
     } else if (mousePos.x() >= maxWidth - margin) {
         mousePos.setX(margin + 1);
+        setCursorPos = true;
     }
     if (mousePos.y() <= margin) {
         mousePos.setY(maxHeight - margin - 1);
+        setCursorPos = true;
     } else if (mousePos.y() >= maxHeight - margin) {
         mousePos.setY(margin + 1);
+        setCursorPos = true;
     }
 
-    // Set mouse pos (Hackish translation to screen coords!)
-    QPointF screenDelta = event->screenPos() - event->pos();
-    QCursor::setPos((mousePos + screenDelta).toPoint());
-#endif
+    if (setCursorPos) {
+        // Set mouse pos (Hackish translation to screen coords!)
+        QPointF screenDelta = event->screenPos() - event->pos();
+        QCursor::setPos((mousePos + screenDelta).toPoint());
+    }
 
     d->mLastDragPos = mousePos;
     d->setScrollPos(newScrollPos);
Comment 1 Błażej Szczygieł 2015-06-03 14:16:37 UTC
Created attachment 92975 [details]
Patch for infinite moving picture (Qt5 bug workaround)

Patch tested on Arch Linux, Qt 5.4.2
Comment 2 Nate Graham 2017-09-09 01:53:19 UTC
Thanks for the patch! Unfortunately, as you have surely noticed, it has been ignored for 2 years. :( Patches in bugzilla tickets tend to get lost, so I encourage you to upload it to http://phabricator.kde.org/, which is the KDE patch submission infrastructure (among other things).
Comment 3 Justin Zobel 2020-11-10 03:58:36 UTC
If you're still interested in submitting this patch, please see https://invent.kde.org/graphics/gwenview/-/merge_requests, thanks.
Comment 4 Nate Graham 2020-11-11 00:47:16 UTC
I tried applying this patch, but it seems like the feature in question no longer makes sense as you can't drag the image in the image view to switch images anymore. Furthermore, doing this breaks dragging the image out of the image view and into another app. So I don't think we'll be doing this, sorry. :)