commit
adbb5779e6
@ -0,0 +1 @@
|
|||||||
|
SOURCES/qtbase-everywhere-src-6.7.1.tar.xz
|
@ -0,0 +1 @@
|
|||||||
|
d056b7d9ab0a16c15dbfac5a4d8e489af2ea23df SOURCES/qtbase-everywhere-src-6.7.1.tar.xz
|
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z "$QT_XCB_FORCE_SOFTWARE_OPENGL" ]; then
|
||||||
|
|
||||||
|
QT6_CHECK_OPENGL_VERSION=`LANG=C glxinfo 2> /dev/null | grep '^OpenGL version string: ' | head -n 1 | sed -e 's/^OpenGL version string: \([0-9]\).*$/\1/g'` ||:
|
||||||
|
|
||||||
|
if [ "$QT6_CHECK_OPENGL_VERSION" == "1" ]; then
|
||||||
|
QT_XCB_FORCE_SOFTWARE_OPENGL=1
|
||||||
|
export QT_XCB_FORCE_SOFTWARE_OPENGL
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset QT6_CHECK_OPENGL_VERSION
|
||||||
|
|
||||||
|
fi
|
@ -0,0 +1,232 @@
|
|||||||
|
From b1e75376cc3adfc7da5502a277dfe9711f3e0536 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mårten Nordheim <marten.nordheim@qt.io>
|
||||||
|
Date: Tue, 25 Jun 2024 17:09:35 +0200
|
||||||
|
Subject: [PATCH] HTTP2: Delay any communication until encrypted() can be responded to
|
||||||
|
|
||||||
|
We have the encrypted() signal that lets users do extra checks on the
|
||||||
|
established connection. It is emitted as BlockingQueued, so the HTTP
|
||||||
|
thread stalls until it is done emitting. Users can potentially call
|
||||||
|
abort() on the QNetworkReply at that point, which is passed as a Queued
|
||||||
|
call back to the HTTP thread. That means that any currently queued
|
||||||
|
signal emission will be processed before the abort() call is processed.
|
||||||
|
|
||||||
|
In the case of HTTP2 it is a little special since it is multiplexed and
|
||||||
|
the code is built to start requests as they are available. This means
|
||||||
|
that, while the code worked fine for HTTP1, since one connection only
|
||||||
|
has one request, it is not working for HTTP2, since we try to send more
|
||||||
|
requests in-between the encrypted() signal and the abort() call.
|
||||||
|
|
||||||
|
This patch changes the code to delay any communication until the
|
||||||
|
encrypted() signal has been emitted and processed, for HTTP2 only.
|
||||||
|
It's done by adding a few booleans, both to know that we have to return
|
||||||
|
early and so we can keep track of what events arose and what we need to
|
||||||
|
resume once enough time has passed that any abort() call must have been
|
||||||
|
processed.
|
||||||
|
|
||||||
|
Fixes: QTBUG-126610
|
||||||
|
Pick-to: 6.8 6.7 6.5 6.2 5.15 5.12
|
||||||
|
Change-Id: Ic25a600c278203256e35f541026f34a8783235ae
|
||||||
|
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
|
||||||
|
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
|
||||||
|
---
|
||||||
|
|
||||||
|
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp
|
||||||
|
index 0abd99b9..3631b13d 100644
|
||||||
|
--- a/src/network/access/qhttp2protocolhandler.cpp
|
||||||
|
+++ b/src/network/access/qhttp2protocolhandler.cpp
|
||||||
|
@@ -303,12 +303,12 @@ bool QHttp2ProtocolHandler::sendRequest()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!prefaceSent && !sendClientPreface())
|
||||||
|
- return false;
|
||||||
|
-
|
||||||
|
if (!requests.size())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
+ if (!prefaceSent && !sendClientPreface())
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
m_channel->state = QHttpNetworkConnectionChannel::WritingState;
|
||||||
|
// Check what was promised/pushed, maybe we do not have to send a request
|
||||||
|
// and have a response already?
|
||||||
|
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
|
||||||
|
index 67669896..1e4161d1 100644
|
||||||
|
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
|
||||||
|
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
|
||||||
|
@@ -209,6 +209,10 @@ void QHttpNetworkConnectionChannel::abort()
|
||||||
|
bool QHttpNetworkConnectionChannel::sendRequest()
|
||||||
|
{
|
||||||
|
Q_ASSERT(protocolHandler);
|
||||||
|
+ if (waitingForPotentialAbort) {
|
||||||
|
+ needInvokeSendRequest = true;
|
||||||
|
+ return false; // this return value is unused
|
||||||
|
+ }
|
||||||
|
return protocolHandler->sendRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -221,21 +225,28 @@ bool QHttpNetworkConnectionChannel::sendRequest()
|
||||||
|
void QHttpNetworkConnectionChannel::sendRequestDelayed()
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod(this, [this] {
|
||||||
|
- Q_ASSERT(protocolHandler);
|
||||||
|
if (reply)
|
||||||
|
- protocolHandler->sendRequest();
|
||||||
|
+ sendRequest();
|
||||||
|
}, Qt::ConnectionType::QueuedConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QHttpNetworkConnectionChannel::_q_receiveReply()
|
||||||
|
{
|
||||||
|
Q_ASSERT(protocolHandler);
|
||||||
|
+ if (waitingForPotentialAbort) {
|
||||||
|
+ needInvokeReceiveReply = true;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
protocolHandler->_q_receiveReply();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QHttpNetworkConnectionChannel::_q_readyRead()
|
||||||
|
{
|
||||||
|
Q_ASSERT(protocolHandler);
|
||||||
|
+ if (waitingForPotentialAbort) {
|
||||||
|
+ needInvokeReadyRead = true;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
protocolHandler->_q_readyRead();
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1239,7 +1250,18 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
|
||||||
|
if (!h2RequestsToSend.isEmpty()) {
|
||||||
|
// Similar to HTTP/1.1 counterpart below:
|
||||||
|
const auto &pair = std::as_const(h2RequestsToSend).first();
|
||||||
|
+ waitingForPotentialAbort = true;
|
||||||
|
emit pair.second->encrypted();
|
||||||
|
+
|
||||||
|
+ // We don't send or handle any received data until any effects from
|
||||||
|
+ // emitting encrypted() have been processed. This is necessary
|
||||||
|
+ // because the user may have called abort(). We may also abort the
|
||||||
|
+ // whole connection if the request has been aborted and there is
|
||||||
|
+ // no more requests to send.
|
||||||
|
+ QMetaObject::invokeMethod(this,
|
||||||
|
+ &QHttpNetworkConnectionChannel::checkAndResumeCommunication,
|
||||||
|
+ Qt::QueuedConnection);
|
||||||
|
+
|
||||||
|
// In case our peer has sent us its settings (window size, max concurrent streams etc.)
|
||||||
|
// let's give _q_receiveReply a chance to read them first ('invokeMethod', QueuedConnection).
|
||||||
|
}
|
||||||
|
@@ -1257,6 +1279,28 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
|
||||||
|
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
+void QHttpNetworkConnectionChannel::checkAndResumeCommunication()
|
||||||
|
+{
|
||||||
|
+ Q_ASSERT(connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2
|
||||||
|
+ || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct);
|
||||||
|
+
|
||||||
|
+ // Because HTTP/2 requires that we send a SETTINGS frame as the first thing we do, and respond
|
||||||
|
+ // to a SETTINGS frame with an ACK, we need to delay any handling until we can ensure that any
|
||||||
|
+ // effects from emitting encrypted() have been processed.
|
||||||
|
+ // This function is called after encrypted() was emitted, so check for changes.
|
||||||
|
+
|
||||||
|
+ if (!reply && h2RequestsToSend.isEmpty())
|
||||||
|
+ abort();
|
||||||
|
+ waitingForPotentialAbort = false;
|
||||||
|
+ if (needInvokeReadyRead)
|
||||||
|
+ _q_readyRead();
|
||||||
|
+ if (needInvokeReceiveReply)
|
||||||
|
+ _q_receiveReply();
|
||||||
|
+ if (needInvokeSendRequest)
|
||||||
|
+ sendRequest();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void QHttpNetworkConnectionChannel::requeueHttp2Requests()
|
||||||
|
{
|
||||||
|
const auto h2RequestsToSendCopy = std::exchange(h2RequestsToSend, {});
|
||||||
|
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
|
||||||
|
index c42290fe..061f20fd 100644
|
||||||
|
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
|
||||||
|
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
|
||||||
|
@@ -74,6 +74,10 @@ public:
|
||||||
|
QAbstractSocket *socket;
|
||||||
|
bool ssl;
|
||||||
|
bool isInitialized;
|
||||||
|
+ bool waitingForPotentialAbort = false;
|
||||||
|
+ bool needInvokeReceiveReply = false;
|
||||||
|
+ bool needInvokeReadyRead = false;
|
||||||
|
+ bool needInvokeSendRequest = false;
|
||||||
|
ChannelState state;
|
||||||
|
QHttpNetworkRequest request; // current request, only used for HTTP
|
||||||
|
QHttpNetworkReply *reply; // current reply for this request, only used for HTTP
|
||||||
|
@@ -146,6 +150,8 @@ public:
|
||||||
|
void closeAndResendCurrentRequest();
|
||||||
|
void resendCurrentRequest();
|
||||||
|
|
||||||
|
+ void checkAndResumeCommunication();
|
||||||
|
+
|
||||||
|
bool isSocketBusy() const;
|
||||||
|
bool isSocketWriting() const;
|
||||||
|
bool isSocketWaiting() const;
|
||||||
|
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp
|
||||||
|
index 74be5afd..9e5f94e3 100644
|
||||||
|
--- a/tests/auto/network/access/http2/tst_http2.cpp
|
||||||
|
+++ b/tests/auto/network/access/http2/tst_http2.cpp
|
||||||
|
@@ -106,6 +106,8 @@ private slots:
|
||||||
|
|
||||||
|
void duplicateRequestsWithAborts();
|
||||||
|
|
||||||
|
+ void abortOnEncrypted();
|
||||||
|
+
|
||||||
|
protected slots:
|
||||||
|
// Slots to listen to our in-process server:
|
||||||
|
void serverStarted(quint16 port);
|
||||||
|
@@ -1479,6 +1481,48 @@ void tst_Http2::duplicateRequestsWithAborts()
|
||||||
|
QCOMPARE(finishedCount, ExpectedSuccessfulRequests);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void tst_Http2::abortOnEncrypted()
|
||||||
|
+{
|
||||||
|
+#if !QT_CONFIG(ssl)
|
||||||
|
+ QSKIP("TLS support is needed for this test");
|
||||||
|
+#else
|
||||||
|
+ clearHTTP2State();
|
||||||
|
+ serverPort = 0;
|
||||||
|
+
|
||||||
|
+ ServerPtr targetServer(newServer(defaultServerSettings, H2Type::h2Direct));
|
||||||
|
+
|
||||||
|
+ QMetaObject::invokeMethod(targetServer.data(), "startServer", Qt::QueuedConnection);
|
||||||
|
+ runEventLoop();
|
||||||
|
+
|
||||||
|
+ nRequests = 1;
|
||||||
|
+ nSentRequests = 0;
|
||||||
|
+
|
||||||
|
+ const auto url = requestUrl(H2Type::h2Direct);
|
||||||
|
+ QNetworkRequest request(url);
|
||||||
|
+ request.setAttribute(QNetworkRequest::Http2DirectAttribute, true);
|
||||||
|
+
|
||||||
|
+ std::unique_ptr<QNetworkReply> reply{manager->get(request)};
|
||||||
|
+ reply->ignoreSslErrors();
|
||||||
|
+ connect(reply.get(), &QNetworkReply::encrypted, reply.get(), [reply = reply.get()](){
|
||||||
|
+ reply->abort();
|
||||||
|
+ });
|
||||||
|
+ connect(reply.get(), &QNetworkReply::errorOccurred, this, &tst_Http2::replyFinishedWithError);
|
||||||
|
+
|
||||||
|
+ runEventLoop();
|
||||||
|
+ STOP_ON_FAILURE
|
||||||
|
+
|
||||||
|
+ QCOMPARE(nRequests, 0);
|
||||||
|
+ QCOMPARE(reply->error(), QNetworkReply::OperationCanceledError);
|
||||||
|
+
|
||||||
|
+ const bool res = QTest::qWaitFor(
|
||||||
|
+ [this, server = targetServer.get()]() {
|
||||||
|
+ return serverGotSettingsACK || prefaceOK || nSentRequests > 0;
|
||||||
|
+ },
|
||||||
|
+ 500);
|
||||||
|
+ QVERIFY(!res);
|
||||||
|
+#endif // QT_CONFIG(ssl)
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void tst_Http2::serverStarted(quint16 port)
|
||||||
|
{
|
||||||
|
serverPort = port;
|
@ -0,0 +1,4 @@
|
|||||||
|
%_qt6 @@NAME@@
|
||||||
|
%_qt6_epoch @@EPOCH@@
|
||||||
|
%_qt6_version @@VERSION@@
|
||||||
|
%_qt6_evr @@EVR@@
|
@ -0,0 +1,23 @@
|
|||||||
|
/* qconfig.h */
|
||||||
|
/* This file is here to prevent a file conflict on multiarch systems. A
|
||||||
|
* conflict will occur because qconfig.h has arch-specific definitions.
|
||||||
|
*
|
||||||
|
* DO NOT INCLUDE THE NEW FILE DIRECTLY -- ALWAYS INCLUDE THIS ONE INSTEAD. */
|
||||||
|
|
||||||
|
#ifndef QCONFIG_MULTILIB_H
|
||||||
|
#define QCONFIG_MULTILIB_H
|
||||||
|
|
||||||
|
#ifndef __WORDSIZE
|
||||||
|
#include <bits/wordsize.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __WORDSIZE == 32
|
||||||
|
#include "QtCore/qconfig-32.h"
|
||||||
|
#elif __WORDSIZE == 64
|
||||||
|
#include "QtCore/qconfig-64.h"
|
||||||
|
#else
|
||||||
|
#error "unexpected value for __WORDSIZE macro"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,51 @@
|
|||||||
|
From 4e517492a03b6c0b710a2d9a3df05922ac233992 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Christophe Marin <christophe@krop.fr>
|
||||||
|
Date: Wed, 24 May 2023 11:23:39 +0200
|
||||||
|
Subject: [PATCH] CMake: Install objects files into 'ARCHDATADIR'
|
||||||
|
|
||||||
|
Change-Id: I917a9ef4d83f93eb5c3e47964bf1814d1b53fdab
|
||||||
|
---
|
||||||
|
cmake/QtResourceHelpers.cmake | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/cmake/QtResourceHelpers.cmake b/cmake/QtResourceHelpers.cmake
|
||||||
|
index 2df1fed50f..e4f34b5ff1 100644
|
||||||
|
--- a/cmake/QtResourceHelpers.cmake
|
||||||
|
+++ b/cmake/QtResourceHelpers.cmake
|
||||||
|
@@ -38,7 +38,7 @@ function(qt_internal_add_resource target resourceName)
|
||||||
|
if (out_targets)
|
||||||
|
qt_install(TARGETS ${out_targets}
|
||||||
|
EXPORT "${INSTALL_CMAKE_NAMESPACE}${target}Targets"
|
||||||
|
- DESTINATION "${INSTALL_LIBDIR}"
|
||||||
|
+ DESTINATION "${INSTALL_ARCHDATADIR}"
|
||||||
|
)
|
||||||
|
qt_internal_add_targets_to_additional_targets_export_file(
|
||||||
|
TARGETS ${out_targets}
|
||||||
|
@@ -47,7 +47,7 @@ function(qt_internal_add_resource target resourceName)
|
||||||
|
|
||||||
|
qt_internal_install_resource_pdb_files("${out_targets}")
|
||||||
|
qt_internal_record_rcc_object_files("${target}" "${out_targets}"
|
||||||
|
- INSTALL_DIRECTORY "${INSTALL_LIBDIR}")
|
||||||
|
+ INSTALL_DIRECTORY "${INSTALL_ARCHDATADIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (arg_OUTPUT_TARGETS)
|
||||||
|
@@ -77,7 +77,7 @@ function(qt_internal_record_rcc_object_files target resource_targets)
|
||||||
|
# It's comprised of thee following path parts:
|
||||||
|
#
|
||||||
|
# part (1) INSTALL_DIRECTORY.
|
||||||
|
- # A usual value is '${INSTALL_LIBDIR}/' for libraries
|
||||||
|
+ # A usual value is '${INSTALL_ARCHDATADIR}/' for libraries
|
||||||
|
# and '${INSTALL_QMLDIR}/foo/bar/' for qml plugin resources.
|
||||||
|
#
|
||||||
|
# part (2) the value computed by CMake's computeInstallObjectDir comprised of an
|
||||||
|
@@ -128,6 +128,6 @@ function(qt_internal_install_resource_pdb_files objlib_targets)
|
||||||
|
_qt_resource_generated_cpp_relative_path)
|
||||||
|
get_filename_component(rel_obj_file_dir "${generated_cpp_file_relative_path}" DIRECTORY)
|
||||||
|
qt_internal_install_pdb_files(${target}
|
||||||
|
- "${INSTALL_LIBDIR}/objects-$<CONFIG>/${target}/${rel_obj_file_dir}")
|
||||||
|
+ "${INSTALL_ARCHDATADIR}/objects-$<CONFIG>/${target}/${rel_obj_file_dir}")
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
--
|
||||||
|
2.40.1
|
@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/mkspecs/common/gcc-base.conf b/mkspecs/common/gcc-base.conf
|
||||||
|
index e7e6ee1..ff2a939 100644
|
||||||
|
--- a/mkspecs/common/gcc-base.conf
|
||||||
|
+++ b/mkspecs/common/gcc-base.conf
|
||||||
|
@@ -32,7 +32,7 @@
|
||||||
|
#
|
||||||
|
|
||||||
|
QMAKE_CFLAGS_OPTIMIZE = -O2
|
||||||
|
-QMAKE_CFLAGS_OPTIMIZE_FULL = -O3
|
||||||
|
+QMAKE_CFLAGS_OPTIMIZE_FULL = -O2
|
||||||
|
QMAKE_CFLAGS_OPTIMIZE_DEBUG = -Og
|
||||||
|
QMAKE_CFLAGS_OPTIMIZE_SIZE = -Os
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake
|
||||||
|
index 0bf250ea..2d1bb645 100644
|
||||||
|
--- a/src/gui/configure.cmake
|
||||||
|
+++ b/src/gui/configure.cmake
|
||||||
|
@@ -174,9 +174,9 @@ qt_config_compile_test(egl_x11
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
/* BEGIN TEST: */
|
||||||
|
-Display *dpy = EGL_DEFAULT_DISPLAY;
|
||||||
|
+Display *dpy = reinterpret_cast<Display *>(EGL_DEFAULT_DISPLAY);
|
||||||
|
EGLNativeDisplayType egldpy = XOpenDisplay(\"\");
|
||||||
|
-dpy = egldpy;
|
||||||
|
+dpy = reinterpret_cast<Display *>(egldpy);
|
||||||
|
EGLNativeWindowType w = XCreateWindow(dpy, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||||
|
XDestroyWindow(dpy, w);
|
||||||
|
XCloseDisplay(dpy);
|
@ -0,0 +1,16 @@
|
|||||||
|
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
|
||||||
|
index 1cb383c9..6bfdee55 100644
|
||||||
|
--- a/src/tools/moc/main.cpp
|
||||||
|
+++ b/src/tools/moc/main.cpp
|
||||||
|
@@ -230,6 +230,11 @@ int runMoc(int argc, char **argv)
|
||||||
|
Moc moc;
|
||||||
|
pp.macros["Q_MOC_RUN"];
|
||||||
|
pp.macros["__cplusplus"];
|
||||||
|
+ pp.macros["_SYS_SYSMACROS_H_OUTER"];
|
||||||
|
+ Macro macro;
|
||||||
|
+ macro.symbols = Preprocessor::tokenize(QByteArray::number(Q_PROCESSOR_WORDSIZE*8), 1, Preprocessor::TokenizeDefine);
|
||||||
|
+ macro.symbols.removeLast(); // remove the EOF symbol
|
||||||
|
+ pp.macros.insert("__WORDSIZE", macro);
|
||||||
|
|
||||||
|
// Don't stumble over GCC extensions
|
||||||
|
Macro dummyVariadicFunctionMacro;
|
@ -0,0 +1,12 @@
|
|||||||
|
diff -up qtbase-opensource-src-5.9.0/src/plugins/sqldrivers/mysql/qsql_mysql.cpp.than qtbase-opensource-src-5.9.0/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
|
||||||
|
diff -up qtbase-opensource-src-5.9.0/src/plugins/sqldrivers/mysql/qsql_mysql_p.h.than qtbase-opensource-src-5.9.0/src/plugins/sqldrivers/mysql/qsql_mysql_p.h
|
||||||
|
--- qtbase-opensource-src-5.9.0/src/plugins/sqldrivers/mysql/qsql_mysql_p.h.than 2017-07-14 13:43:50.831203768 +0200
|
||||||
|
+++ qtbase-opensource-src-5.9.0/src/plugins/sqldrivers/mysql/qsql_mysql_p.h 2017-07-14 13:44:24.364948006 +0200
|
||||||
|
@@ -58,6 +58,7 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <mysql.h>
|
||||||
|
+#include <mysql_version.h>
|
||||||
|
|
||||||
|
#ifdef QT_PLUGIN
|
||||||
|
#define Q_EXPORT_SQLDRIVER_MYSQL
|
@ -0,0 +1,310 @@
|
|||||||
|
From d0b4e8a601bc2f81ddb23c124acc99defa26c02f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Grulich <jgrulich@redhat.com>
|
||||||
|
Date: Fri, 22 Mar 2024 12:12:51 +0100
|
||||||
|
Subject: [PATCH] QGtk3Theme: Add support for xdg-desktop-portal to get color scheme
|
||||||
|
|
||||||
|
Use xdg-desktop-portal to get color scheme used by GNOME. Recent GNOME
|
||||||
|
versions use this as primary way to switch between light and dark theme.
|
||||||
|
Make this a preferred way to get color scheme and fallback to previous
|
||||||
|
methods in case xdg-desktop-portal cannot be used. Also update app theme
|
||||||
|
on runtime when color scheme changes, not only when theme is changed.
|
||||||
|
|
||||||
|
[ChangeLog][Platform Specific Changes][Linux] Add support for
|
||||||
|
xdg-desktop-portal to get color scheme in QGtk3Theme.
|
||||||
|
|
||||||
|
Fixes: QTBUG-116197
|
||||||
|
Change-Id: Ib3ffad405bc795ed6f4de4af411efc45721662b9
|
||||||
|
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
||||||
|
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
|
||||||
|
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
|
||||||
|
---
|
||||||
|
|
||||||
|
diff --git a/src/plugins/platformthemes/gtk3/CMakeLists.txt b/src/plugins/platformthemes/gtk3/CMakeLists.txt
|
||||||
|
index becfccc..6d3c7bf 100644
|
||||||
|
--- a/src/plugins/platformthemes/gtk3/CMakeLists.txt
|
||||||
|
+++ b/src/plugins/platformthemes/gtk3/CMakeLists.txt
|
||||||
|
@@ -35,6 +35,13 @@
|
||||||
|
Qt::GuiPrivate
|
||||||
|
)
|
||||||
|
|
||||||
|
+qt_internal_extend_target(QGtk3ThemePlugin CONDITION QT_FEATURE_dbus
|
||||||
|
+ SOURCES
|
||||||
|
+ qgtk3portalinterface.cpp
|
||||||
|
+ LIBRARIES
|
||||||
|
+ Qt::DBus
|
||||||
|
+)
|
||||||
|
+
|
||||||
|
qt_internal_extend_target(QGtk3ThemePlugin CONDITION QT_FEATURE_xlib
|
||||||
|
LIBRARIES
|
||||||
|
X11::X11
|
||||||
|
diff --git a/src/plugins/platformthemes/gtk3/qgtk3portalinterface.cpp b/src/plugins/platformthemes/gtk3/qgtk3portalinterface.cpp
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..1ffdda7
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/plugins/platformthemes/gtk3/qgtk3portalinterface.cpp
|
||||||
|
@@ -0,0 +1,123 @@
|
||||||
|
+// Copyright (C) 2024 The Qt Company Ltd.
|
||||||
|
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||||
|
+
|
||||||
|
+//
|
||||||
|
+// W A R N I N G
|
||||||
|
+// -------------
|
||||||
|
+//
|
||||||
|
+// This file is not part of the Qt API. It exists purely as an
|
||||||
|
+// implementation detail. This header file may change from version to
|
||||||
|
+// version without notice, or even be removed.
|
||||||
|
+//
|
||||||
|
+// We mean it.
|
||||||
|
+//
|
||||||
|
+
|
||||||
|
+#include "qgtk3portalinterface_p.h"
|
||||||
|
+#include "qgtk3storage_p.h"
|
||||||
|
+
|
||||||
|
+#include <QtDBus/QDBusArgument>
|
||||||
|
+#include <QtDBus/QDBusConnection>
|
||||||
|
+#include <QtDBus/QDBusMessage>
|
||||||
|
+#include <QtDBus/QDBusPendingCall>
|
||||||
|
+#include <QtDBus/QDBusPendingCallWatcher>
|
||||||
|
+#include <QtDBus/QDBusPendingReply>
|
||||||
|
+#include <QtDBus/QDBusVariant>
|
||||||
|
+#include <QtDBus/QtDBus>
|
||||||
|
+
|
||||||
|
+QT_BEGIN_NAMESPACE
|
||||||
|
+
|
||||||
|
+Q_LOGGING_CATEGORY(lcQGtk3PortalInterface, "qt.qpa.gtk");
|
||||||
|
+
|
||||||
|
+using namespace Qt::StringLiterals;
|
||||||
|
+
|
||||||
|
+static constexpr QLatin1StringView appearanceInterface("org.freedesktop.appearance");
|
||||||
|
+static constexpr QLatin1StringView colorSchemeKey("color-scheme");
|
||||||
|
+
|
||||||
|
+const QDBusArgument &operator>>(const QDBusArgument &argument, QMap<QString, QVariantMap> &map)
|
||||||
|
+{
|
||||||
|
+ argument.beginMap();
|
||||||
|
+ map.clear();
|
||||||
|
+
|
||||||
|
+ while (!argument.atEnd()) {
|
||||||
|
+ QString key;
|
||||||
|
+ QVariantMap value;
|
||||||
|
+ argument.beginMapEntry();
|
||||||
|
+ argument >> key >> value;
|
||||||
|
+ argument.endMapEntry();
|
||||||
|
+ map.insert(key, value);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ argument.endMap();
|
||||||
|
+ return argument;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+QGtk3PortalInterface::QGtk3PortalInterface(QGtk3Storage *s)
|
||||||
|
+ : m_storage(s) {
|
||||||
|
+ qRegisterMetaType<QDBusVariant>();
|
||||||
|
+ qDBusRegisterMetaType<QMap<QString, QVariantMap>>();
|
||||||
|
+
|
||||||
|
+ queryColorScheme();
|
||||||
|
+
|
||||||
|
+ if (!s) {
|
||||||
|
+ qCDebug(lcQGtk3PortalInterface) << "QGtk3PortalInterface instantiated without QGtk3Storage."
|
||||||
|
+ << "No reaction to runtime theme changes.";
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+Qt::ColorScheme QGtk3PortalInterface::colorScheme() const
|
||||||
|
+{
|
||||||
|
+ return m_colorScheme;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void QGtk3PortalInterface::queryColorScheme() {
|
||||||
|
+ QDBusConnection connection = QDBusConnection::sessionBus();
|
||||||
|
+ QDBusMessage message = QDBusMessage::createMethodCall(
|
||||||
|
+ "org.freedesktop.portal.Desktop"_L1,
|
||||||
|
+ "/org/freedesktop/portal/desktop"_L1,
|
||||||
|
+ "org.freedesktop.portal.Settings"_L1, "ReadAll"_L1);
|
||||||
|
+ message << QStringList{ appearanceInterface };
|
||||||
|
+
|
||||||
|
+ QDBusPendingCall pendingCall = connection.asyncCall(message);
|
||||||
|
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
|
||||||
|
+ QObject::connect(
|
||||||
|
+ watcher, &QDBusPendingCallWatcher::finished, this,
|
||||||
|
+ [this](QDBusPendingCallWatcher *watcher) {
|
||||||
|
+ QDBusPendingReply<QMap<QString, QVariantMap>> reply = *watcher;
|
||||||
|
+ if (reply.isValid()) {
|
||||||
|
+ QMap<QString, QVariantMap> settings = reply.value();
|
||||||
|
+ if (!settings.isEmpty()) {
|
||||||
|
+ settingChanged(appearanceInterface, colorSchemeKey,
|
||||||
|
+ QDBusVariant(settings.value(appearanceInterface).value(colorSchemeKey)));
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ qCDebug(lcQGtk3PortalInterface) << "Failed to query org.freedesktop.portal.Settings: "
|
||||||
|
+ << reply.error().message();
|
||||||
|
+ }
|
||||||
|
+ watcher->deleteLater();
|
||||||
|
+ });
|
||||||
|
+
|
||||||
|
+ QDBusConnection::sessionBus().connect(
|
||||||
|
+ "org.freedesktop.portal.Desktop"_L1, "/org/freedesktop/portal/desktop"_L1,
|
||||||
|
+ "org.freedesktop.portal.Settings"_L1, "SettingChanged"_L1, this,
|
||||||
|
+ SLOT(settingChanged(QString, QString, QDBusVariant)));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void QGtk3PortalInterface::settingChanged(const QString &group, const QString &key,
|
||||||
|
+ const QDBusVariant &value)
|
||||||
|
+{
|
||||||
|
+ if (group == appearanceInterface && key == colorSchemeKey) {
|
||||||
|
+ const uint colorScheme = value.variant().toUInt();
|
||||||
|
+ // From org.freedesktop.portal.Settings.xml
|
||||||
|
+ // "1" - Prefer dark appearance
|
||||||
|
+ Qt::ColorScheme newColorScheme = colorScheme == 1 ? Qt::ColorScheme::Dark : Qt::ColorScheme::Light;
|
||||||
|
+ if (m_colorScheme != newColorScheme) {
|
||||||
|
+ m_colorScheme = newColorScheme;
|
||||||
|
+ if (m_storage)
|
||||||
|
+ m_storage->handleThemeChange();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+QT_END_NAMESPACE
|
||||||
|
+
|
||||||
|
+#include "moc_qgtk3portalinterface_p.cpp"
|
||||||
|
diff --git a/src/plugins/platformthemes/gtk3/qgtk3portalinterface_p.h b/src/plugins/platformthemes/gtk3/qgtk3portalinterface_p.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..25a5f58
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/plugins/platformthemes/gtk3/qgtk3portalinterface_p.h
|
||||||
|
@@ -0,0 +1,49 @@
|
||||||
|
+// Copyright (C) 2024 The Qt Company Ltd.
|
||||||
|
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||||
|
+
|
||||||
|
+#ifndef QGTK3PORTALINTERFACE_H
|
||||||
|
+#define QGTK3PORTALINTERFACE_H
|
||||||
|
+
|
||||||
|
+//
|
||||||
|
+// W A R N I N G
|
||||||
|
+// -------------
|
||||||
|
+//
|
||||||
|
+// This file is not part of the Qt API. It exists purely as an
|
||||||
|
+// implementation detail. This header file may change from version to
|
||||||
|
+// version without notice, or even be removed.
|
||||||
|
+//
|
||||||
|
+// We mean it.
|
||||||
|
+//
|
||||||
|
+
|
||||||
|
+#include <QtCore/QObject>
|
||||||
|
+#include <QtCore/QLoggingCategory>
|
||||||
|
+
|
||||||
|
+QT_BEGIN_NAMESPACE
|
||||||
|
+
|
||||||
|
+class QDBusVariant;
|
||||||
|
+class QGtk3Storage;
|
||||||
|
+
|
||||||
|
+Q_DECLARE_LOGGING_CATEGORY(lcQGtk3PortalInterface);
|
||||||
|
+
|
||||||
|
+class QGtk3PortalInterface : public QObject
|
||||||
|
+{
|
||||||
|
+ Q_OBJECT
|
||||||
|
+public:
|
||||||
|
+ QGtk3PortalInterface(QGtk3Storage *s);
|
||||||
|
+ ~QGtk3PortalInterface() = default;
|
||||||
|
+
|
||||||
|
+ Qt::ColorScheme colorScheme() const;
|
||||||
|
+
|
||||||
|
+private Q_SLOTS:
|
||||||
|
+ void settingChanged(const QString &group, const QString &key,
|
||||||
|
+ const QDBusVariant &value);
|
||||||
|
+private:
|
||||||
|
+ void queryColorScheme();
|
||||||
|
+
|
||||||
|
+ Qt::ColorScheme m_colorScheme = Qt::ColorScheme::Unknown;
|
||||||
|
+ QGtk3Storage *m_storage = nullptr;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+QT_END_NAMESPACE
|
||||||
|
+
|
||||||
|
+#endif // QGTK3PORTALINTERFACE_H
|
||||||
|
diff --git a/src/plugins/platformthemes/gtk3/qgtk3storage.cpp b/src/plugins/platformthemes/gtk3/qgtk3storage.cpp
|
||||||
|
index 90c0282..2877b28 100644
|
||||||
|
--- a/src/plugins/platformthemes/gtk3/qgtk3storage.cpp
|
||||||
|
+++ b/src/plugins/platformthemes/gtk3/qgtk3storage.cpp
|
||||||
|
@@ -21,6 +21,9 @@
|
||||||
|
QGtk3Storage::QGtk3Storage()
|
||||||
|
{
|
||||||
|
m_interface.reset(new QGtk3Interface(this));
|
||||||
|
+#if QT_CONFIG(dbus)
|
||||||
|
+ m_portalInterface.reset(new QGtk3PortalInterface(this));
|
||||||
|
+#endif
|
||||||
|
populateMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -273,7 +276,6 @@
|
||||||
|
*/
|
||||||
|
void QGtk3Storage::handleThemeChange()
|
||||||
|
{
|
||||||
|
- clear();
|
||||||
|
populateMap();
|
||||||
|
QWindowSystemInterface::handleThemeChange();
|
||||||
|
}
|
||||||
|
@@ -331,21 +333,32 @@
|
||||||
|
static QString m_themeName;
|
||||||
|
|
||||||
|
// Distiguish initialization, theme change or call without theme change
|
||||||
|
+ Qt::ColorScheme newColorScheme = Qt::ColorScheme::Unknown;
|
||||||
|
const QString newThemeName = themeName();
|
||||||
|
- if (m_themeName == newThemeName)
|
||||||
|
+
|
||||||
|
+#if QT_CONFIG(dbus)
|
||||||
|
+ // Prefer color scheme we get from xdg-desktop-portal as this is what GNOME
|
||||||
|
+ // relies on these days
|
||||||
|
+ newColorScheme = m_portalInterface->colorScheme();
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ if (newColorScheme == Qt::ColorScheme::Unknown) {
|
||||||
|
+ // Derive color scheme from theme name
|
||||||
|
+ newColorScheme = newThemeName.contains("dark"_L1, Qt::CaseInsensitive)
|
||||||
|
+ ? Qt::ColorScheme::Dark : m_interface->colorSchemeByColors();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (m_themeName == newThemeName && m_colorScheme == newColorScheme)
|
||||||
|
return;
|
||||||
|
|
||||||
|
clear();
|
||||||
|
|
||||||
|
- // Derive color scheme from theme name
|
||||||
|
- m_colorScheme = newThemeName.contains("dark"_L1, Qt::CaseInsensitive)
|
||||||
|
- ? Qt::ColorScheme::Dark : m_interface->colorSchemeByColors();
|
||||||
|
-
|
||||||
|
if (m_themeName.isEmpty()) {
|
||||||
|
- qCDebug(lcQGtk3Interface) << "GTK theme initialized:" << newThemeName << m_colorScheme;
|
||||||
|
+ qCDebug(lcQGtk3Interface) << "GTK theme initialized:" << newThemeName << newColorScheme;
|
||||||
|
} else {
|
||||||
|
- qCDebug(lcQGtk3Interface) << "GTK theme changed to:" << newThemeName << m_colorScheme;
|
||||||
|
+ qCDebug(lcQGtk3Interface) << "GTK theme changed to:" << newThemeName << newColorScheme;
|
||||||
|
}
|
||||||
|
+ m_colorScheme = newColorScheme;
|
||||||
|
m_themeName = newThemeName;
|
||||||
|
|
||||||
|
// create standard mapping or load from Json file?
|
||||||
|
diff --git a/src/plugins/platformthemes/gtk3/qgtk3storage_p.h b/src/plugins/platformthemes/gtk3/qgtk3storage_p.h
|
||||||
|
index 37c5bf5..4519226 100644
|
||||||
|
--- a/src/plugins/platformthemes/gtk3/qgtk3storage_p.h
|
||||||
|
+++ b/src/plugins/platformthemes/gtk3/qgtk3storage_p.h
|
||||||
|
@@ -16,6 +16,9 @@
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "qgtk3interface_p.h"
|
||||||
|
+#if QT_CONFIG(dbus)
|
||||||
|
+#include "qgtk3portalinterface_p.h"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include <QtCore/QJsonDocument>
|
||||||
|
#include <QtCore/QCache>
|
||||||
|
@@ -205,7 +208,9 @@
|
||||||
|
PaletteMap m_palettes;
|
||||||
|
|
||||||
|
std::unique_ptr<QGtk3Interface> m_interface;
|
||||||
|
-
|
||||||
|
+#if QT_CONFIG(dbus)
|
||||||
|
+ std::unique_ptr<QGtk3PortalInterface> m_portalInterface;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
Qt::ColorScheme m_colorScheme = Qt::ColorScheme::Unknown;
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/cmake/QtFlagHandlingHelpers.cmake b/cmake/QtFlagHandlingHelpers.cmake
|
||||||
|
index 6a62b85c..1fc1f88d 100644
|
||||||
|
--- a/cmake/QtFlagHandlingHelpers.cmake
|
||||||
|
+++ b/cmake/QtFlagHandlingHelpers.cmake
|
||||||
|
@@ -71,7 +71,7 @@ function(qt_internal_add_linker_version_script target)
|
||||||
|
|
||||||
|
string(APPEND contents "\n};\nQt_${PROJECT_VERSION_MAJOR}")
|
||||||
|
if(QT_FEATURE_elf_private_full_version)
|
||||||
|
- string(APPEND contents ".${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||||
|
+ string(APPEND contents ".${PROJECT_VERSION_MINOR}")
|
||||||
|
endif()
|
||||||
|
string(APPEND contents "_PRIVATE_API { qt_private_api_tag*;\n")
|
||||||
|
if(arg_PRIVATE_HEADERS)
|
@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/src/corelib/global/qtversionchecks.h b/src/corelib/global/qtversionchecks.h
|
||||||
|
index d3b7a7b0..a8b9c6f3 100644
|
||||||
|
--- a/src/corelib/global/qtversionchecks.h
|
||||||
|
+++ b/src/corelib/global/qtversionchecks.h
|
||||||
|
@@ -26,7 +26,7 @@
|
||||||
|
/*
|
||||||
|
can be used like #if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
||||||
|
*/
|
||||||
|
-#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
|
||||||
|
+#define QT_VERSION_CHECK(qt_version_check_major, qt_version_check_minor, qt_version_check_patch) ((qt_version_check_major<<16)|(qt_version_check_minor<<8)|(qt_version_check_patch))
|
||||||
|
|
||||||
|
/*
|
||||||
|
Helper macros to make some simple code active in Qt 6 or Qt 7 only,
|
@ -0,0 +1,3 @@
|
|||||||
|
[Rules]
|
||||||
|
*.debug=false
|
||||||
|
qt.qpa.xcb.xcberror.warning=false
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue