1297 beingCancelled = false; |
1297 beingCancelled = false; |
1298 eventLoop->exit(); |
1298 eventLoop->exit(); |
1299 return true; |
1299 return true; |
1300 } |
1300 } |
1301 |
1301 |
|
1302 if (e->type() == QEvent::ShortcutOverride) { |
|
1303 // prevent accelerators from firing while dragging |
|
1304 e->accept(); |
|
1305 return true; |
|
1306 } |
|
1307 |
1302 if (e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease) { |
1308 if (e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease) { |
1303 QKeyEvent *ke = ((QKeyEvent*)e); |
1309 QKeyEvent *ke = ((QKeyEvent*)e); |
1304 if (ke->key() == Qt::Key_Escape && e->type() == QEvent::KeyPress) { |
1310 if (ke->key() == Qt::Key_Escape && e->type() == QEvent::KeyPress) { |
1305 cancel(); |
1311 cancel(); |
1306 qApp->removeEventFilter(this); |
1312 qApp->removeEventFilter(this); |
1338 void QDragManager::updateCursor() |
1344 void QDragManager::updateCursor() |
1339 { |
1345 { |
1340 if (!noDropCursor) { |
1346 if (!noDropCursor) { |
1341 #ifndef QT_NO_CURSOR |
1347 #ifndef QT_NO_CURSOR |
1342 noDropCursor = new QCursor(Qt::ForbiddenCursor); |
1348 noDropCursor = new QCursor(Qt::ForbiddenCursor); |
1343 moveCursor = new QCursor(dragCursor(Qt::MoveAction), 0,0); |
1349 moveCursor = new QCursor(Qt::DragMoveCursor); |
1344 copyCursor = new QCursor(dragCursor(Qt::CopyAction), 0,0); |
1350 copyCursor = new QCursor(Qt::DragCopyCursor); |
1345 linkCursor = new QCursor(dragCursor(Qt::LinkAction), 0,0); |
1351 linkCursor = new QCursor(Qt::DragLinkCursor); |
1346 #endif |
1352 #endif |
1347 } |
1353 } |
1348 |
1354 |
1349 QCursor *c; |
1355 QCursor *c; |
1350 if (willDrop) { |
1356 if (willDrop) { |
1909 // the last drag and drop operation hasn't finished, so we are going to wait |
1915 // the last drag and drop operation hasn't finished, so we are going to wait |
1910 // for one second to see if it does... if the finish message comes after this, |
1916 // for one second to see if it does... if the finish message comes after this, |
1911 // then we could still have problems, but this is highly unlikely |
1917 // then we could still have problems, but this is highly unlikely |
1912 QApplication::flush(); |
1918 QApplication::flush(); |
1913 |
1919 |
1914 QTime started = QTime::currentTime(); |
1920 QElapsedTimer timer; |
1915 QTime now = started; |
1921 timer.start(); |
1916 do { |
1922 do { |
1917 XEvent event; |
1923 XEvent event; |
1918 if (XCheckTypedEvent(X11->display, ClientMessage, &event)) |
1924 if (XCheckTypedEvent(X11->display, ClientMessage, &event)) |
1919 qApp->x11ProcessEvent(&event); |
1925 qApp->x11ProcessEvent(&event); |
1920 |
|
1921 now = QTime::currentTime(); |
|
1922 if (started > now) // crossed midnight |
|
1923 started = now; |
|
1924 |
1926 |
1925 // sleep 50 ms, so we don't use up CPU cycles all the time. |
1927 // sleep 50 ms, so we don't use up CPU cycles all the time. |
1926 struct timeval usleep_tv; |
1928 struct timeval usleep_tv; |
1927 usleep_tv.tv_sec = 0; |
1929 usleep_tv.tv_sec = 0; |
1928 usleep_tv.tv_usec = 50000; |
1930 usleep_tv.tv_usec = 50000; |
1929 select(0, 0, 0, 0, &usleep_tv); |
1931 select(0, 0, 0, 0, &usleep_tv); |
1930 } while (object && started.msecsTo(now) < 1000); |
1932 } while (object && timer.hasExpired(1000)); |
1931 } |
1933 } |
1932 |
1934 |
1933 object = o; |
1935 object = o; |
1934 object->d_func()->target = 0; |
1936 object->d_func()->target = 0; |
1935 xdnd_data.deco = new QShapedPixmapWidget(object->source()->window()); |
1937 xdnd_data.deco = new QShapedPixmapWidget(object->source()->window()); |