Changeset 846 for trunk/src/gui/kernel/qdnd_x11.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/kernel/qdnd_x11.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 52 52 #include "qdesktopwidget.h" 53 53 #include "qevent.h" 54 #include "qdatetime.h"55 54 #include "qiodevice.h" 56 55 #include "qpointer.h" 57 56 #include "qcursor.h" 57 #include "qelapsedtimer.h" 58 58 #include "qvariant.h" 59 59 #include "qvector.h" … … 65 65 66 66 #include "qdnd_p.h" 67 #include "qapplication_p.h" 67 68 #include "qt_x11_p.h" 68 69 #include "qx11info_x11.h" … … 1112 1113 } 1113 1114 1114 1115 // TODO: remove and use QApplication::currentKeyboardModifiers() in Qt 4.8. 1116 static Qt::KeyboardModifiers currentKeyboardModifiers() 1117 { 1118 Window root; 1119 Window child; 1120 int root_x, root_y, win_x, win_y; 1121 uint keybstate; 1122 for (int i = 0; i < ScreenCount(X11->display); ++i) { 1123 if (XQueryPointer(X11->display, QX11Info::appRootWindow(i), &root, &child, 1124 &root_x, &root_y, &win_x, &win_y, &keybstate)) 1125 return X11->translateModifiers(keybstate & 0x00ff); 1126 } 1127 return 0; 1128 } 1115 1129 1116 1130 void QX11Data::xdndHandleDrop(QWidget *, const XEvent * xe, bool passive) … … 1159 1173 if (!dropData) 1160 1174 dropData = (manager->object) ? manager->dragPrivate()->data : manager->dropData; 1175 1176 // Drop coming from another app? Update keyboard modifiers. 1177 if (!qt_xdnd_dragging) { 1178 QApplicationPrivate::modifier_buttons = currentKeyboardModifiers(); 1179 } 1161 1180 1162 1181 QDropEvent de(qt_xdnd_current_position, possible_actions, dropData, … … 1300 1319 } 1301 1320 1321 if (e->type() == QEvent::ShortcutOverride) { 1322 // prevent accelerators from firing while dragging 1323 e->accept(); 1324 return true; 1325 } 1326 1302 1327 if (e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease) { 1303 1328 QKeyEvent *ke = ((QKeyEvent*)e); … … 1341 1366 #ifndef QT_NO_CURSOR 1342 1367 noDropCursor = new QCursor(Qt::ForbiddenCursor); 1343 moveCursor = new QCursor( dragCursor(Qt::MoveAction), 0,0);1344 copyCursor = new QCursor( dragCursor(Qt::CopyAction), 0,0);1345 linkCursor = new QCursor( dragCursor(Qt::LinkAction), 0,0);1368 moveCursor = new QCursor(Qt::DragMoveCursor); 1369 copyCursor = new QCursor(Qt::DragCopyCursor); 1370 linkCursor = new QCursor(Qt::DragLinkCursor); 1346 1371 #endif 1347 1372 } … … 1863 1888 Atom type; 1864 1889 1865 if (X11->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0 , false)) {1890 if (X11->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0)) { 1866 1891 if (type == ATOM(INCR)) { 1867 1892 int nbytes = result.size() >= 4 ? *((int*)result.data()) : 0; … … 1912 1937 QApplication::flush(); 1913 1938 1914 Q Time started = QTime::currentTime();1915 QTime now = started;1939 QElapsedTimer timer; 1940 timer.start(); 1916 1941 do { 1917 1942 XEvent event; 1918 1943 if (XCheckTypedEvent(X11->display, ClientMessage, &event)) 1919 1944 qApp->x11ProcessEvent(&event); 1920 1921 now = QTime::currentTime();1922 if (started > now) // crossed midnight1923 started = now;1924 1945 1925 1946 // sleep 50 ms, so we don't use up CPU cycles all the time. … … 1928 1949 usleep_tv.tv_usec = 50000; 1929 1950 select(0, 0, 0, 0, &usleep_tv); 1930 } while (object && started.msecsTo(now) < 1000);1951 } while (object && timer.hasExpired(1000)); 1931 1952 } 1932 1953
Note:
See TracChangeset
for help on using the changeset viewer.