diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 4473b6b8a4..da4519199f 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -59,8 +59,10 @@ #include "qwindowsguieventdispatcher.h" #ifndef QT_NO_CLIPBOARD # include "qwindowsclipboard.h" +# ifndef QT_NO_DRAGANDDROP +# include "qwindowsdrag.h" +# endif #endif -#include "qwindowsdrag.h" #include "qwindowsinputcontext.h" #include "qwindowskeymapper.h" # ifndef QT_NO_ACCESSIBILITY @@ -266,8 +268,10 @@ struct QWindowsIntegrationPrivate QWindowsNativeInterface m_nativeInterface; #ifndef QT_NO_CLIPBOARD QWindowsClipboard m_clipboard; -#endif +# ifndef QT_NO_DRAGANDDROP QWindowsDrag m_drag; +# endif +#endif QWindowsGuiEventDispatcher *m_eventDispatcher; #if defined(QT_OPENGL_ES_2) QEGLStaticContextPtr m_staticEGLContext; @@ -529,12 +533,13 @@ QPlatformClipboard * QWindowsIntegration::clipboard() const { return &d->m_clipboard; } -#endif // !QT_NO_CLIPBOARD - +# ifndef QT_NO_DRAGANDDROP QPlatformDrag *QWindowsIntegration::drag() const { return &d->m_drag; } +# endif // !QT_NO_DRAGANDDROP +#endif // !QT_NO_CLIPBOARD QPlatformInputContext * QWindowsIntegration::inputContext() const { diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index 2593c3b946..24dc01f0bd 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -75,8 +75,10 @@ public: virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const; #ifndef QT_NO_CLIPBOARD virtual QPlatformClipboard *clipboard() const; -#endif +# ifndef QT_NO_DRAGANDDROP virtual QPlatformDrag *drag() const; +# endif +#endif !QT_NO_CLIPBOARD virtual QPlatformInputContext *inputContext() const; #ifndef QT_NO_ACCESSIBILITY virtual QPlatformAccessibility *accessibility() const; diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 3530f0af68..2a26e092eb 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -815,21 +815,29 @@ void QWindowsWindow::destroyWindow() void QWindowsWindow::registerDropSite() { +#ifndef QT_NO_CLIPBOARD +# ifndef QT_NO_DRAGANDDROP if (m_data.hwnd && !m_dropTarget) { m_dropTarget = new QWindowsOleDropTarget(window()); RegisterDragDrop(m_data.hwnd, m_dropTarget); CoLockObjectExternal(m_dropTarget, true, true); } +# endif // !QT_NO_DRAGANDDROP +#endif // !QT_NO_CLIPBOARD } void QWindowsWindow::unregisterDropSite() { +#ifndef QT_NO_CLIPBOARD +# ifndef QT_NO_DRAGANDDROP if (m_data.hwnd && m_dropTarget) { m_dropTarget->Release(); CoLockObjectExternal(m_dropTarget, false, true); RevokeDragDrop(m_data.hwnd); m_dropTarget = 0; } +# endif // !QT_NO_DRAGANDDROP +#endif // !QT_NO_CLIPBOARD } // Returns topmost QWindowsWindow ancestor even if there are embedded windows in the chain. diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 7f73465135..ff162e2d41 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -45,7 +45,6 @@ SOURCES += \ qwindowsguieventdispatcher.cpp \ qwindowsole.cpp \ qwindowsmime.cpp \ - qwindowsdrag.cpp \ qwindowsinternalmimedata.cpp \ qwindowscursor.cpp \ qwindowsinputcontext.cpp \ @@ -69,7 +68,6 @@ HEADERS += \ qtwindows_additional.h \ qwindowsole.h \ qwindowsmime.h \ - qwindowsdrag.h \ qwindowsinternalmimedata.h \ qwindowscursor.h \ array.h \ @@ -94,6 +92,16 @@ contains(QT_CONFIG, opengles2) { HEADERS += qwindowsclipboard.h } +# drag and drop on windows only works if a clipboard is available +!contains( DEFINES, QT_NO_DRAGANDDROP ) { + !win32:SOURCES += qwindowsdrag.cpp + !win32:HEADERS += qwindowsdrag.h + win32:!contains( DEFINES, QT_NO_CLIPBOARD ) { + HEADERS += qwindowsdrag.h + SOURCES += qwindowsdrag.cpp + } +} + # Enable access to HB_Face in harfbuzz includes included by qfontengine_p.h. DEFINES *= QT_COMPILES_IN_HARFBUZZ