Changeset 458 for trunk/src/gui/kernel
- Timestamp:
- Jan 21, 2010, 12:46:24 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qdnd_pm.cpp
r454 r458 53 53 #include "qdesktopwidget.h" 54 54 #include "qfile.h" 55 55 56 #include "qdnd_p.h" 56 57 #include "qdebug.h" … … 90 91 void reset() { reset(false); } 91 92 92 void set Dropped(bool d) { dropped= d; }93 bool i sDropped() const { return dropped; }93 void set = d; } 94 bool i; } 94 95 95 96 DRAGINFO *info() const { return di; } 97 96 98 97 99 bool hasFormat_sys(const QString &mimeType); … … 106 108 107 109 bool initialized : 1; 108 bool dropped: 1;110 bool : 1; 109 111 bool gotWorkers : 1; 112 110 113 111 114 DRAGINFO *di; … … 125 128 126 129 QPMDragData::QPMDragData() 127 : initialized(false), dropped(false)128 , gotWorkers(false), di(NULL)130 : initialized(false), (false) 131 , gotWorkers(false), di(NULL) 129 132 , lastDragOverWidget(0), lastDragOverOp(0) 130 133 , supportedOps(0), sourceAllowsOp(false) … … 147 150 initialized = true; 148 151 di = info; 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 149 208 } 150 209 … … 196 255 workers.clear(); 197 256 di = 0; 198 initialized = dropped = gotWorkers= false;257 initialized = = false; 199 258 } 200 259 … … 229 288 QVariant result; 230 289 231 // we may only do data transfer after DM_DROP is sent. Return shortly. 232 if (!isDropped()) 290 // If the source doesn't support synchronous rendering, we may only do data 291 // transfer after DM_DROP is processed by us. Return shortly. 292 if (!canSyncRender() && !inFakeDrop()) 233 293 return result; 234 294 … … 360 420 void QDragManager::sendDropEvent(QWidget *receiver, QEvent *event) 361 421 { 422 423 424 425 426 427 428 362 429 Q_ASSERT(!inDrag); 363 inDrag = true; 430 if (!inFakeDrop) 431 inDrag = true; 432 364 433 QApplication::sendEvent(receiver, event); 365 // make sure that all issued update requests are handled before we 366 // return from the DM_DRAGOVER/DM_DRAGLEAVE/DM_DROP message; otherwise 367 // we'll get screen corruption due to unexpected screen updates while 368 // dragging 369 QApplication::sendPostedEvents(0, QEvent::UpdateRequest); 370 inDrag = false; 434 435 if (!inFakeDrop) { 436 // make sure that all issued update requests are handled before we 437 // return from the DM_DRAGOVER/DM_DRAGLEAVE/DM_DROP message; otherwise 438 // we'll get screen corruption due to unexpected screen updates while 439 // dragging 440 QApplication::sendPostedEvents(0, QEvent::UpdateRequest); 441 inDrag = false; 442 } 371 443 } 372 444 … … 561 633 DEBUG(("DM_DROP: hwnd %lX di %p", qmsg.hwnd, qmsg.mp1)); 562 634 563 // Odin32 apps produce incorrect message flow, ignore 564 Q_ASSERT(dragData->lastDragOverWidget != 0); 565 if (dragData->lastDragOverWidget == 0) 566 return 0; 567 568 // Odin32 apps send DM_DROP even if we replied DOR_NEVERDROP or 569 // DOR_NODROP, simulate DM_DRAGLEAVE 570 Q_ASSERT(dragData->lastDropReply == DOR_DROP); 571 if (dragData->lastDropReply != DOR_DROP) { 572 QMSG qmsg2 = qmsg; 573 qmsg2.msg = DM_DRAGLEAVE; 574 dispatchDragAndDrop(widget, qmsg2); 575 return 0; 635 // sanity 636 Q_ASSERT(!dragData->canSyncRender() || qmsg.mp1); 637 638 DRAGINFO *info = 0; 639 640 if (dragData->canSyncRender() || qmsg.mp1) { 641 // Odin32 apps produce incorrect message flow, ignore 642 Q_ASSERT(dragData->lastDragOverWidget != 0); 643 if (dragData->lastDragOverWidget == 0) 644 return 0; 645 646 // Odin32 apps send DM_DROP even if we replied DOR_NEVERDROP or 647 // DOR_NODROP, simulate DM_DRAGLEAVE 648 Q_ASSERT(dragData->lastDropReply == DOR_DROP); 649 if (dragData->lastDropReply != DOR_DROP) { 650 QMSG qmsg2 = qmsg; 651 qmsg2.msg = DM_DRAGLEAVE; 652 dispatchDragAndDrop(widget, qmsg2); 653 return 0; 654 } 655 656 // sanity 657 Q_ASSERT((DRAGINFO *)qmsg.mp1 == dragData->info()); 658 659 info = (DRAGINFO *)qmsg.mp1; 660 ok = DrgAccessDraginfo(info); 661 Q_ASSERT(ok && info); 662 if (!ok || !info) 663 return 0; 664 665 if (!dragData->canSyncRender()) { 666 // The source doesn't support syncrhonous rendering (i.e. 667 // it won't issue DM_RENDERCOMPLETE until we return from 668 // DM_DROP) so we have to post a message to ourselves to do 669 // it asynchronously. For simplicity, we reuse DM_DRAG with 670 // mp1 = 0 for this purpose. 671 WinPostMsg(qmsg.hwnd, DM_DROP, 0, 0); 672 return 0; 673 } 674 } else { 675 // we're in a fake DM_DROP we posted above 676 dragData->setInFakeDrop(true); 677 info = dragData->info(); 678 Q_ASSERT(info); 576 679 } 577 578 DRAGINFO *info = (DRAGINFO *)qmsg.mp1;579 ok = DrgAccessDraginfo(info);580 Q_ASSERT(ok && info);581 if (!ok || !info)582 return 0;583 680 584 681 // flip y coordinate … … 597 694 598 695 QMimeData *data = manager->source() ? manager->dragPrivate()->data : manager->dropData; 599 600 dragData->setDropped(true);601 696 602 697 QDropEvent de(pnt, dragData->lastAction, data, mouseButtons(),
Note:
See TracChangeset
for help on using the changeset viewer.