diff options
author | Robert Griebl <robert.griebl@qt.io> | 2023-12-05 16:32:52 +0100 |
---|---|---|
committer | Robert Griebl <robert.griebl@qt.io> | 2023-12-06 13:55:04 +0100 |
commit | 449f519c53ca00a806de4cfb53725fc81605be13 (patch) | |
tree | 4921ad5f7213422fe4b80b7023cd3c4390e3adcb /src/window-lib | |
parent | 14ac678dfd2eb23b111a38db56685798e2f04fd4 (diff) |
Replace AM_.. defines with checks for Qt features where possible
Also got rid of hard to read double negated checks (!disabled)
Change-Id: I93b0665ccdf60e30a473692167fde5c6d719dfa9
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
Diffstat (limited to 'src/window-lib')
-rw-r--r-- | src/window-lib/systemframetimerimpl.cpp | 6 | ||||
-rw-r--r-- | src/window-lib/systemframetimerimpl.h | 2 | ||||
-rw-r--r-- | src/window-lib/waylandcompositor.h | 4 | ||||
-rw-r--r-- | src/window-lib/waylandwindow.cpp | 4 | ||||
-rw-r--r-- | src/window-lib/waylandwindow.h | 4 | ||||
-rw-r--r-- | src/window-lib/windowitem.cpp | 20 | ||||
-rw-r--r-- | src/window-lib/windowitem.h | 8 | ||||
-rw-r--r-- | src/window-lib/windowmanager.cpp | 22 | ||||
-rw-r--r-- | src/window-lib/windowmanager.h | 4 | ||||
-rw-r--r-- | src/window-lib/windowmanager_p.h | 2 |
10 files changed, 38 insertions, 38 deletions
diff --git a/src/window-lib/systemframetimerimpl.cpp b/src/window-lib/systemframetimerimpl.cpp index a042c678..8ab8c559 100644 --- a/src/window-lib/systemframetimerimpl.cpp +++ b/src/window-lib/systemframetimerimpl.cpp @@ -8,7 +8,7 @@ #include "applicationmanagerwindow.h" #include "frametimer.h" #include "inprocesswindow.h" -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) # include "waylandwindow.h" #endif @@ -26,7 +26,7 @@ bool SystemFrameTimerImpl::connectToSystemWindow(QObject *window) " FrameTimer won't operate with the given window."; return true; } -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) if (auto *wlwin = qobject_cast<WaylandWindow *>(window)) { auto connectToWaylandSurface = [this](WaylandWindow *waylandWindow) { if (m_redrawConnection) { @@ -54,7 +54,7 @@ bool SystemFrameTimerImpl::connectToSystemWindow(QObject *window) void SystemFrameTimerImpl::disconnectFromSystemWindow(QObject *window) { Q_UNUSED(window) -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) if (m_redrawConnection) { QObject::disconnect(m_redrawConnection); m_redrawConnection = { }; diff --git a/src/window-lib/systemframetimerimpl.h b/src/window-lib/systemframetimerimpl.h index a4c36041..4cfe507b 100644 --- a/src/window-lib/systemframetimerimpl.h +++ b/src/window-lib/systemframetimerimpl.h @@ -23,7 +23,7 @@ public: void disconnectFromSystemWindow(QObject *window) override; private: -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) QMetaObject::Connection m_surfaceChangeConnection; QMetaObject::Connection m_redrawConnection; #endif diff --git a/src/window-lib/waylandcompositor.h b/src/window-lib/waylandcompositor.h index 68f0db80..68c0b73c 100644 --- a/src/window-lib/waylandcompositor.h +++ b/src/window-lib/waylandcompositor.h @@ -8,7 +8,7 @@ #include <QtAppManCommon/global.h> -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) #include <QtWaylandCompositor/QWaylandQuickCompositor> @@ -122,4 +122,4 @@ protected: QT_END_NAMESPACE_AM -#endif // AM_MULTIPROCESS +#endif // QT_CONFIG(am_multi_process) diff --git a/src/window-lib/waylandwindow.cpp b/src/window-lib/waylandwindow.cpp index e6fc4285..af488f81 100644 --- a/src/window-lib/waylandwindow.cpp +++ b/src/window-lib/waylandwindow.cpp @@ -5,7 +5,7 @@ #include "global.h" -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) #include "logging.h" #include "applicationmanager.h" #include "application.h" @@ -198,6 +198,6 @@ void WaylandWindow::close() QT_END_NAMESPACE_AM -#endif // AM_MULTI_PROCESS +#endif // QT_CONFIG(am_multi_process) #include "moc_waylandwindow.cpp" diff --git a/src/window-lib/waylandwindow.h b/src/window-lib/waylandwindow.h index e0834aed..c8f69b83 100644 --- a/src/window-lib/waylandwindow.h +++ b/src/window-lib/waylandwindow.h @@ -7,7 +7,7 @@ #include <QtAppManWindow/window.h> -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) #include <QtWaylandCompositor/QWaylandQuickSurface> #include <QtWaylandCompositor/QWaylandXdgShell> @@ -71,4 +71,4 @@ private: QT_END_NAMESPACE_AM -#endif // AM_MULTI_PROCESS +#endif // QT_CONFIG(am_multi_process) diff --git a/src/window-lib/windowitem.cpp b/src/window-lib/windowitem.cpp index 932016f3..d1fef2db 100644 --- a/src/window-lib/windowitem.cpp +++ b/src/window-lib/windowitem.cpp @@ -6,11 +6,11 @@ #include "windowitem.h" #include "window.h" -#if defined(AM_MULTI_PROCESS) -#include <QWaylandQuickItem> -#include "waylandcompositor.h" -#include "waylandwindow.h" -#endif // AM_MULTI_PROCESS +#if QT_CONFIG(am_multi_process) +# include <QWaylandQuickItem> +# include "waylandcompositor.h" +# include "waylandwindow.h" +#endif #include "applicationmanager.h" #include "inprocesswindow.h" @@ -172,7 +172,7 @@ Window *WindowItem::window() const void WindowItem::createImpl(bool inProcess) { -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) if (inProcess) { if (m_impl && !m_impl->isInProcess()) { delete m_impl; @@ -188,11 +188,11 @@ void WindowItem::createImpl(bool inProcess) if (!m_impl) m_impl = new WaylandImpl(this); } -#else // AM_MULTI_PROCESS +#else Q_ASSERT(inProcess); if (!m_impl) m_impl = new InProcessImpl(this); -#endif // AM_MULTI_PROCESS +#endif } void WindowItem::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) @@ -407,7 +407,7 @@ QQuickItem *WindowItem::InProcessImpl::backingItem() // WindowItem::WaylandImpl /////////////////////////////////////////////////////////////////////////////////////////////////// -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) // Wayland has no concept of clients ignoring/accepting key events, but even if it did, we'd get // back the response far too late to be useful. In order to give the sys-ui a chance to handle @@ -525,7 +525,7 @@ void WindowItem::WaylandImpl::setupSecondaryView() m_waylandItem->setTouchEventsEnabled(false); } -#endif // AM_MULTI_PROCESS +#endif // QT_CONFIG(am_multi_process) QT_END_NAMESPACE_AM diff --git a/src/window-lib/windowitem.h b/src/window-lib/windowitem.h index e42c1044..0f994597 100644 --- a/src/window-lib/windowitem.h +++ b/src/window-lib/windowitem.h @@ -17,10 +17,10 @@ QT_BEGIN_NAMESPACE_AM class Window; class InProcessWindow; -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) class WaylandWindow; class WaylandQuickIgnoreKeyItem; -#endif // AM_MULTI_PROCESS +#endif class WindowItem : public QQuickFocusScope @@ -114,7 +114,7 @@ private: QQuickItem *m_shaderEffectSource{nullptr}; }; -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) struct WaylandImpl : public Impl { WaylandImpl(WindowItem *windowItem) : Impl(windowItem) {} ~WaylandImpl(); @@ -134,7 +134,7 @@ private: WaylandWindow *m_waylandWindow{nullptr}; WaylandQuickIgnoreKeyItem *m_waylandItem{nullptr}; }; -#endif // AM_MULTI_PROCESS +#endif // QT_CONFIG(am_multi_process) Impl *m_impl{nullptr}; bool m_objectFollowsItemSize{true}; diff --git a/src/window-lib/windowmanager.cpp b/src/window-lib/windowmanager.cpp index 1023089e..57a6888a 100644 --- a/src/window-lib/windowmanager.cpp +++ b/src/window-lib/windowmanager.cpp @@ -17,7 +17,7 @@ #include <QLocalServer> #include "global.h" -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) # include "waylandcompositor.h" # include <private/qwaylandcompositor_p.h> #endif @@ -351,7 +351,7 @@ WindowManager::WindowManager(QQmlEngine *qmlEngine, const QString &waylandSocket : QAbstractListModel() , d(new WindowManagerPrivate()) { -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) d->waylandSocketName = waylandSocketName; #else Q_UNUSED(waylandSocketName) @@ -374,7 +374,7 @@ WindowManager::~WindowManager() { qApp->removeEventFilter(this); -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) delete d->waylandCompositor; #endif delete d; @@ -383,7 +383,7 @@ WindowManager::~WindowManager() void WindowManager::enableWatchdog(bool enable) { -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) WaylandWindow::m_watchdogEnabled = enable; #else Q_UNUSED(enable); @@ -392,7 +392,7 @@ void WindowManager::enableWatchdog(bool enable) bool WindowManager::addWaylandSocket(QLocalServer *waylandSocket) { -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) if (d->waylandCompositor) { qCWarning(LogGraphics) << "Cannot add extra Wayland sockets after the compositor has been created" " (tried to add:" << waylandSocket->fullServerName() << ")."; @@ -566,7 +566,7 @@ int WindowManager::indexOfWindow(Window *window) const */ QObject *WindowManager::addExtension(QQmlComponent *component) const { -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) if (!component || ApplicationManager::instance()->isSingleProcess()) return nullptr; @@ -664,7 +664,7 @@ void WindowManager::registerCompositorView(QQuickWindow *view) updateViewSlowMode(view); -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) if (!ApplicationManager::instance()->isSingleProcess()) { if (!d->waylandCompositor) { // this will trigger the creation of extra sockets in main.cpp @@ -783,7 +783,7 @@ void WindowManager::setupWindow(Window *window) } -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) void WindowManager::waylandSurfaceCreated(QWaylandSurface *surface) { @@ -835,7 +835,7 @@ void WindowManager::waylandSurfaceMapped(WindowSurface *surface) } } -#endif // defined(AM_MULTI_PROCESS) +#endif // QT_CONFIG(am_multi_process) /*! \qmlsignal WindowManager::windowPropertyChanged(WindowObject window, string name, var value) @@ -1041,7 +1041,7 @@ QList<QQuickWindow *> WindowManager::compositorViews() const return d->views; } -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) int WindowManagerPrivate::findWindowByWaylandSurface(QWaylandSurface *waylandSurface) const { @@ -1068,7 +1068,7 @@ QString WindowManagerPrivate::applicationId(Application *app, WindowSurface *win return qSL("<unknown client>"); } -#endif // defined(AM_MULTI_PROCESS) +#endif // QT_CONFIG(am_multi_process) bool WindowManager::eventFilter(QObject *watched, QEvent *event) { diff --git a/src/window-lib/windowmanager.h b/src/window-lib/windowmanager.h index 6ddb722f..eb93699c 100644 --- a/src/window-lib/windowmanager.h +++ b/src/window-lib/windowmanager.h @@ -10,7 +10,7 @@ #include <QtAppManCommon/global.h> -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) QT_FORWARD_DECLARE_CLASS(QWaylandSurface) #endif @@ -112,7 +112,7 @@ public: // evil hook to support in-process runtimes void setupInProcessRuntime(QtAM::AbstractRuntime *runtime); -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) private slots: void waylandSurfaceCreated(QWaylandSurface *surface); void waylandSurfaceMapped(QtAM::WindowSurface *surface); diff --git a/src/window-lib/windowmanager_p.h b/src/window-lib/windowmanager_p.h index 473ab07a..517c5b52 100644 --- a/src/window-lib/windowmanager_p.h +++ b/src/window-lib/windowmanager_p.h @@ -20,7 +20,7 @@ class WindowManagerPrivate public: int findWindowBySurfaceItem(QQuickItem *quickItem) const; -#if defined(AM_MULTI_PROCESS) +#if QT_CONFIG(am_multi_process) int findWindowByWaylandSurface(QWaylandSurface *waylandSurface) const; WaylandCompositor *waylandCompositor = nullptr; |