src/gui/kernel/qdnd_x11.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
--- a/src/gui/kernel/qdnd_x11.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/gui/kernel/qdnd_x11.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -51,10 +51,10 @@
 #include "qbitmap.h"
 #include "qdesktopwidget.h"
 #include "qevent.h"
-#include "qdatetime.h"
 #include "qiodevice.h"
 #include "qpointer.h"
 #include "qcursor.h"
+#include "qelapsedtimer.h"
 #include "qvariant.h"
 #include "qvector.h"
 #include "qurl.h"
@@ -1299,6 +1299,12 @@
         return true;
     }
 
+    if (e->type() == QEvent::ShortcutOverride) {
+        // prevent accelerators from firing while dragging
+        e->accept();
+        return true;
+    }
+
     if (e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease) {
         QKeyEvent *ke = ((QKeyEvent*)e);
         if (ke->key() == Qt::Key_Escape && e->type() == QEvent::KeyPress) {
@@ -1340,9 +1346,9 @@
     if (!noDropCursor) {
 #ifndef QT_NO_CURSOR
         noDropCursor = new QCursor(Qt::ForbiddenCursor);
-        moveCursor = new QCursor(dragCursor(Qt::MoveAction), 0,0);
-        copyCursor = new QCursor(dragCursor(Qt::CopyAction), 0,0);
-        linkCursor = new QCursor(dragCursor(Qt::LinkAction), 0,0);
+        moveCursor = new QCursor(Qt::DragMoveCursor);
+        copyCursor = new QCursor(Qt::DragCopyCursor);
+        linkCursor = new QCursor(Qt::DragLinkCursor);
 #endif
     }
 
@@ -1911,23 +1917,19 @@
         // then we could still have problems, but this is highly unlikely
         QApplication::flush();
 
-        QTime started = QTime::currentTime();
-        QTime now = started;
+        QElapsedTimer timer;
+        timer.start();
         do {
             XEvent event;
             if (XCheckTypedEvent(X11->display, ClientMessage, &event))
                 qApp->x11ProcessEvent(&event);
 
-            now = QTime::currentTime();
-            if (started > now) // crossed midnight
-                started = now;
-
             // sleep 50 ms, so we don't use up CPU cycles all the time.
             struct timeval usleep_tv;
             usleep_tv.tv_sec = 0;
             usleep_tv.tv_usec = 50000;
             select(0, 0, 0, 0, &usleep_tv);
-        } while (object && started.msecsTo(now) < 1000);
+        } while (object && timer.hasExpired(1000));
     }
 
     object = o;