Windows QPA: Port to new feature system

Replace all checks for DEFINES in windows.pri by proper
configure system checks as they no longer seem to work.

Task-number: QTBUG-61192
Change-Id: I625c9de0812fd376d06eacb065d3a32a499b6b00
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
bb10
Friedemann Kleint 2017-06-02 15:12:02 +02:00
parent e1a0730448
commit df32c9a112
10 changed files with 44 additions and 51 deletions

View File

@ -703,7 +703,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_background(IA2Color *backgr
/**************************************************************\
* IAccessibleEditableText *
**************************************************************/
#ifndef QT_NO_CLIPBOARD
#if QT_CONFIG(clipboard)
/*!
\internal
@ -746,7 +746,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::copyText(long startOffset, long
{
QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible);
#ifndef QT_NO_CLIPBOARD
#if QT_CONFIG(clipboard)
const QString t = textForRange(startOffset, endOffset);
QGuiApplication::clipboard()->setText(t);
return S_OK;
@ -782,7 +782,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::cutText(long startOffset, long
{
QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible);
#ifndef QT_NO_CLIPBOARD
#if QT_CONFIG(clipboard)
const QString t = textForRange(startOffset, endOffset);
if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
editableTextIface->deleteText(startOffset, endOffset);
@ -799,7 +799,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::pasteText(long offset)
{
QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible);
#ifndef QT_NO_CLIPBOARD
#if QT_CONFIG(clipboard)
const QString txt = QGuiApplication::clipboard()->text();
if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
editableTextIface->insertText(offset, txt);

View File

@ -260,12 +260,10 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI
if ((wParamIn & 0xfff0) == SC_CONTEXTHELP)
return QtWindows::WhatsThisEvent;
break;
#if !defined(QT_NO_SESSIONMANAGER)
case WM_QUERYENDSESSION:
return QtWindows::QueryEndSessionApplicationEvent;
case WM_ENDSESSION:
return QtWindows::EndSessionApplicationEvent;
#endif
#if defined(WM_APPCOMMAND)
case WM_APPCOMMAND:
return QtWindows::AppCommandEvent;

View File

@ -52,7 +52,7 @@
#ifndef QT_NO_ACCESSIBILITY
# include "accessible/qwindowsaccessibility.h"
#endif
#if !defined(QT_NO_SESSIONMANAGER)
#if QT_CONFIG(sessionmanager)
# include <private/qsessionmanager_p.h>
# include "qwindowssessionmanager.h"
#endif
@ -121,7 +121,7 @@ static inline bool useRTL_Extensions()
return false;
}
#if !defined(QT_NO_SESSIONMANAGER)
#if QT_CONFIG(sessionmanager)
static inline QWindowsSessionManager *platformSessionManager() {
QGuiApplicationPrivate *guiPrivate = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp));
QSessionManagerPrivate *managerPrivate = static_cast<QSessionManagerPrivate*>(QObjectPrivate::get(guiPrivate->session_manager));
@ -238,7 +238,7 @@ struct QWindowsContextPrivate {
QWindowsMimeConverter m_mimeConverter;
QWindowsScreenManager m_screenManager;
QSharedPointer<QWindowCreationContext> m_creationContext;
#if !defined(QT_NO_TABLETEVENT)
#if QT_CONFIG(tabletevent)
QScopedPointer<QWindowsTabletSupport> m_tabletSupport;
#endif
const HRESULT m_oleInitializeResult;
@ -279,7 +279,7 @@ QWindowsContext::QWindowsContext() :
const QByteArray bv = qgetenv("QT_QPA_VERBOSE");
if (!bv.isEmpty())
QLoggingCategory::setFilterRules(QString::fromLocal8Bit(bv));
#if !defined(QT_NO_TABLETEVENT)
#if QT_CONFIG(tabletevent)
d->m_tabletSupport.reset(QWindowsTabletSupport::create());
qCDebug(lcQpaTablet) << "Tablet support: " << (d->m_tabletSupport.isNull() ? QStringLiteral("None") : d->m_tabletSupport->description());
#endif
@ -287,7 +287,7 @@ QWindowsContext::QWindowsContext() :
QWindowsContext::~QWindowsContext()
{
#if !defined(QT_NO_TABLETEVENT)
#if QT_CONFIG(tabletevent)
d->m_tabletSupport.reset(); // Destroy internal window before unregistering classes.
#endif
unregisterWindowClasses();
@ -335,7 +335,7 @@ bool QWindowsContext::initTouch(unsigned integrationOptions)
void QWindowsContext::setTabletAbsoluteRange(int a)
{
#if !defined(QT_NO_TABLETEVENT)
#if QT_CONFIG(tabletevent)
if (!d->m_tabletSupport.isNull())
d->m_tabletSupport->setAbsoluteRange(a);
#else
@ -700,7 +700,7 @@ QWindowsScreenManager &QWindowsContext::screenManager()
QWindowsTabletSupport *QWindowsContext::tabletSupport() const
{
#if !defined(QT_NO_TABLETEVENT)
#if QT_CONFIG(tabletevent)
return d->m_tabletSupport.data();
#else
return 0;
@ -897,7 +897,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
switch (et) {
case QtWindows::GestureEvent:
#if !defined(QT_NO_SESSIONMANAGER)
#if QT_CONFIG(sessionmanager)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result);
@ -990,7 +990,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::InputMethodKeyEvent:
case QtWindows::InputMethodKeyDownEvent:
case QtWindows::AppCommandEvent:
#if !defined(QT_NO_SESSIONMANAGER)
#if QT_CONFIG(sessionmanager)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result);
#else
return d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result);
@ -1014,14 +1014,14 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return platformWindow->handleWmPaint(hwnd, message, wParam, lParam);
case QtWindows::NonClientMouseEvent:
if (platformWindow->frameStrutEventsEnabled())
#if !defined(QT_NO_SESSIONMANAGER)
#if QT_CONFIG(sessionmanager)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
#endif
break;
case QtWindows::ScrollEvent:
#if !defined(QT_NO_SESSIONMANAGER)
#if QT_CONFIG(sessionmanager)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result);
#else
return d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result);
@ -1035,14 +1035,14 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
window = window->parent();
if (!window)
return false;
#if !defined(QT_NO_SESSIONMANAGER)
#if QT_CONFIG(sessionmanager)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result);
#endif
}
case QtWindows::TouchEvent:
#if !defined(QT_NO_SESSIONMANAGER)
#if QT_CONFIG(sessionmanager)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
@ -1116,7 +1116,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
platformWindow->clearFlag(QWindowsWindow::WithinDpiChanged);
return true;
}
#if !defined(QT_NO_SESSIONMANAGER)
#if QT_CONFIG(sessionmanager)
case QtWindows::QueryEndSessionApplicationEvent: {
QWindowsSessionManager *sessionManager = platformSessionManager();
if (sessionManager->isActive()) { // bogus message from windows

View File

@ -56,7 +56,7 @@
static bool initResources()
{
#if !defined (QT_NO_IMAGEFORMAT_PNG)
#if QT_CONFIG(imageformat_png)
Q_INIT_RESOURCE(cursors);
#endif
return true;
@ -203,7 +203,7 @@ static QSize systemCursorSize(const QPlatformScreen *screen = Q_NULLPTR)
return primaryScreenCursorSize;
}
#if defined (QT_NO_IMAGEFORMAT_PNG)
#if !QT_CONFIG(imageformat_png)
static inline QSize standardCursorSize() { return QSize(32, 32); }

View File

@ -40,7 +40,7 @@
#include "qwindowsdrag.h"
#include "qwindowscontext.h"
#include "qwindowsscreen.h"
#ifndef QT_NO_CLIPBOARD
#if QT_CONFIG(clipboard)
# include "qwindowsclipboard.h"
#endif
#include "qwindowsintegration.h"

View File

@ -50,9 +50,9 @@
#ifndef QT_NO_FREETYPE
# include <QtFontDatabaseSupport/private/qwindowsfontdatabase_ft_p.h>
#endif
#ifndef QT_NO_CLIPBOARD
#if QT_CONFIG(clipboard)
# include "qwindowsclipboard.h"
# ifndef QT_NO_DRAGANDDROP
# if QT_CONFIG(draganddrop)
# include "qwindowsdrag.h"
# endif
#endif
@ -64,7 +64,7 @@
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qwindowsysteminterface.h>
#ifndef QT_NO_SESSIONMANAGER
#if QT_CONFIG(sessionmanager)
# include "qwindowssessionmanager.h"
#endif
#include <QtGui/qtouchdevice.h>
@ -137,9 +137,9 @@ struct QWindowsIntegrationPrivate
unsigned m_options = 0;
QWindowsContext m_context;
QPlatformFontDatabase *m_fontDatabase = nullptr;
#ifndef QT_NO_CLIPBOARD
#if QT_CONFIG(clipboard)
QWindowsClipboard m_clipboard;
# ifndef QT_NO_DRAGANDDROP
# if QT_CONFIG(draganddrop)
QWindowsDrag m_drag;
# endif
#endif
@ -251,7 +251,7 @@ QWindowsIntegration::QWindowsIntegration(const QStringList &paramList) :
d(new QWindowsIntegrationPrivate(paramList))
{
m_instance = this;
#ifndef QT_NO_CLIPBOARD
#if QT_CONFIG(clipboard)
d->m_clipboard.registerViewer();
#endif
d->m_context.screenManager().handleScreenChanges();
@ -547,12 +547,12 @@ QList<int> QWindowsIntegration::possibleKeys(const QKeyEvent *e) const
return d->m_context.possibleKeys(e);
}
#ifndef QT_NO_CLIPBOARD
#if QT_CONFIG(clipboard)
QPlatformClipboard * QWindowsIntegration::clipboard() const
{
return &d->m_clipboard;
}
# ifndef QT_NO_DRAGANDDROP
# if QT_CONFIG(draganddrop)
QPlatformDrag *QWindowsIntegration::drag() const
{
return &d->m_drag;
@ -577,7 +577,7 @@ unsigned QWindowsIntegration::options() const
return d->m_options;
}
#if !defined(QT_NO_SESSIONMANAGER)
#if QT_CONFIG(sessionmanager)
QPlatformSessionManager *QWindowsIntegration::createPlatformSessionManager(const QString &id, const QString &key) const
{
return new QWindowsSessionManager(id, key);

View File

@ -81,9 +81,9 @@ public:
#endif
QAbstractEventDispatcher *createEventDispatcher() const override;
void initialize() override;
#ifndef QT_NO_CLIPBOARD
#if QT_CONFIG(clipboard)
QPlatformClipboard *clipboard() const override;
# ifndef QT_NO_DRAGANDDROP
# if QT_CONFIG(draganddrop)
QPlatformDrag *drag() const override;
# endif
#endif // !QT_NO_CLIPBOARD
@ -109,7 +109,7 @@ public:
void beep() const override;
#if !defined(QT_NO_SESSIONMANAGER)
#if QT_CONFIG(sessionmanager)
QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const override;
#endif

View File

@ -1246,7 +1246,7 @@ bool QBuiltInMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData
r[byteLength+1] = 0;
data = r;
} else {
#ifndef QT_NO_DRAGANDDROP
#if QT_CONFIG(draganddrop)
data = QInternalMimeData::renderDataHelper(outFormats.value(getCf(formatetc)), mimeData);
#endif //QT_NO_DRAGANDDROP
}
@ -1346,7 +1346,7 @@ QLastResortMimes::QLastResortMimes()
bool QLastResortMimes::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const
{
// really check
#ifndef QT_NO_DRAGANDDROP
#if QT_CONFIG(draganddrop)
return formatetc.tymed & TYMED_HGLOBAL
&& (formats.contains(formatetc.cfFormat)
&& QInternalMimeData::hasFormatHelper(formats.value(formatetc.cfFormat), mimeData));
@ -1360,7 +1360,7 @@ bool QLastResortMimes::canConvertFromMime(const FORMATETC &formatetc, const QMim
bool QLastResortMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const
{
#ifndef QT_NO_DRAGANDDROP
#if QT_CONFIG(draganddrop)
return canConvertFromMime(formatetc, mimeData)
&& setData(QInternalMimeData::renderDataHelper(formats.value(getCf(formatetc)), mimeData), pmedium);
#else
@ -1461,7 +1461,7 @@ QString QLastResortMimes::mimeForFormat(const FORMATETC &formatetc) const
const QString clipFormat = QWindowsMimeConverter::clipboardFormatName(getCf(formatetc));
if (!clipFormat.isEmpty()) {
#ifndef QT_NO_DRAGANDDROP
#if QT_CONFIG(draganddrop)
if (QInternalMimeData::canReadData(clipFormat))
format = clipFormat;
else if((formatetc.cfFormat >= 0xC000)){

View File

@ -1154,7 +1154,7 @@ void QWindowsWindow::setDropSiteEnabled(bool dropEnabled)
if (isDropSiteEnabled() == dropEnabled)
return;
qCDebug(lcQpaMime) << __FUNCTION__ << window() << dropEnabled;
#if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_DRAGANDDROP)
#if QT_CONFIG(clipboard) && QT_CONFIG(draganddrop)
if (dropEnabled) {
Q_ASSERT(m_data.hwnd);
m_dropTarget = new QWindowsOleDropTarget(window());

View File

@ -69,33 +69,28 @@ qtConfig(dynamicgl) {
HEADERS += $$PWD/qwindowseglcontext.h
}
!contains( DEFINES, QT_NO_CLIPBOARD ) {
qtConfig(clipboard) {
SOURCES += $$PWD/qwindowsclipboard.cpp
HEADERS += $$PWD/qwindowsclipboard.h
}
# drag and drop on windows only works if a clipboard is available
!contains( DEFINES, QT_NO_DRAGANDDROP ) {
!win32:SOURCES += $$PWD/qwindowsdrag.cpp
!win32:HEADERS += $$PWD/qwindowsdrag.h
win32:!contains( DEFINES, QT_NO_CLIPBOARD ) {
# drag and drop on windows only works if a clipboard is available
qtConfig(draganddrop) {
HEADERS += $$PWD/qwindowsdrag.h
SOURCES += $$PWD/qwindowsdrag.cpp
}
}
!contains( DEFINES, QT_NO_TABLETEVENT ) {
qtConfig(tabletevent) {
INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/wintab
HEADERS += $$PWD/qwindowstabletsupport.h
SOURCES += $$PWD/qwindowstabletsupport.cpp
}
!contains( DEFINES, QT_NO_SESSIONMANAGER ) {
qtConfig(sessionmanager) {
SOURCES += $$PWD/qwindowssessionmanager.cpp
HEADERS += $$PWD/qwindowssessionmanager.h
}
!contains( DEFINES, QT_NO_IMAGEFORMAT_PNG ):RESOURCES += $$PWD/cursors.qrc
qtConfig(imageformat_png):RESOURCES += $$PWD/cursors.qrc
RESOURCES += $$PWD/openglblacklists.qrc