- Timestamp:
- Jan 12, 2010, 12:00:10 PM (15 years ago)
- Location:
- trunk/src/gui/kernel
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qapplication_pm.cpp
r438 r447 64 64 #include "qkeymapper_p.h" 65 65 #include "qcursor_p.h" 66 66 67 67 68 #define WM_KBDLAYERCHANGED 0x0BD4 // defined in OS2TK45/h/pmbidi.h … … 702 703 #define SV_WORKAREA_XLEFT 54 703 704 704 #ifndef QT_NO_DRAGANDDROP705 extern MRESULT qt_dispatchDragAndDrop(QWidget *, const QMSG &); // qdnd_pm.cpp706 #endif707 708 705 /*! 709 706 \internal … … 921 918 #ifndef QT_NO_DRAGANDDROP 922 919 } else if (msg >= WM_DRAGFIRST && msg <= WM_DRAGLAST) { 923 return qt_dispatchDragAndDrop(widget, qmsg);920 return dispatchDragAndDrop(widget, qmsg); 924 921 #endif 925 922 } else { … … 2142 2139 if (rc == RGN_ERROR) { // The update bounding rect is invalid 2143 2140 GpiDestroyRegion(displayPS, hrgn); 2144 d_func()->hd = NULLHANDLE;2145 2141 setAttribute(Qt::WA_PendingUpdate, false); 2146 2142 return false; … … 2166 2162 if (rcl.xRight <= rcl.xLeft || rcl.yTop <= rcl.yBottom) { 2167 2163 WinEndPaint(d_func()->hd); 2164 2168 2165 GpiDestroyRegion(displayPS, hrgn); 2169 d_func()->hd = NULLHANDLE;2170 2166 setAttribute(Qt::WA_PendingUpdate, false); 2171 2167 return true; … … 2173 2169 2174 2170 // flip y coordinate 2175 rcl.yBottom = height() - (rcl.yBottom + 1);2176 rcl.yTop = height() - (rcl.yTop + 1);2177 2178 2171 // note: right top point is exlusive in rcl 2179 QRect updRect(QPoint(rcl.xLeft, rcl.yTop + 1),2180 QPoint(rcl.xRight - 1, rcl.yBottom));2172 QRect updRect(QPoint(rcl.xLeft, ), 2173 QPoint(rcl.xRight - 1, )); 2181 2174 2182 2175 // Mapping region from system to qt (32 bit) coordinate system. -
trunk/src/gui/kernel/qdnd.cpp
r438 r447 358 358 xdndMimeTransferedPixmapIndex = 0; 359 359 #endif 360 361 362 360 363 } 361 364 … … 363 366 QDragManager::~QDragManager() 364 367 { 368 369 370 365 371 #ifndef QT_NO_CURSOR 366 372 if (restoreCursor) -
trunk/src/gui/kernel/qdnd_p.h
r438 r447 63 63 #ifdef Q_WS_MAC 64 64 # include "private/qt_mac_p.h" 65 66 67 68 65 69 #endif 66 70 … … 205 209 LPDATAOBJECT currentDataObject; 206 210 #elif defined(Q_WS_PM) 207 friend class Q PMDragData;211 friend class Q; 208 212 QPMDragData *d; 209 213 #endif … … 267 271 #endif 268 272 273 274 275 276 277 278 279 280 269 281 private: 270 282 QPixmap *pm_cursor; … … 272 284 #ifdef Q_WS_QWS 273 285 Qt::DropAction currentActionForOverrideCursor; 286 287 288 274 289 #endif 275 290 -
trunk/src/gui/kernel/qdnd_pm.cpp
r444 r447 93 93 94 94 private: 95 95 96 96 97 void initWorkers(); … … 102 103 DRAGINFO *di; 103 104 QList<QPMMime::DropWorker*> workers; 105 106 107 108 109 110 111 112 113 114 115 116 104 117 }; 105 118 … … 107 120 : initialized(false), dropped(false) 108 121 , gotWorkers(false), di(NULL) 109 { 110 QDragManager *manager = QDragManager::self(); 111 Q_ASSERT(!manager->dropData->d); 112 manager->dropData->d = this; 122 , lastDragOverWidget(0), lastDragOverOp(0) 123 , supportedOps(0), sourceAllowsOp(false) 124 , lastDropReply(DOR_NEVERDROP), lastOpRequest(DO_UNKNOWN) 125 , lastProposedAction(Qt::CopyAction) 126 { 113 127 } 114 128 … … 116 130 { 117 131 reset(); 118 119 QDragManager *manager = QDragManager::self();120 if (manager) {121 Q_ASSERT(manager->dropData->d == this);122 manager->dropData->d = 0;123 }124 132 } 125 133 … … 265 273 } 266 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 267 305 /*! 268 306 * \internal 269 307 * Direct manipulation (Drag & Drop) event handler 270 308 */ 271 MRESULT qt_dispatchDragAndDrop(QWidget *widget, const QMSG &qmsg) 272 { 273 static QWidget *lastDragOverWidget = 0; // last target widget 274 static USHORT lastDragOverOp = 0; // last DM_DRAGOVER operation 275 276 static USHORT supportedOps = 0; // operations supported by all items 277 static bool sourceAllowsOp = false; // does source allow requested operation 278 279 static USHORT lastDropReply = DOR_NEVERDROP; // last reply to DM_DRAGOVER 280 static USHORT lastOpRequest = DO_UNKNOWN; // last op requested in DM_DRAGOVER 281 282 static Qt::DropAction lastProposedAction = Qt::CopyAction; // last proposed action 283 static QRect lastAnswerRect; // last accepted rectangle from the target 284 // @todo use lastAnswerRect to compress DM_DRAGOVER events 285 286 static QPMDragData dragData; 287 309 MRESULT QDragManager::dispatchDragAndDrop(QWidget *widget, const QMSG &qmsg) 310 { 288 311 Q_ASSERT(widget); 289 312 … … 291 314 292 315 QDragManager *manager = QDragManager::self(); 316 317 318 319 293 320 294 321 switch (qmsg.msg) { … … 312 339 dragOverWidget = widget; 313 340 314 bool first = lastDragOverWidget != dragOverWidget;341 bool first = lastDragOverWidget != dragOverWidget; 315 342 if (first) { 316 343 // the first DM_DRAGOVER message 317 if ( lastDragOverWidget != 0) {344 if (lastDragOverWidget != 0) { 318 345 // send drag leave to the old widget 319 dragData .reset();346 dragDatareset(); 320 347 QPointer<QWidget> dragOverWidgetGuard(dragOverWidget); 321 348 QDragLeaveEvent dle; 322 QApplication::sendEvent(lastDragOverWidget, &dle);349 lastDragOverWidget, &dle); 323 350 if (!dragOverWidgetGuard) { 324 351 dragOverWidget = widget->childAt(pnt); … … 327 354 } 328 355 } 329 lastDragOverWidget = dragOverWidget; 330 lastDragOverOp = 0; 331 supportedOps = DO_COPYABLE | DO_MOVEABLE | DO_LINKABLE; 332 sourceAllowsOp = false; 333 lastDropReply = DOR_NEVERDROP; 334 lastOpRequest = DO_UNKNOWN; 335 lastProposedAction = manager->defaultAction(toQDragDropActions(supportedOps), 336 Qt::NoModifier); 337 lastAnswerRect = QRect(); 356 dragData->lastDragOverWidget = dragOverWidget; 357 dragData->lastDragOverOp = 0; 358 dragData->supportedOps = DO_COPYABLE | DO_MOVEABLE | DO_LINKABLE; 359 dragData->sourceAllowsOp = false; 360 dragData->lastDropReply = DOR_NEVERDROP; 361 dragData->lastOpRequest = DO_UNKNOWN; 362 dragData->lastProposedAction = 363 manager->defaultAction(toQDragDropActions(dragData->supportedOps), 364 Qt::NoModifier); 365 dragData->lastAnswerRect = QRect(); 338 366 // ensure drag data is reset (just in case of a wrong msg flow...) 339 dragData .reset();367 dragDatareset(); 340 368 } 341 369 … … 362 390 break; 363 391 } 364 supportedOps &= item->fsSupportedOps;392 supportedOps &= item->fsSupportedOps; 365 393 } 366 394 if (dropReply != DOR_NEVERDROP) { 367 395 Q_ASSERT(itemCount); 368 if (!itemCount || ! supportedOps) {396 if (!itemCount || !supportedOps) { 369 397 // items don't have even a single common operation... 370 398 dropReply = DOR_NEVERDROP;