Bug 95415

Summary: drop target runs mad on loaded system and strangely moves around when dragged
Product: [Applications] kget Reporter: Marcel Partap <mpartap>
Component: generalAssignee: KGet authors <kget>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Marcel Partap 2004-12-18 21:47:56 UTC
Version:           v0.8.3 (using KDE 3.3.90 (alpha1, CVS >= 20041206), Gentoo)
Compiler:          gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)
OS:                Linux (i686) release 2.6.9-gentoo

I just accidently stumbled across this, it does not move the path you dropped it but wanders about in confusion until after some time it settles down somewhere you didn't want it.
And I think it should be always on top _and have no taskbar entry_ by default. BTW, right now, when you close that, konqueror doesn't notice and still shows 'hide drop target' as action.
rgrds
Comment 1 Marcel Partap 2004-12-18 21:48:23 UTC
dragged not dropped *fg
Comment 2 Marcel Partap 2004-12-18 21:51:04 UTC
tried it again, it feels more like you throw rather than drag it.. very strange indeed.
Comment 3 Rainer Wirtz 2005-02-11 05:00:57 UTC
I can confirm this but I can spot nothing in the code that could cause this.
Maybe it's a qt bug. I'll try to investigate further
Comment 4 Pino Toscano 2005-07-18 19:11:01 UTC
SVN commit 435925 by pino:

Another backport from the make_kget_cool branch: make the drop target movement
more fluid.
The drop target now can be slightly slower than the mouse movement when dragged,
but sure it doesn't behave anymore like a crazy ball.

BUG: 95415


 M  +17 -4     droptarget.cpp  
 M  +6 -2      droptarget.h  


--- trunk/KDE/kdenetwork/kget/droptarget.cpp #435924:435925
@@ -102,6 +102,8 @@
     popupMenu->insertSeparator();
     kmain->m_paQuit->plug(popupMenu);
 
+    isdragging = false;
+
     // Enable dropping
     setAcceptDrops(true);
 }
@@ -119,9 +121,11 @@
     if (e->button() == LeftButton)
     {
         // toggleMinimizeRestore ();
-        oldX = 0;
-        oldY = 0;
-
+//        oldX = 0;
+//        oldY = 0;
+        isdragging = true;
+        dx = QCursor::pos().x() - pos().x();
+        dy = QCursor::pos().y() - pos().y();
     }
     else if (e->button() == RightButton)
     {
@@ -198,16 +202,25 @@
 /** No descriptions */
 void DropTarget::mouseMoveEvent(QMouseEvent * e)
 {
+/*
     if (oldX == 0)
     {
         oldX = e->x();
         oldY = e->y();
         return;
     }
++*/
+    if (isdragging)
+        move( QCursor::pos().x() - dx, QCursor::pos().y() - dy );
 
-    QWidget::move(x() + (e->x() - oldX), y() + (e->y() - oldY));
+//    move(x() + (e->x() - oldX), y() + (e->y() - oldY));  // <<--
 }
 
+void DropTarget::mouseReleaseEvent(QMouseEvent *)
+{
+    isdragging = false;
+}
+
 /** No descriptions */
 void DropTarget::mouseDoubleClickEvent(QMouseEvent * e)
 {
--- trunk/KDE/kdenetwork/kget/droptarget.h #435924:435925
@@ -56,6 +56,7 @@
     /** No descriptions */
     virtual void mouseMoveEvent(QMouseEvent *);
     virtual void mousePressEvent(QMouseEvent * e);
+    virtual void mouseReleaseEvent(QMouseEvent *);
 
 private slots:
     void toggleSticky();
@@ -76,8 +77,11 @@
     QBitmap mask;
 public:                      // Public attributes
     /**  */
-    int oldX;
-    int oldY;
+//    int oldX;
+//    int oldY;
+    int dx;
+    int dy;
+    bool isdragging;
 };
 
 #endif                          // _DROPTARGET_H