- Timestamp:
- Jan 20, 2010, 12:56:59 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qdnd_pm.cpp
r450 r451 292 292 } 293 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 294 343 void QDragManager::init_sys() 295 344 { … … 448 497 QDragEnterEvent dee(pnt, 449 498 toQDragDropActions(dragData->supportedOps), 450 data, QApplication::mouseButtons(), 451 QApplication::keyboardModifiers()); 499 data, mouseButtons(), keyboardModifiers()); 452 500 dee.setDropAction(dragData->lastAction); 453 501 sendDropEvent(dragOverWidget, &dee); … … 469 517 QDragMoveEvent dme(pnt, 470 518 toQDragDropActions(dragData->supportedOps), 471 data, QApplication::mouseButtons(), 472 QApplication::keyboardModifiers()); 519 data, mouseButtons(), keyboardModifiers()); 473 520 // accept by default, since enter event was accepted. 474 521 dme.setDropAction(dragData->lastAction); … … 549 596 dragData->setDropped(true); 550 597 551 QDropEvent de(pnt, dragData->lastAction, data, QApplication::mouseButtons(),552 QApplication::keyboardModifiers());598 QDropEvent de(pnt, dragData->lastAction, data, mouseButtons(), 599 keyboardModifiers()); 553 600 if (dragData->lastDropReply == DOR_DROP) 554 601 de.setDropAction(dragData->lastAction); … … 651 698 // QPMObjectWindow interface 652 699 MRESULT message(ULONG msg, MPARAM mp1, MPARAM mp2); 653 700 654 701 private: 655 702 QList<DragWorker*> workers; … … 667 714 bool gotExcl = false; // got isExclusive() worker? 668 715 bool skipExcl = false; // skip isExclusive() or itemCount() > 1 workers? 669 ULONG coopLevel = 0; // itemCount() level for !isExclusive() workers 716 ULONG coopLevel = 0; // itemCount() level for !isExclusive() workers 670 717 671 718 bool gotExclForMime = false; … … 734 781 // target's side (where the first encountered drop worker 735 782 // for the given RMF would be used for actual data transfer 736 // anyway). See also QClipboard::setData(). 783 // anyway). See also QClipboard::setData(). 737 784 break; 738 785 } … … 755 802 756 803 // remove either all exclusive workers or all their fall-back workers 757 // (depending on skipExcl) and remove duplicates 804 // (depending on skipExcl) and remove duplicates 758 805 for (QList<DragWorker*>::iterator it = workers.begin(); 759 806 it < workers.end();) { … … 767 814 } 768 815 769 #if defined(QDND_DEBUG) 816 #if defined(QDND_DEBUG) 770 817 foreach (DragWorker *wrk, workers) { 771 818 DEBUG(() << "QPMCoopDragWorker: Will use worker" << wrk 772 819 << "( isExclusive" << wrk->isExclusive() 773 << "itemCount" << wrk->itemCount() << ")"); 820 << "itemCount" << wrk->itemCount() << ")"); 774 821 } 775 822 #endif … … 785 832 if (!firstWorker) 786 833 return 0; 787 834 788 835 if (firstWorker->isExclusive() && firstWorker->itemCount() == 0) { 789 836 // this is a super exclusive worker that will do everything on its own 790 837 return firstWorker->hwnd(); 791 838 } 792 839 793 840 return QPMObjectWindow::hwnd(); 794 841 } … … 806 853 { 807 854 bool moveDisallowed = false; 808 855 809 856 foreach(DragWorker *wrk, workers) { 810 857 // disallow the Move operation if at least one worker asked so … … 837 884 return firstWorker->createDragInfo(targetName, supportedOps); 838 885 } 839 886 840 887 // note that all workers at this place require the same amount of items 841 888 // (guaranteed by collectWorkers()) 842 889 843 890 DEBUG(() << "QPMCoopDragWorker: itemCnt" << itemCnt); 844 891 … … 847 894 if (!info) 848 895 return 0; 849 896 850 897 // collect all mechanism/format pairs 851 898 QByteArray allFormats; … … 866 913 867 914 static ULONG itemID = 0; 868 915 869 916 const char *type = 0; 870 917 const char *ext = 0; … … 885 932 else 886 933 name = QString(QLatin1String("%1 %2")).arg(targetName).arg(i + 1); 887 934 888 935 if (ext) { 889 936 name += QLatin1Char('.'); … … 896 943 // Note 1: DRAGITEM::hstrType is actually ignored by WPS, 897 944 // only the target extension matters. 898 945 899 946 // Note 2: We're not required to fill in the hwndItem field because we 900 947 // use the DC_PREPARE flag (to indicate it will be filled later, after 901 948 // DM_RENDERPREPARE); however, Mozilla refuses to render if hwndItem 902 949 // is initially 0. Set it to our HWND instead (we'll issue a warning if 903 // DM_RENDER or DM_ENDCONVERSATION is erroneously sent to us) 950 // DM_RENDER or DM_ENDCONVERSATION is erroneously sent to us) 904 951 905 952 item->hwndItem = hwnd(); … … 915 962 item->fsSupportedOps = supportedOps; 916 963 } 917 964 918 965 if (!ok) { 919 966 DrgFreeDraginfo(info); 920 967 info = 0; 921 968 } 922 969 923 970 return info; 924 971 } … … 930 977 DEBUG(() << "Drop target sent DM_RENDERPREPARE after the DnD " 931 978 "session is over!"); 932 // free the given DRAGTRANSFER structure to avoud memory leak 979 // free the given DRAGTRANSFER structure to avoud memory leak 933 980 DRAGTRANSFER *xfer = (DRAGTRANSFER *)mp1; 934 981 if (xfer) … … 936 983 return (MRESULT)FALSE; 937 984 } 938 985 939 986 DRAGTRANSFER *xfer = (DRAGTRANSFER *)mp1; 940 987 Q_ASSERT(xfer && xfer->pditem); 941 988 if (!xfer || !xfer->pditem) 942 989 return (MRESULT)FALSE; 943 990 944 991 // find the item's index (ordinal number) 945 992 ULONG itemCnt = DrgQueryDragitemCount(info); … … 948 995 if (DrgQueryDragitemPtr(info, index) == xfer->pditem) 949 996 break; 950 997 951 998 Q_ASSERT(index < itemCnt); 952 999 if (index >= itemCnt) … … 956 1003 << QPMMime::queryHSTR(xfer->hstrSelectedRMF) << "for item" 957 1004 << index << "( id" << xfer->pditem->ulItemID << ")"); 958 1005 959 1006 QByteArray drm, drf; 960 1007 if (!QPMMime::parseRMF(xfer->hstrSelectedRMF, drm, drf)) { … … 976 1023 return (MRESULT)(xfer->pditem->hwndItem ? TRUE : FALSE); 977 1024 } 978 1025 979 1026 if (msg == DM_RENDER || msg == DM_ENDCONVERSATION) { 980 1027 DEBUG(() << "Drop target sent DM_RENDER or DM_ENDCONVERSATION to the " 981 1028 "drag source window instead of the drag item window!"); 982 1029 if (msg == DM_RENDER) { 983 // free the given DRAGTRANSFER structure to avoud memory leak 1030 // free the given DRAGTRANSFER structure to avoud memory leak 984 1031 DRAGTRANSFER *xfer = (DRAGTRANSFER *)mp1; 985 1032 if (xfer) … … 987 1034 } 988 1035 } 989 1036 990 1037 return (MRESULT)FALSE; 991 1038 } … … 1014 1061 ULONG msg = WinQuerySysValue(HWND_DESKTOP, SV_BEGINDRAG) & 0xFFFF; 1015 1062 switch(msg) { 1016 case WM_BUTTON1MOTIONSTART: vkTerminate = VK_BUTTON1; break; 1017 case WM_BUTTON2MOTIONSTART: vkTerminate = VK_BUTTON2; break; 1018 case WM_BUTTON3MOTIONSTART: vkTerminate = VK_BUTTON3; break; 1063 case WM_BUTTON1MOTIONSTART: vkTerminate = VK_BUTTON1; break; 1064 case WM_BUTTON2MOTIONSTART: vkTerminate = VK_BUTTON2; break; 1065 case WM_BUTTON3MOTIONSTART: vkTerminate = VK_BUTTON3; break; 1019 1066 } 1020 1067 … … 1042 1089 1043 1090 static QPMCoopDragWorker dragWorker; 1044 1091 1045 1092 bool ok = dragWorker.collectWorkers(o); 1046 1093 Q_ASSERT(ok); … … 1098 1145 bool moveDisallowed = dragWorker.cleanup(beingCancelled || target == 0); 1099 1146 dragWorker.src = 0; 1100 1147 1101 1148 moveDisallowed |= beingCancelled || target == 0 || 1102 1149 info->usOperation != DO_MOVE; … … 1139 1186 if (!object || beingCancelled) 1140 1187 return; 1141 1188 1142 1189 beingCancelled = true; 1143 1190
Note:
See TracChangeset
for help on using the changeset viewer.