Changeset 473


Ignore:
Timestamp:
Jan 25, 2010, 8:52:56 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: DnD: Fixed: Dropping from Qt apps to some bogus apps (e.g. EPM) didn't work because of the wrong message flow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/kernel/qdnd_pm.cpp

    r472 r473  
    799799    bool isExclusive() const { return true; }
    800800    ULONG itemCount() const { return 0; }
    801     HWND hwnd() const;
     801    HWND hwnd() const
    802802    DRAGINFO *createDragInfo(const QString &targetName, USHORT supportedOps);
    803803
     
    807807private:
    808808    QList<DragWorker*> workers;
    809     // todo check workers!
    810     //QPtrList<DragWorker> workers;
    811809    DRAGINFO *info;
    812810};
     
    944942}
    945943
    946 HWND QPMCoopDragWorker::hwnd() const
    947 {
    948     if (!workers.count()) {
    949         // The drag source doesn't provide any format; will handle it ourselves
    950     } else {
    951         DragWorker *firstWorker = workers.first();
    952         if (firstWorker->isExclusive() && firstWorker->itemCount() == 0) {
    953             // this is a super exclusive worker that will do everything on its own
    954             return firstWorker->hwnd();
    955         }
    956     }
    957 
    958     return QPMObjectWindow::hwnd();
    959 }
    960 
    961944void QPMCoopDragWorker::init()
    962945{
     
    1005988        }
    1006989
    1007         item->hwndItem = hwnd();
     990        item->hwndItem = ;
    1008991        item->ulItemID = 0;
    1009992        item->hstrType = 0;
     
    11401123        ULONG itemCnt = DrgQueryDragitemCount(info);
    11411124        ULONG index = 0;
    1142         for (; index <  itemCnt; ++index)
     1125        for (; index < itemCnt; ++index)
    11431126            if (DrgQueryDragitemPtr(info, index) == xfer->pditem)
    11441127                break;
     
    11721155    }
    11731156
    1174     if (msg == DM_RENDER || msg == DM_ENDCONVERSATION) {
    1175         DEBUG(() << "Drop target sent DM_RENDER or DM_ENDCONVERSATION to the "
    1176                     "drag source window instead of the drag item window!");
    1177         if (msg == DM_RENDER) {
    1178             // free the given DRAGTRANSFER structure to avoud memory leak
    1179             DRAGTRANSFER *xfer = (DRAGTRANSFER *)mp1;
    1180             if (xfer)
    1181                 qt_DrgFreeDragtransfer(xfer);
     1157    if (msg == DM_RENDER) {
     1158        DEBUG(() << "Drop target sent DM_RENDER to the drag source window "
     1159                    "instead of the drag item window, will try to forward!");
     1160        DRAGTRANSFER *xfer = (DRAGTRANSFER *)mp1;
     1161        Q_ASSERT(xfer && xfer->pditem);
     1162        if (xfer && xfer->pditem &&
     1163            xfer->pditem->hwndItem && xfer->pditem->hwndItem != hwnd())
     1164            return WinSendMsg(xfer->pditem->hwndItem, msg, mp1, mp2);
     1165    }
     1166    else
     1167    if (msg == DM_ENDCONVERSATION) {
     1168        DEBUG(() << "Drop target sent DM_CONVERSATION to the drag source window "
     1169                    "instead of the drag item window, will try to forward!");
     1170        if (info) {
     1171            ULONG itemId = LONGFROMMP(mp1);
     1172            // find the item by ID
     1173            ULONG itemCnt = DrgQueryDragitemCount(info);
     1174            for (ULONG index = 0; index < itemCnt; ++index) {
     1175                PDRAGITEM item = DrgQueryDragitemPtr(info, index);
     1176                if (item->ulItemID == itemId &&
     1177                    item->hwndItem && item->hwndItem != hwnd())
     1178                    return WinSendMsg(item->hwndItem, msg, mp1, mp2);
     1179            }
    11821180        }
    11831181    }
Note: See TracChangeset for help on using the changeset viewer.