Index: /trunk/src/gui/kernel/qdnd_pm.cpp
===================================================================
--- /trunk/src/gui/kernel/qdnd_pm.cpp	(revision 579)
+++ /trunk/src/gui/kernel/qdnd_pm.cpp	(revision 580)
@@ -58,4 +58,5 @@
 
 #include "qt_os2.h"
+#include "private/qpmobjectwindow_pm_p.h"
 
 //#define QDND_DEBUG // in pair with qmime_pm.cpp
Index: /trunk/src/gui/kernel/qmime.h
===================================================================
--- /trunk/src/gui/kernel/qmime.h	(revision 579)
+++ /trunk/src/gui/kernel/qmime.h	(revision 580)
@@ -115,10 +115,12 @@
 */
 
-QT_END_NAMESPACE
-#include "qt_os2.h"
-#if !defined(QT_NO_DRAGANDDROP)
-# include "private/qpmobjectwindow_pm_p.h"
-#endif
-QT_BEGIN_NAMESPACE
+QT_BEGIN_INCLUDE_NAMESPACE
+
+#include "qwindowdefs_pm.h"
+typedef LHANDLE HSTR;
+typedef struct _DRAGINFO DRAGINFO;
+typedef struct _DRAGITEM DRAGITEM;
+
+QT_END_INCLUDE_NAMESPACE
 
 class QPMDragData;
@@ -162,5 +164,5 @@
     };
 
-    class DefaultDragWorker : public DragWorker, public QPMObjectWindow
+    class DefaultDragWorker : public DragWorker
     {
     private:
@@ -173,12 +175,9 @@
         bool isExclusive() const;
         ULONG itemCount() const;
-        HWND hwnd() const { return QPMObjectWindow::hwnd(); }
+        HWND hwnd() const;
         QByteArray composeFormatString();
         bool prepare(const char *drm, const char *drf, DRAGITEM *item,
                      ULONG itemIndex);
         void defaultFileType(QString &type, QString &ext);
-
-        // QPMObjectWindow interface
-        MRESULT message(ULONG msg, MPARAM mp1, MPARAM mp2);
 
         class Provider
@@ -224,5 +223,5 @@
     };
 
-    class DefaultDropWorker : public DropWorker, public QPMObjectWindow
+    class DefaultDropWorker : public DropWorker
     {
     private:
@@ -238,7 +237,4 @@
         QVariant retrieveData(const QString &mimeType,
                               QVariant::Type preferredType) const;
-
-        // QPMObjectWindow interface
-        MRESULT message(ULONG msg, MPARAM mp1, MPARAM mp2);
 
         class Provider
Index: /trunk/src/gui/kernel/qmime_pm.cpp
===================================================================
--- /trunk/src/gui/kernel/qmime_pm.cpp	(revision 579)
+++ /trunk/src/gui/kernel/qmime_pm.cpp	(revision 580)
@@ -60,4 +60,7 @@
 #include "qdir.h"
 
+#include "qt_os2.h"
+#include "private/qpmobjectwindow_pm_p.h"
+
 //#define QDND_DEBUG // in pair with qdnd_pm.cpp
 
@@ -215,7 +218,7 @@
 //------------------------------------------------------------------------------
 
-struct QPMMime::DefaultDragWorker::Data
-{
-    Data(bool excl) : exclusive(excl) {}
+struct QPMMime::DefaultDragWorker::Data : public QPMObjectWindow
+{
+    Data(DefaultDragWorker *worker, bool excl) : q(worker), exclusive(excl) {}
 
     struct Request
@@ -245,4 +248,7 @@
     void cleanupRequests();
 
+    // QPMObjectWindow interface
+    MRESULT message(ULONG msg, MPARAM mp1, MPARAM mp2);
+
     struct DrfProvider
     {
@@ -263,4 +269,6 @@
     }
 
+    DefaultDragWorker *q;
+
     const bool exclusive : 1;
     DrfProviderList providers;
@@ -283,5 +291,5 @@
 
 QPMMime::DefaultDragWorker::DefaultDragWorker(bool exclusive)
-    : d(new Data(exclusive))
+    : d(new Data(this, exclusive))
 {
     d->itemCnt = 0;
@@ -341,4 +349,9 @@
 {
     return d->itemCnt;
+}
+
+ULONG QPMMime::DefaultDragWorker::hwnd() const
+{
+    return d->hwnd();
 }
 
@@ -433,5 +446,5 @@
 }
 
-MRESULT QPMMime::DefaultDragWorker::message(ULONG msg, MPARAM mp1, MPARAM mp2)
+MRESULT QPMMime::DefaultDragWorker::Data::message(ULONG msg, MPARAM mp1, MPARAM mp2)
 {
     if (msg == DM_RENDER) {
@@ -439,7 +452,7 @@
 
         // sanity checks
-        Q_ASSERT(d->isInitialized());
+        Q_ASSERT(isInitialized());
         Q_ASSERT(xfer);
-        if (!d->isInitialized() || !xfer)
+        if (!isInitialized() || !xfer)
             return (MRESULT)FALSE;
 
@@ -448,5 +461,5 @@
             return (MRESULT)FALSE;
 
-        Data::Request *req = d->requests.value(xfer->pditem->ulItemID);
+        Data::Request *req = requests.value(xfer->pditem->ulItemID);
 
         // check that this item has been prepared (should always be the case
@@ -491,6 +504,6 @@
     if (msg == WM_USER) {
         // sanity checks
-        Q_ASSERT(d->isInitialized());
-        if (!d->isInitialized())
+        Q_ASSERT(isInitialized());
+        if (!isInitialized())
             return (MRESULT)FALSE;
 
@@ -498,5 +511,5 @@
 
         // sanity checks
-        Data::Request *req = d->requests.value(itemId);
+        Data::Request *req = requests.value(itemId);
         Q_ASSERT(req); // prepared
         Q_ASSERT(req->xfer != NULL); // DM_RENDER requested
@@ -507,6 +520,6 @@
             return (MRESULT)FALSE;
 
-        Q_ASSERT(source() && req->provider && req->index < d->itemCnt);
-        if (!source() || !req->provider || req->index >= d->itemCnt)
+        Q_ASSERT(q->source() && req->provider && req->index < itemCnt);
+        if (!q->source() || !req->provider || req->index >= itemCnt)
             return (MRESULT)FALSE;
 
@@ -516,13 +529,12 @@
                  << "drf" << req->drf.data());
 
-        bool renderOk = false;
-
-        QByteArray allData = source()->data(req->provider->format(req->drf));
+        bool ok = false;
+
+        QByteArray allData = q->source()->data(req->provider->format(req->drf));
         QByteArray itemData;
 
-        renderOk = req->provider->provide(req->drf, allData,
-                                          req->index, itemData);
-
-        if (renderOk) {
+        ok = req->provider->provide(req->drf, allData, req->index, itemData);
+
+        if (ok) {
             enum DRM { OS2File, SharedMem } drmType;
             if (qstrcmp(req->drm, "DRM_SHAREDMEM") == 0) drmType = SharedMem;
@@ -532,14 +544,14 @@
                 QByteArray renderToName = queryHSTR(req->xfer->hstrRenderToName);
                 Q_ASSERT(!renderToName.isEmpty());
-                renderOk = !renderToName.isEmpty();
-                if (renderOk) {
+                ok = !renderToName.isEmpty();
+                if (ok) {
                     DEBUG(() << "DefaultDragWorker: Will write to" << renderToName);
                     QFile file(QFile::decodeName(renderToName));
-                    renderOk = file.open(QIODevice::WriteOnly);
-                    if (renderOk) {
+                    ok = file.open(QIODevice::WriteOnly);
+                    if (ok) {
                         qint64 written = file.write(itemData, itemData.size());
-                        renderOk = written == itemData.size();
+                        ok = written == itemData.size();
                         file.close();
-                        if (renderOk && req->xfer->pditem->hstrType) {
+                        if (ok && req->xfer->pditem->hstrType) {
                             // since WPS ignores hstrType, write it manually
                             // to the .TYPE EA of the created file
@@ -553,7 +565,6 @@
                 TID tid;
                 bool isSameProcess = false;
-                renderOk = WinQueryWindowProcess(req->xfer->hwndClient,
-                                                 &pid, &tid);
-                if (renderOk) {
+                ok = WinQueryWindowProcess(req->xfer->hwndClient, &pid, &tid);
+                if (ok) {
                     PPIB ppib = NULL;
                     DosGetInfoBlocks(NULL, &ppib);
@@ -568,10 +579,10 @@
                                                   OBJ_GIVEABLE | PAG_COMMIT |
                                                   PAG_READ | PAG_WRITE);
-                    renderOk = rc == 0;
-                    if (renderOk && !isSameProcess) {
+                    ok = rc == 0;
+                    if (ok && !isSameProcess) {
                         rc = DosGiveSharedMem(ptr, pid, PAG_READ);
-                        renderOk = rc == 0;
+                        ok = rc == 0;
                     }
-                    if (renderOk) {
+                    if (ok) {
                         *(ULONG *) ptr = itemData.size();
                         memcpy(ptr + sizeof (ULONG), itemData.data(),
@@ -598,11 +609,11 @@
         req->rendered = true;
         // cumulative render result
-        d->renderOk &= renderOk;
-
-        DEBUG(() << "DefaultDragWorker: renderOk" << renderOk
-                 << "overall.renderOk" << d->renderOk);
+        renderOk &= ok;
+
+        DEBUG(() << "DefaultDragWorker: ok" << ok
+                 << "overall.renderOk" << renderOk);
 
         // note that we don't allow the target to retry
-        USHORT reply = renderOk ? DMFL_RENDEROK : DMFL_RENDERFAIL;
+        USHORT reply = ok ? DMFL_RENDEROK : DMFL_RENDERFAIL;
         DrgPostTransferMsg(req->xfer->hwndClient, DM_RENDERCOMPLETE,
                            req->xfer, reply, 0, false);
@@ -633,5 +644,5 @@
 
         // sanity check (don't assert, see above)
-        Data::Request *req = d->requests.value(itemId);
+        Data::Request *req = requests.value(itemId);
         Q_ASSERT(req);
         if (!req)
@@ -641,21 +652,21 @@
                  << "(id " << itemId << ") provider" << req->provider
                  << "drm" << req->drm << "drf" << req->drf
-                 << "rendered" << req->rendered << "outdated" << !d->isInitialized());
+                 << "rendered" << req->rendered << "outdated" << !isInitialized());
 
         // proceed further only if it's not an outdated request
         // from the previous DND session
-        if (d->isInitialized()) {
+        if (isInitialized()) {
             if (!req->rendered) {
                 // we treat cancelling the render request (for any reason)
                 // as a failure
-                d->renderOk = false;
+                renderOk = false;
             } else {
                 // the overall success is true only if target says Okay
-                d->renderOk &= flags == DMFL_TARGETSUCCESSFUL;
+                renderOk &= flags == DMFL_TARGETSUCCESSFUL;
             }
         }
 
         // delete the request
-        delete d->requests.take(itemId);
+        delete requests.take(itemId);
 
         return (MRESULT)FALSE;
@@ -699,5 +710,5 @@
 //------------------------------------------------------------------------------
 
-struct QPMMime::DefaultDropWorker::Data
+struct QPMMime::DefaultDropWorker::Data : public QPMObjectWindow
 {
     struct MimeProvider
@@ -709,4 +720,9 @@
     };
 
+    Data(DefaultDropWorker *worker) : q(worker) {}
+
+    // QPMObjectWindow interface
+    MRESULT message(ULONG msg, MPARAM mp1, MPARAM mp2);
+
     typedef QList<MimeProvider> MimeProviderList;
 
@@ -720,4 +736,6 @@
     }
 
+    DefaultDropWorker *q;
+
     bool exclusive : 1;
     MimeProviderList providers;
@@ -730,5 +748,5 @@
 };
 
-QPMMime::DefaultDropWorker::DefaultDropWorker() : d(new Data())
+QPMMime::DefaultDropWorker::DefaultDropWorker() : d(new Data(this))
 {
     d->exclusive = false;
@@ -917,5 +935,5 @@
 
             xfer->cb = sizeof(DRAGTRANSFER);
-            xfer->hwndClient = hwnd();
+            xfer->hwndClient = d->hwnd();
             xfer->ulTargetInfo = (ULONG) info();
             xfer->usOperation = info()->usOperation;
@@ -1077,18 +1095,18 @@
 }
 
-MRESULT QPMMime::DefaultDropWorker::message(ULONG msg, MPARAM mp1, MPARAM mp2)
+MRESULT QPMMime::DefaultDropWorker::Data::message(ULONG msg, MPARAM mp1, MPARAM mp2)
 {
     switch (msg) {
         case DM_RENDERCOMPLETE: {
             // sanity check
-            Q_ASSERT(info());
-            if (!info())
+            Q_ASSERT(q->info());
+            if (!q->info())
                 return (MRESULT)FALSE;
 
             DEBUG(("DefaultDropWorker: Got DM_RENDERCOMPLETE"));
-            d->got_DM_RENDERCOMPLETE = true;
-            d->flags_DM_RENDERCOMPLETE = SHORT1FROMMP(mp2);
-
-            if (d->sending_DM_RENDER)
+            got_DM_RENDERCOMPLETE = true;
+            flags_DM_RENDERCOMPLETE = SHORT1FROMMP(mp2);
+
+            if (sending_DM_RENDER)
             {
 #ifndef QT_NO_DEBUG
@@ -1103,6 +1121,6 @@
 
             // stop synchronous waiting for DM_RENDERCOMPLETE
-            if (d->eventLoop.isRunning())
-                d->eventLoop.exit();
+            if (eventLoop.isRunning())
+                eventLoop.exit();
             return (MRESULT)FALSE;
         }
Index: /trunk/src/gui/kernel/qwindowdefs_pm.h
===================================================================
--- /trunk/src/gui/kernel/qwindowdefs_pm.h	(revision 579)
+++ /trunk/src/gui/kernel/qwindowdefs_pm.h	(revision 580)
@@ -56,5 +56,7 @@
 QT_END_NAMESPACE
 
-// typedefs to avoid inclusion of qt_os2.h in public headers
+// common typedefs from os2.h to avoid inclusion of qt_os2.h in public headers
+typedef unsigned long ULONG;
+typedef unsigned short USHORT;
 typedef unsigned long LHANDLE;
 typedef LHANDLE HWND;
