diff options
Diffstat (limited to 'src/plugins/platforms/xcb')
18 files changed, 44 insertions, 45 deletions
diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationplugin.h b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationplugin.h index d5a0af97b0..b18248570f 100644 --- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationplugin.h +++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationplugin.h @@ -54,7 +54,7 @@ class Q_XCB_EXPORT QXcbGlIntegrationPlugin : public QObject { Q_OBJECT public: - explicit QXcbGlIntegrationPlugin(QObject *parent = 0) + explicit QXcbGlIntegrationPlugin(QObject *parent = nullptr) : QObject(parent) { } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp index b751aaf8a3..34895caaa2 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp @@ -164,7 +164,11 @@ bool QXcbGlxIntegration::handleXcbEvent(xcb_generic_event_t *event, uint respons XUnlockDisplay(xdisplay); locked = false; auto eventType = m_connection->nativeInterface()->nativeEventType(); +# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + qintptr result = 0; +# else long result = 0; +# endif handled = dispatcher->filterNativeEvent(eventType, &ev, &result); } #endif diff --git a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp index 8d958aae94..82b6d60bcd 100644 --- a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp +++ b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp @@ -455,7 +455,7 @@ static const uchar base_dither_matrix[DITHER_SIZE][DITHER_SIZE] = { static QPixmap qt_patternForAlpha(uchar alpha, int screen) { QPixmap pm; - QString key = QLatin1Literal("$qt-alpha-brush$") + QString key = QLatin1String("$qt-alpha-brush$") % HexString<uchar>(alpha) % HexString<int>(screen); diff --git a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp index b1ce39f363..f86bedbdcd 100644 --- a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp +++ b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp @@ -2017,7 +2017,7 @@ QImage QX11PlatformPixmap::toImage(const QXImageWrapper &xiWrapper, const QRect } } else if (xi->bits_per_pixel == d) { // compatible depth char *xidata = xi->data; // copy each scanline - int bpl = qMin(image.bytesPerLine(),xi->bytes_per_line); + int bpl = qMin(int(image.bytesPerLine()),xi->bytes_per_line); for (int y=0; y<xi->height; y++) { memcpy(image.scanLine(y), xidata, bpl); xidata += xi->bytes_per_line; diff --git a/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h b/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h index a13a8f0483..1f7e7cf49b 100644 --- a/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h +++ b/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h @@ -190,7 +190,7 @@ struct QX11InfoData { }; template <class T> -Q_DECL_RELAXED_CONSTEXPR inline int lowest_bit(T v) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline int lowest_bit(T v) noexcept { int result = qCountTrailingZeroBits(v); return ((result >> 3) == sizeof(T)) ? -1 : result; diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index f98b2dfe3a..cac6345b66 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -440,7 +440,11 @@ const char *xcb_protocol_request_codes[] = void QXcbConnection::handleXcbError(xcb_generic_error_t *error) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + qintptr result = 0; +#else long result = 0; +#endif QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance(); if (dispatcher && dispatcher->filterNativeEvent(m_nativeInterface->nativeEventType(), error, &result)) return; @@ -537,7 +541,11 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) if (Q_UNLIKELY(lcQpaEvents().isDebugEnabled())) printXcbEvent(lcQpaEvents(), "Event", event); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + qintptr result = 0; // Used only by MS Windows +#else long result = 0; // Used only by MS Windows +#endif if (QAbstractEventDispatcher *dispatcher = QAbstractEventDispatcher::instance()) { if (dispatcher->filterNativeEvent(m_nativeInterface->nativeEventType(), event, &result)) return; diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index bbfa252881..7cf25d41a6 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -108,7 +108,7 @@ public: virtual void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource = Qt::MouseEventNotSynthesized) {} virtual void handleXIEnterLeave(xcb_ge_event_t *) {} #endif - virtual QXcbWindow *toWindow() { return 0; } + virtual QXcbWindow *toWindow() { return nullptr; } }; typedef QHash<xcb_window_t, QXcbWindowEventListener *> WindowMapper; @@ -366,7 +366,7 @@ private: WindowMapper m_mapper; - Qt::MouseButtons m_buttonState = 0; + Qt::MouseButtons m_buttonState = nullptr; Qt::MouseButton m_button = Qt::NoButton; QXcbWindow *m_focusWindow = nullptr; diff --git a/src/plugins/platforms/xcb/qxcbconnection_basic.h b/src/plugins/platforms/xcb/qxcbconnection_basic.h index b979129cba..1bd4310562 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_basic.h +++ b/src/plugins/platforms/xcb/qxcbconnection_basic.h @@ -163,7 +163,7 @@ private: #define Q_XCB_REPLY_CONNECTION_ARG(connection, ...) connection struct QStdFreeDeleter { - void operator()(void *p) const Q_DECL_NOTHROW { return std::free(p); } + void operator()(void *p) const noexcept { return std::free(p); } }; #define Q_XCB_REPLY(call, ...) \ diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index bc09fe2f91..4639185416 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -997,8 +997,8 @@ void QXcbConnection::xi2HandleScrollEvent(void *event, ScrollingDevice &scrollin QPoint global(fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y)); Qt::KeyboardModifiers modifiers = keyboard()->translateModifiers(xiDeviceEvent->mods.effective); if (modifiers & Qt::AltModifier) { - std::swap(angleDelta.rx(), angleDelta.ry()); - std::swap(rawDelta.rx(), rawDelta.ry()); + angleDelta = angleDelta.transposed(); + rawDelta = rawDelta.transposed(); } qCDebug(lcQpaXInputEvents) << "scroll wheel @ window pos" << local << "delta px" << rawDelta << "angle" << angleDelta; QWindowSystemInterface::handleWheelEvent(platformWindow->window(), xiDeviceEvent->time, local, global, rawDelta, angleDelta, modifiers); @@ -1024,7 +1024,7 @@ void QXcbConnection::xi2HandleScrollEvent(void *event, ScrollingDevice &scrollin QPoint global(fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y)); Qt::KeyboardModifiers modifiers = keyboard()->translateModifiers(xiDeviceEvent->mods.effective); if (modifiers & Qt::AltModifier) - std::swap(angleDelta.rx(), angleDelta.ry()); + angleDelta = angleDelta.transposed(); qCDebug(lcQpaXInputEvents) << "scroll wheel (button" << xiDeviceEvent->detail << ") @ window pos" << local << "delta angle" << angleDelta; QWindowSystemInterface::handleWheelEvent(platformWindow->window(), xiDeviceEvent->time, local, global, QPoint(), angleDelta, modifiers); } diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h index 5bc806381c..0b238823f0 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.h +++ b/src/plugins/platforms/xcb/qxcbcursor.h @@ -65,7 +65,7 @@ inline bool operator==(const QXcbCursorCacheKey &k1, const QXcbCursorCacheKey &k return k1.shape == k2.shape && k1.bitmapCacheKey == k2.bitmapCacheKey && k1.maskCacheKey == k2.maskCacheKey; } -inline uint qHash(const QXcbCursorCacheKey &k, uint seed) Q_DECL_NOTHROW +inline uint qHash(const QXcbCursorCacheKey &k, uint seed) noexcept { return (uint(k.shape) + uint(k.bitmapCacheKey) + uint(k.maskCacheKey)) ^ seed; } @@ -83,7 +83,7 @@ public: QPoint pos() const override; void setPos(const QPoint &pos) override; - static void queryPointer(QXcbConnection *c, QXcbVirtualDesktop **virtualDesktop, QPoint *pos, int *keybMask = 0); + static void queryPointer(QXcbConnection *c, QXcbVirtualDesktop **virtualDesktop, QPoint *pos, int *keybMask = nullptr); #ifndef QT_NO_CURSOR xcb_cursor_t xcbCursor(const QCursor &c) const diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h index c19008c04b..1388e68acc 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.h +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -86,7 +86,7 @@ public: void handlePosition(QPlatformWindow *w, const xcb_client_message_event_t *event); void handleLeave(QPlatformWindow *w, const xcb_client_message_event_t *event); void handleDrop(QPlatformWindow *, const xcb_client_message_event_t *event, - Qt::MouseButtons b = 0, Qt::KeyboardModifiers mods = 0); + Qt::MouseButtons b = nullptr, Qt::KeyboardModifiers mods = nullptr); void handleStatus(const xcb_client_message_event_t *event); void handleSelectionRequest(const xcb_selection_request_event_t *event); @@ -109,7 +109,7 @@ private: void init(); void handle_xdnd_position(QPlatformWindow *w, const xcb_client_message_event_t *event, - Qt::MouseButtons b = 0, Qt::KeyboardModifiers mods = 0); + Qt::MouseButtons b = nullptr, Qt::KeyboardModifiers mods = nullptr); void handle_xdnd_status(const xcb_client_message_event_t *event); void send_leave(); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 899081e752..81b889a80f 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -636,13 +636,13 @@ static void dumpNativeWindowsRecursion(const QXcbConnection *connection, xcb_win const QChar oldPadChar =str.padChar(); str.setFieldWidth(8); str.setPadChar(QLatin1Char('0')); - str << hex << window; + str << Qt::hex << window; str.setFieldWidth(oldFieldWidth); str.setPadChar(oldPadChar); - str << dec << " \"" + str << Qt::dec << " \"" << QXcbWindow::windowTitle(connection, window) << "\" " - << geom.width() << 'x' << geom.height() << forcesign << geom.x() << geom.y() - << noforcesign << '\n'; + << geom.width() << 'x' << geom.height() << Qt::forcesign << geom.x() << geom.y() + << Qt::noforcesign << '\n'; auto reply = Q_XCB_REPLY(xcb_query_tree, conn, window); if (reply) { diff --git a/src/plugins/platforms/xcb/qxcbobject.h b/src/plugins/platforms/xcb/qxcbobject.h index 1b98d9346b..931bed9ec1 100644 --- a/src/plugins/platforms/xcb/qxcbobject.h +++ b/src/plugins/platforms/xcb/qxcbobject.h @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QXcbObject { public: - QXcbObject(QXcbConnection *connection = 0) : m_connection(connection) {} + QXcbObject(QXcbConnection *connection = nullptr) : m_connection(connection) {} void setConnection(QXcbConnection *connection) { m_connection = connection; } QXcbConnection *connection() const { return m_connection; } diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 0cf0942dab..8da299d491 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -660,10 +660,6 @@ QImage::Format QXcbScreen::format() const int QXcbScreen::forcedDpi() const { - static const int overrideDpi = qEnvironmentVariableIntValue("QT_FONT_DPI"); - if (overrideDpi) - return overrideDpi; - const int forcedDpi = m_virtualDesktop->forcedDpi(); if (forcedDpi > 0) return forcedDpi; @@ -679,11 +675,6 @@ QDpi QXcbScreen::logicalDpi() const return m_virtualDesktop->dpi(); } -qreal QXcbScreen::pixelDensity() const -{ - return m_pixelDensity; -} - QPlatformCursor *QXcbScreen::cursor() const { return m_cursor; @@ -747,14 +738,6 @@ void QXcbScreen::updateGeometry(const QRect &geometry, uint8_t rotation) if (m_sizeMillimeters.isEmpty()) m_sizeMillimeters = sizeInMillimeters(geometry.size(), m_virtualDesktop->dpi()); - qreal dpi = forcedDpi(); - if (dpi <= 0) - dpi = geometry.width() / physicalSize().width() * qreal(25.4); - - // Use 128 as a reference DPI on small screens. This favors "small UI" over "large UI". - qreal referenceDpi = physicalSize().width() <= 320 ? 128 : 96; - - m_pixelDensity = qMax(1, qRound(dpi/referenceDpi)); m_geometry = geometry; m_availableGeometry = geometry & m_virtualDesktop->workArea(); QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); @@ -925,7 +908,7 @@ QByteArray QXcbScreen::getEdid() const static inline void formatRect(QDebug &debug, const QRect r) { debug << r.width() << 'x' << r.height() - << forcesign << r.x() << r.y() << noforcesign; + << Qt::forcesign << r.x() << r.y() << Qt::noforcesign; } static inline void formatSizeF(QDebug &debug, const QSizeF s) @@ -939,7 +922,7 @@ QDebug operator<<(QDebug debug, const QXcbScreen *screen) debug.nospace(); debug << "QXcbScreen(" << (const void *)screen; if (screen) { - debug << fixed << qSetRealNumberPrecision(1); + debug << Qt::fixed << qSetRealNumberPrecision(1); debug << ", name=" << screen->name(); debug << ", geometry="; formatRect(debug, screen->geometry()); @@ -957,7 +940,7 @@ QDebug operator<<(QDebug debug, const QXcbScreen *screen) debug << "), orientation=" << screen->orientation(); debug << ", depth=" << screen->depth(); debug << ", refreshRate=" << screen->refreshRate(); - debug << ", root=" << hex << screen->root(); + debug << ", root=" << Qt::hex << screen->root(); debug << ", windowManagerName=" << screen->windowManagerName(); } debug << ')'; diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 914ce6307d..79698b4ef3 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -161,7 +161,7 @@ public: QImage::Format format() const override; QSizeF physicalSize() const override { return m_sizeMillimeters; } QDpi logicalDpi() const override; - qreal pixelDensity() const override; + QDpi logicalBaseDpi() const override { return QDpi(96, 96); }; QPlatformCursor *cursor() const override; qreal refreshRate() const override { return m_refreshRate; } Qt::ScreenOrientation orientation() const override { return m_orientation; } @@ -227,7 +227,6 @@ private: Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation; QXcbCursor *m_cursor; qreal m_refreshRate = 60.0; - int m_pixelDensity = 1; QEdidParser m_edid; }; diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp index 2303ccf806..f880d4d722 100644 --- a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp +++ b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp @@ -42,6 +42,8 @@ #ifndef QT_NO_SESSIONMANAGER +#include <qpa/qwindowsysteminterface.h> + #include <qguiapplication.h> #include <qdatetime.h> #include <qfileinfo.h> @@ -289,8 +291,7 @@ static void sm_dieCallback(SmcConn smcConn, SmPointer /* clientData */) if (smcConn != smcConnection) return; resetSmState(); - QEvent quitEvent(QEvent::Quit); - QGuiApplication::sendEvent(qApp, &quitEvent); + QWindowSystemInterface::handleApplicationTermination<QWindowSystemInterface::SynchronousDelivery>(); } static void sm_shutdownCancelledCallback(SmcConn smcConn, SmPointer clientData) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 610eca06a5..97da420798 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1657,7 +1657,11 @@ bool QXcbWindow::requestSystemTrayWindowDock() bool QXcbWindow::handleNativeEvent(xcb_generic_event_t *event) { auto eventType = connection()->nativeInterface()->nativeEventType(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + qintptr result = 0; // Used only by MS Windows +#else long result = 0; // Used only by MS Windows +#endif return QWindowSystemInterface::handleNativeEvent(window(), eventType, event, &result); } @@ -1904,7 +1908,7 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in else if (detail == 7) angleDelta.setX(-120); if (modifiers & Qt::AltModifier) - std::swap(angleDelta.rx(), angleDelta.ry()); + angleDelta = angleDelta.transposed(); QWindowSystemInterface::handleWheelEvent(window(), timestamp, local, global, QPoint(), angleDelta, modifiers); #if QT_CONFIG(xcb_xinput) } diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 8258cc2dfa..5de5974ca7 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -166,7 +166,7 @@ public: bool needsSync() const; void postSyncWindowRequest(); - void clearSyncWindowRequest() { m_pendingSyncRequest = 0; } + void clearSyncWindowRequest() { m_pendingSyncRequest = nullptr; } QXcbScreen *xcbScreen() const; |