diff options
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 20 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbcursor.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 14 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbmain.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbmime.cpp | 49 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbsessionmanager.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 4 |
10 files changed, 68 insertions, 49 deletions
diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp index 8412663e3c..6a33b08509 100644 --- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp @@ -47,8 +47,10 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QXcbGlIntegrationFactoryInterface_iid, QLatin1String("/xcbglintegrations"), Qt::CaseInsensitive)) + (QXcbGlIntegrationFactoryInterface_iid, "/xcbglintegrations"_L1, Qt::CaseInsensitive)) QXcbGlIntegration *QXcbGlIntegrationFactory::create(const QString &platform) { diff --git a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp index 1e3c60ccd5..83533c974e 100644 --- a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp +++ b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp @@ -60,6 +60,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + #if QT_CONFIG(xrender) class QXRenderTessellator : public QTessellator @@ -451,7 +453,7 @@ static const uchar base_dither_matrix[DITHER_SIZE][DITHER_SIZE] = { static QPixmap qt_patternForAlpha(uchar alpha, int screen) { QPixmap pm; - QString key = QLatin1String("$qt-alpha-brush$") + QString key = "$qt-alpha-brush$"_L1 % HexString<uchar>(alpha) % HexString<int>(screen); diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 191d5af26c..8d0bfbb916 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -73,6 +73,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.input") Q_LOGGING_CATEGORY(lcQpaXInputDevices, "qt.qpa.input.devices") Q_LOGGING_CATEGORY(lcQpaXInputEvents, "qt.qpa.input.events") @@ -898,7 +900,7 @@ xcb_window_t QXcbConnection::qtSelectionOwner() nullptr); // value list QXcbWindow::setWindowTitle(connection(), m_qtSelectionOwner, - QLatin1String("Qt Selection Owner for ") + QCoreApplication::applicationName()); + "Qt Selection Owner for "_L1 + QCoreApplication::applicationName()); } return m_qtSelectionOwner; } @@ -1162,7 +1164,7 @@ QXcbGlIntegration *QXcbConnection::glIntegration() const QString glIntegrationName = QString::fromLocal8Bit(qgetenv("QT_XCB_GL_INTEGRATION")); if (!glIntegrationName.isEmpty()) { qCDebug(lcQpaGl) << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName; - if (glIntegrationName != QLatin1String("none")) { + if (glIntegrationName != "none"_L1) { glIntegrationNames.removeAll(glIntegrationName); glIntegrationNames.prepend(glIntegrationName); } else { diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index d09e598114..c9e45e623a 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -53,6 +53,8 @@ #define QT_XCB_HAS_TOUCHPAD_GESTURES (XCB_INPUT_MINOR_VERSION >= 4) +using namespace Qt::StringLiterals; + using qt_xcb_input_device_event_t = xcb_input_button_press_event_t; #if QT_XCB_HAS_TOUCHPAD_GESTURES using qt_xcb_input_pinch_event_t = xcb_input_gesture_pinch_begin_event_t; @@ -371,42 +373,42 @@ void QXcbConnection::xi2SetupSlavePointerDevice(void *info, bool removeExisting, // But we need to be careful not to take the touch and tablet-button devices as tablets. QByteArray nameLower = nameRaw.toLower(); - QString dbgType = QLatin1String("UNKNOWN"); + QString dbgType = "UNKNOWN"_L1; if (nameLower.contains("eraser")) { isTablet = true; tabletData.pointerType = QPointingDevice::PointerType::Eraser; - dbgType = QLatin1String("eraser"); + dbgType = "eraser"_L1; } else if (nameLower.contains("cursor") && !(nameLower.contains("cursor controls") && nameLower.contains("trackball"))) { isTablet = true; tabletData.pointerType = QPointingDevice::PointerType::Cursor; - dbgType = QLatin1String("cursor"); + dbgType = "cursor"_L1; } else if (nameLower.contains("wacom") && nameLower.contains("finger touch")) { isTablet = false; } else if ((nameLower.contains("pen") || nameLower.contains("stylus")) && isTablet) { tabletData.pointerType = QPointingDevice::PointerType::Pen; - dbgType = QLatin1String("pen"); + dbgType = "pen"_L1; } else if (nameLower.contains("wacom") && isTablet && !nameLower.contains("touch")) { // combined device (evdev) rather than separate pen/eraser (wacom driver) tabletData.pointerType = QPointingDevice::PointerType::Pen; - dbgType = QLatin1String("pen"); + dbgType = "pen"_L1; } else if (nameLower.contains("aiptek") /* && device == QXcbAtom::KEYBOARD */) { // some "Genius" tablets isTablet = true; tabletData.pointerType = QPointingDevice::PointerType::Pen; - dbgType = QLatin1String("pen"); + dbgType = "pen"_L1; } else if (nameLower.contains("waltop") && nameLower.contains("tablet")) { // other "Genius" tablets // WALTOP International Corp. Slim Tablet isTablet = true; tabletData.pointerType = QPointingDevice::PointerType::Pen; - dbgType = QLatin1String("pen"); + dbgType = "pen"_L1; } else if (nameLower.contains("uc-logic") && isTablet) { tabletData.pointerType = QPointingDevice::PointerType::Pen; - dbgType = QLatin1String("pen"); + dbgType = "pen"_L1; } else if (nameLower.contains("ugee")) { isTablet = true; tabletData.pointerType = QPointingDevice::PointerType::Pen; - dbgType = QLatin1String("pen"); + dbgType = "pen"_L1; } else { isTablet = false; } diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index 9f8007066d..d539b0c849 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -55,6 +55,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + typedef int (*PtrXcursorLibraryLoadCursor)(void *, const char *); typedef char *(*PtrXcursorLibraryGetTheme)(void *); typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *); @@ -317,10 +319,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen) #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) static bool function_ptrs_not_initialized = true; if (function_ptrs_not_initialized) { - QLibrary xcursorLib(QLatin1String("Xcursor"), 1); + QLibrary xcursorLib("Xcursor"_L1, 1); bool xcursorFound = xcursorLib.load(); if (!xcursorFound) { // try without the version number - xcursorLib.setFileName(QLatin1String("Xcursor")); + xcursorLib.setFileName("Xcursor"_L1); xcursorFound = xcursorLib.load(); } if (xcursorFound) { diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 672e6d92a8..c4947615d0 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -100,16 +100,18 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + // Find out if our parent process is gdb by looking at the 'exe' symlink under /proc,. // or, for older Linuxes, read out 'cmdline'. static bool runningUnderDebugger() { #if defined(QT_DEBUG) && defined(Q_OS_LINUX) - const QString parentProc = QLatin1String("/proc/") + QString::number(getppid()); - const QFileInfo parentProcExe(parentProc + QLatin1String("/exe")); + const QString parentProc = "/proc/"_L1 + QString::number(getppid()); + const QFileInfo parentProcExe(parentProc + "/exe"_L1); if (parentProcExe.isSymLink()) - return parentProcExe.symLinkTarget().endsWith(QLatin1String("/gdb")); - QFile f(parentProc + QLatin1String("/cmdline")); + return parentProcExe.symLinkTarget().endsWith("/gdb"_L1); + QFile f(parentProc + "/cmdline"_L1); if (!f.open(QIODevice::ReadOnly)) return false; QByteArray s; @@ -360,14 +362,14 @@ QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const void QXcbIntegration::initialize() { - const QLatin1String defaultInputContext("compose"); + const auto defaultInputContext = "compose"_L1; // Perform everything that may potentially need the event dispatcher (timers, socket // notifiers) here instead of the constructor. QString icStr = QPlatformInputContextFactory::requested(); if (icStr.isNull()) icStr = defaultInputContext; m_inputContext.reset(QPlatformInputContextFactory::create(icStr)); - if (!m_inputContext && icStr != defaultInputContext && icStr != QLatin1String("none")) + if (!m_inputContext && icStr != defaultInputContext && icStr != "none"_L1) m_inputContext.reset(QPlatformInputContextFactory::create(defaultInputContext)); connection()->keyboard()->initialize(); diff --git a/src/plugins/platforms/xcb/qxcbmain.cpp b/src/plugins/platforms/xcb/qxcbmain.cpp index 1fb5f4a841..6df863ccce 100644 --- a/src/plugins/platforms/xcb/qxcbmain.cpp +++ b/src/plugins/platforms/xcb/qxcbmain.cpp @@ -42,6 +42,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + class QXcbIntegrationPlugin : public QPlatformIntegrationPlugin { Q_OBJECT @@ -52,7 +54,7 @@ public: QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& parameters, int &argc, char **argv) { - if (!system.compare(QLatin1String("xcb"), Qt::CaseInsensitive)) { + if (!system.compare("xcb"_L1, Qt::CaseInsensitive)) { auto xcbIntegration = new QXcbIntegration(parameters, argc, argv); if (!xcbIntegration->hasConnection()) { delete xcbIntegration; diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp index f4672c3f75..0a42953eec 100644 --- a/src/plugins/platforms/xcb/qxcbmime.cpp +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -45,6 +45,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + QXcbMime::QXcbMime() : QInternalMimeData() { } @@ -63,11 +65,11 @@ QString QXcbMime::mimeAtomToString(QXcbConnection *connection, xcb_atom_t a) if (a == XCB_ATOM_STRING || a == connection->atom(QXcbAtom::UTF8_STRING) || a == connection->atom(QXcbAtom::TEXT)) - return QLatin1String("text/plain"); + return "text/plain"_L1; // special case for images if (a == XCB_ATOM_PIXMAP) - return QLatin1String("image/ppm"); + return "image/ppm"_L1; QByteArray atomName = connection->atomName(a); @@ -91,15 +93,15 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa if ((a == connection->atom(QXcbAtom::UTF8_STRING) || a == XCB_ATOM_STRING || a == connection->atom(QXcbAtom::TEXT)) - && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { + && QInternalMimeData::hasFormatHelper("text/plain"_L1, mimeData)) { if (a == connection->atom(QXcbAtom::UTF8_STRING)) { - *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); + *data = QInternalMimeData::renderDataHelper("text/plain"_L1, mimeData); ret = true; } else if (a == XCB_ATOM_STRING || a == connection->atom(QXcbAtom::TEXT)) { // ICCCM says STRING is latin1 *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( - QLatin1String("text/plain"), mimeData)).toLatin1(); + "text/plain"_L1, mimeData)).toLatin1(); ret = true; } return ret; @@ -110,18 +112,17 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa *data = QInternalMimeData::renderDataHelper(atomName, mimeData); // mimeAtomToString() converts "text/x-moz-url" to "text/uri-list", // so QXcbConnection::atomName() has to be used. - if (atomName == QLatin1String("text/uri-list") + if (atomName == "text/uri-list"_L1 && connection->atomName(a) == "text/x-moz-url") { const QString mozUri = QLatin1String(data->split('\n').constFirst()) + u'\n'; *data = QByteArray(reinterpret_cast<const char *>(mozUri.data()), mozUri.length() * 2); - } else if (atomName == QLatin1String("application/x-color")) + } else if (atomName == "application/x-color"_L1) *dataFormat = 16; ret = true; } else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) { ret = true; - } else if (atomName == QLatin1String("text/plain") - && mimeData->hasFormat(QLatin1String("text/uri-list"))) { + } else if (atomName == "text/plain"_L1 && mimeData->hasFormat("text/uri-list"_L1)) { // Return URLs also as plain text. *data = QInternalMimeData::renderDataHelper(atomName, mimeData); ret = true; @@ -136,22 +137,22 @@ QList<xcb_atom_t> QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, const atoms.append(connection->internAtom(format.toLatin1())); // special cases for strings - if (format == QLatin1String("text/plain")) { + if (format == "text/plain"_L1) { atoms.append(connection->atom(QXcbAtom::UTF8_STRING)); atoms.append(XCB_ATOM_STRING); atoms.append(connection->atom(QXcbAtom::TEXT)); } // special cases for uris - if (format == QLatin1String("text/uri-list")) { + if (format == "text/uri-list"_L1) { atoms.append(connection->internAtom("text/x-moz-url")); atoms.append(connection->internAtom("text/plain")); } //special cases for images - if (format == QLatin1String("image/ppm")) + if (format == "image/ppm"_L1) atoms.append(XCB_ATOM_PIXMAP); - if (format == QLatin1String("image/pbm")) + if (format == "image/pbm"_L1) atoms.append(XCB_ATOM_BITMAP); return atoms; @@ -164,14 +165,14 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, QString atomName = mimeAtomToString(connection, a); // qDebug() << "mimeConvertDataToFormat" << format << atomName << data; - if (hasUtf8 && atomName == format + QLatin1String(";charset=utf-8")) { + if (hasUtf8 && atomName == format + ";charset=utf-8"_L1) { if (requestedType.id() == QMetaType::QString) return QString::fromUtf8(data); return data; } // special cases for string types - if (format == QLatin1String("text/plain")) { + if (format == "text/plain"_L1) { if (data.endsWith('\0')) data.chop(1); if (a == connection->atom(QXcbAtom::UTF8_STRING)) { @@ -185,7 +186,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, // Firefox uses UTF16 without BOM for text/x-moz-url, "text/html", // Google Chrome uses UTF16 without BOM for "text/x-moz-url", // UTF16 with BOM for "text/html". - if ((format == QLatin1String("text/html") || format == QLatin1String("text/uri-list")) + if ((format == "text/html"_L1 || format == "text/uri-list"_L1) && data.size() > 1) { const quint8 byte0 = data.at(0); const quint8 byte1 = data.at(1); @@ -194,7 +195,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QString str = QString::fromUtf16( reinterpret_cast<const char16_t *>(data.constData()), data.size() / 2); if (!str.isNull()) { - if (format == QLatin1String("text/uri-list")) { + if (format == "text/uri-list"_L1) { const auto urls = QStringView{str}.split(u'\n'); QList<QVariant> list; list.reserve(urls.size()); @@ -224,7 +225,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, #if 0 // ### // special case for images - if (format == QLatin1String("image/ppm")) { + if (format == "image/ppm"_L1) { if (a == XCB_ATOM_PIXMAP && data.size() == sizeof(Pixmap)) { Pixmap xpm = *((Pixmap*)data.data()); if (!xpm) @@ -261,7 +262,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString *hasUtf8 = false; // find matches for string types - if (format == QLatin1String("text/plain")) { + if (format == "text/plain"_L1) { if (atoms.contains(connection->atom(QXcbAtom::UTF8_STRING))) return connection->atom(QXcbAtom::UTF8_STRING); if (atoms.contains(XCB_ATOM_STRING)) @@ -271,7 +272,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString } // find matches for uri types - if (format == QLatin1String("text/uri-list")) { + if (format == "text/uri-list"_L1) { xcb_atom_t a = connection->internAtom(format.toLatin1()); if (a && atoms.contains(a)) return a; @@ -281,7 +282,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString } // find match for image - if (format == QLatin1String("image/ppm")) { + if (format == "image/ppm"_L1) { if (atoms.contains(XCB_ATOM_PIXMAP)) return XCB_ATOM_PIXMAP; } @@ -289,11 +290,11 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString // for string/text requests try to use a format with a well-defined charset // first to avoid encoding problems if (requestedType.id() == QMetaType::QString - && format.startsWith(QLatin1String("text/")) - && !format.contains(QLatin1String("charset="))) { + && format.startsWith("text/"_L1) + && !format.contains("charset="_L1)) { QString formatWithCharset = format; - formatWithCharset.append(QLatin1String(";charset=utf-8")); + formatWithCharset.append(";charset=utf-8"_L1); xcb_atom_t a = connection->internAtom(std::move(formatWithCharset).toLatin1()); if (a && atoms.contains(a)) { diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp index 64fb29f8df..b6a11ccfea 100644 --- a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp +++ b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp @@ -55,6 +55,8 @@ #include <cerrno> // ERANGE +using namespace Qt::StringLiterals; + class QSmSocketReceiver : public QObject { Q_OBJECT @@ -228,11 +230,11 @@ static void sm_performSaveYourself(QXcbSessionManager *sm) // generate a restart and discard command that makes sense QStringList restart; - restart << argument0 << QLatin1String("-session") << sm->sessionId() + u'_' + sm->sessionKey(); + restart << argument0 << "-session"_L1 << sm->sessionId() + u'_' + sm->sessionKey(); QFileInfo fi(QCoreApplication::applicationFilePath()); if (qAppName().compare(fi.fileName(), Qt::CaseInsensitive) != 0) - restart << QLatin1String("-name") << qAppName(); + restart << "-name"_L1 << qAppName(); sm->setRestartCommand(restart); QStringList discard; sm->setDiscardCommand(discard); diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 0aee383512..2d204a5691 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -92,6 +92,8 @@ enum { QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window"); Q_DECLARE_TYPEINFO(xcb_rectangle_t, Q_PRIMITIVE_TYPE); @@ -2354,7 +2356,7 @@ bool QXcbWindow::startSystemMoveResize(const QPoint &pos, int edges) bool startedByTouch = connection()->startSystemMoveResizeForTouch(m_window, edges); if (startedByTouch) { const QString wmname = connection()->windowManagerName(); - if (wmname != QLatin1String("kwin") && wmname != QLatin1String("openbox")) { + if (wmname != "kwin"_L1 && wmname != "openbox"_L1) { qCDebug(lcQpaXInputDevices) << "only KDE and OpenBox support startSystemMove/Resize which is triggered from touch events: XDG_CURRENT_DESKTOP=" << qgetenv("XDG_CURRENT_DESKTOP"); connection()->abortSystemMoveResize(m_window); |