genode/repos/libports/src/lib/qt5/patches/qtbase_genode.patch

655 lines
26 KiB
Diff

qtbase_genode.patch
Genode-specific adaptations
diff --git a/qtbase/src/corelib/codecs/qtextcodec.cpp b/qtbase/src/corelib/codecs/qtextcodec.cpp
index ffd8a2c..d40873a 100644
--- a/qtbase/src/corelib/codecs/qtextcodec.cpp
+++ b/qtbase/src/corelib/codecs/qtextcodec.cpp
@@ -208,7 +208,11 @@ static QTextCodec *setupLocaleMapper()
// First part is getting that locale name. First try setlocale() which
// definitely knows it, but since we cannot fully trust it, get ready
// to fall back to environment variables.
+#ifdef Q_OS_GENODE
+ const QByteArray ctype;
+#else
const QByteArray ctype = setlocale(LC_CTYPE, 0);
+#endif /* Q_OS_GENODE */
// Get the first nonempty value from $LC_ALL, $LC_CTYPE, and $LANG
// environment variables.
diff --git a/qtbase/src/corelib/global/qcompilerdetection.h b/qtbase/src/corelib/global/qcompilerdetection.h
index 345ab9e..ab6c275 100644
--- a/qtbase/src/corelib/global/qcompilerdetection.h
+++ b/qtbase/src/corelib/global/qcompilerdetection.h
@@ -881,7 +881,9 @@
# define Q_COMPILER_ALIGNAS
# define Q_COMPILER_ALIGNOF
# define Q_COMPILER_INHERITING_CONSTRUCTORS
-# define Q_COMPILER_THREAD_LOCAL
+# ifndef __GENODE__
+# define Q_COMPILER_THREAD_LOCAL
+# endif
# if Q_CC_GNU > 408 || __GNUC_PATCHLEVEL__ >= 1
# define Q_COMPILER_REF_QUALIFIERS
# endif
diff --git a/qtbase/src/corelib/global/qconfig.cpp b/qtbase/src/corelib/global/qconfig.cpp
index a123483..09b8a8e 100644
--- a/qtbase/src/corelib/global/qconfig.cpp
+++ b/qtbase/src/corelib/global/qconfig.cpp
@@ -1,10 +1,10 @@
/* Installation date */
static const char qt_configure_installation [12+11] = "qt_instdate=2012-12-20";
/* Installation Info */
-static const char qt_configure_prefix_path_str [12+256] = "qt_prfxpath=/usr/local/Qt-5.13.0";
+static const char qt_configure_prefix_path_str [12+256] = "qt_prfxpath=/qt";
#ifdef QT_BUILD_QMAKE
-static const char qt_configure_ext_prefix_path_str [12+256] = "qt_epfxpath=/usr/local/Qt-5.13.0";
-static const char qt_configure_host_prefix_path_str [12+256] = "qt_hpfxpath=/usr/local/Qt-5.13.0";
+static const char qt_configure_ext_prefix_path_str [12+256] = "qt_epfxpath=";
+static const char qt_configure_host_prefix_path_str [12+256] = "qt_hpfxpath=";
#endif
static const short qt_configure_str_offsets[] = {
0,
diff --git a/qtbase/src/corelib/global/qsystemdetection.h b/qtbase/src/corelib/global/qsystemdetection.h
index aabe46f..e262f2f 100644
--- a/qtbase/src/corelib/global/qsystemdetection.h
+++ b/qtbase/src/corelib/global/qsystemdetection.h
@@ -47,6 +47,7 @@
/*
The operating system, must be one of: (Q_OS_x)
+ GENODE - Genode
DARWIN - Any Darwin system (macOS, iOS, watchOS, tvOS)
MACOS - macOS
IOS - iOS
@@ -79,7 +80,9 @@
- Q_OS_FREEBSD_KERNEL is always defined on FreeBSD, even if the userland is from GNU
*/
-#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__))
+#if defined(__GENODE__)
+# define Q_OS_GENODE
+#elif defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__))
# include <TargetConditionals.h>
# if defined(TARGET_OS_MAC) && TARGET_OS_MAC
# define Q_OS_DARWIN
diff --git a/qtbase/src/corelib/global/qversiontagging.cpp b/qtbase/src/corelib/global/qversiontagging.cpp
index b5e524b..221c6a9 100644
--- a/qtbase/src/corelib/global/qversiontagging.cpp
+++ b/qtbase/src/corelib/global/qversiontagging.cpp
@@ -42,7 +42,7 @@
#define SYM QT_MANGLE_NAMESPACE(qt_version_tag)
//#define SSYM QT_STRINGIFY(SYM)
-#if defined(Q_CC_GNU) && defined(Q_OF_ELF) && !defined(Q_OS_ANDROID)
+#if defined(Q_CC_GNU) && defined(Q_OF_ELF) && !defined(Q_OS_ANDROID) && !defined(Q_OS_GENODE)
# define make_versioned_symbol2(sym, m, n, separator) \
Q_CORE_EXPORT extern const char sym ## _ ## m ## _ ## n = 0; \
asm(".symver " QT_STRINGIFY(sym) "_" QT_STRINGIFY(m) "_" QT_STRINGIFY(n) ", " \
diff --git a/qtbase/src/corelib/io/qresource.cpp b/qtbase/src/corelib/io/qresource.cpp
index e7d739b..225cda6 100644
--- a/qtbase/src/corelib/io/qresource.cpp
+++ b/qtbase/src/corelib/io/qresource.cpp
@@ -68,7 +68,7 @@
# include "private/qcore_unix_p.h"
#endif
-#if defined(Q_OS_UNIX) && !defined(Q_OS_NACL) && !defined(Q_OS_INTEGRITY)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_NACL) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_GENODE)
# define QT_USE_MMAP
# include <sys/mman.h>
#endif
diff --git a/qtbase/src/corelib/kernel/qcoreapplication.cpp b/qtbase/src/corelib/kernel/qcoreapplication.cpp
index 5c0bf93..254a4ae 100644
--- a/qtbase/src/corelib/kernel/qcoreapplication.cpp
+++ b/qtbase/src/corelib/kernel/qcoreapplication.cpp
@@ -612,7 +612,7 @@ void QCoreApplicationPrivate::initLocale()
if (qt_locale_initialized)
return;
qt_locale_initialized = true;
-#if defined(Q_OS_UNIX) && !defined(QT_BOOTSTRAPPED)
+#if defined(Q_OS_UNIX) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_GENODE)
setlocale(LC_ALL, "");
#endif
}
diff --git a/qtbase/src/corelib/kernel/qeventdispatcher_unix.cpp b/qtbase/src/corelib/kernel/qeventdispatcher_unix.cpp
index df0cac0..d349ff1 100644
--- a/qtbase/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/qtbase/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -73,6 +73,11 @@
# include <sys/times.h>
#endif
+#ifdef Q_OS_GENODE
+#include <timer_session/connection.h>
+#define perror Genode::error
+#endif /* Q_OS_GENODE */
+
QT_BEGIN_NAMESPACE
static const char *socketType(QSocketNotifier::Type type)
@@ -200,6 +205,8 @@ int QThreadPipe::check(const pollfd &pfd)
#if defined(Q_OS_VXWORKS)
::read(fds[0], c, sizeof(c));
::ioctl(fds[0], FIOFLUSH, 0);
+#elif defined(Q_OS_GENODE)
+ ::read(fds[0], c, sizeof(c)); // FIXME: the while loop only works in non-blocking mode
#else
# ifndef QT_NO_EVENTFD
if (fds[1] == -1) {
diff --git a/qtbase/src/corelib/kernel/qobject.h b/qtbase/src/corelib/kernel/qobject.h
index 63c5a9a..817d26b 100644
--- a/qtbase/src/corelib/kernel/qobject.h
+++ b/qtbase/src/corelib/kernel/qobject.h
@@ -414,7 +414,7 @@ public:
{ return const_cast<QObject *>(this)->qt_metacast(classname) != nullptr; }
public Q_SLOTS:
- void deleteLater();
+ virtual void deleteLater();
protected:
QObject *sender() const;
diff --git a/qtbase/src/corelib/kernel/qtranslator.cpp b/qtbase/src/corelib/kernel/qtranslator.cpp
index dc0ab9f..a69e088 100644
--- a/qtbase/src/corelib/kernel/qtranslator.cpp
+++ b/qtbase/src/corelib/kernel/qtranslator.cpp
@@ -58,7 +58,7 @@
#include "qendian.h"
#include "qresource.h"
-#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_GENODE)
#define QT_USE_MMAP
#include "private/qcore_unix_p.h"
// for mmap
diff --git a/qtbase/src/corelib/thread/qthread.cpp b/qtbase/src/corelib/thread/qthread.cpp
index 9f60de1..38bdb38 100644
--- a/qtbase/src/corelib/thread/qthread.cpp
+++ b/qtbase/src/corelib/thread/qthread.cpp
@@ -166,6 +166,10 @@ QThreadPrivate::QThreadPrivate(QThreadData *d)
stackSize(0), priority(QThread::InheritPriority), data(d)
{
+#ifdef Q_OS_GENODE
+ genode_thread = 0;
+#endif /* Q_OS_GENODE */
+
// INTEGRITY doesn't support self-extending stack. The default stack size for
// a pthread on INTEGRITY is too small so we have to increase the default size
// to 128K.
diff --git a/qtbase/src/corelib/thread/qthread_p.h b/qtbase/src/corelib/thread/qthread_p.h
index 57e6c99..fd038ec 100644
--- a/qtbase/src/corelib/thread/qthread_p.h
+++ b/qtbase/src/corelib/thread/qthread_p.h
@@ -53,6 +53,10 @@
//
//
+#ifdef Q_OS_GENODE
+#include <base/thread.h>
+#endif
+
#include "qplatformdefs.h"
#include "QtCore/qthread.h"
#include "QtCore/qmutex.h"
@@ -179,6 +183,58 @@ public:
static QThread *threadForId(int id);
#ifdef Q_OS_UNIX
+#ifdef Q_OS_GENODE
+
+ enum { DEFAULT_STACK_SIZE = 4096*100 };
+
+ class Genode_thread : public Genode::Thread
+ {
+ private:
+
+ /*
+ * The '_finished_lock' is necessary because 'QThreadPrivate::mutex'
+ * uses a 'Genode::Timed_semaphore' internally and it isn't safe
+ * to delete a Genode thread that just called 'Semaphore::up()',
+ * because the 'Semaphore::_meta_lock' could still be locked.
+ */
+ Genode::Lock _finished_lock;
+ QThread *_qthread;
+
+ public:
+
+ Genode_thread(Genode::Env &env, QThread *qthread)
+ : Genode::Thread(env, qthread->objectName().toLatin1().constData(), DEFAULT_STACK_SIZE),
+ _finished_lock(Genode::Lock::LOCKED),
+ _qthread(qthread) { }
+
+ virtual void entry()
+ {
+ QThreadPrivate::start(_qthread);
+ QThreadPrivate::finish(_qthread);
+ _finished_lock.unlock();
+ }
+
+ void join()
+ {
+ _finished_lock.lock();
+ }
+ };
+
+ Genode_thread *genode_thread;
+
+ struct tls_struct {
+ QThreadData *data;
+ bool termination_enabled;
+ };
+
+ static Genode::Env *_env;
+ static void env(Genode::Env &env) { _env = &env; }
+
+ static QHash<Qt::HANDLE, struct tls_struct> tls;
+
+ Qt::HANDLE thread_id;
+#endif // Q_OS_GENODE
+
QWaitCondition thread_done;
static void *start(void *arg);
diff --git a/qtbase/src/corelib/tools/qdatetime.cpp b/qtbase/src/corelib/tools/qdatetime.cpp
index 511dbf0..f1a7216 100644
--- a/qtbase/src/corelib/tools/qdatetime.cpp
+++ b/qtbase/src/corelib/tools/qdatetime.cpp
@@ -2197,6 +2197,9 @@ static int qt_timezone()
long offset;
_get_timezone(&offset);
return offset;
+#elif defined(Q_OS_GENODE)
+ /* no timezone support on Genode */
+ return 0;
#elif defined(Q_OS_BSD4) && !defined(Q_OS_DARWIN)
time_t clock = time(NULL);
struct tm t;
diff --git a/qtbase/src/gui/image/qxpmhandler.cpp b/qtbase/src/gui/image/qxpmhandler.cpp
index a32dfda..6f27cd2 100644
--- a/qtbase/src/gui/image/qxpmhandler.cpp
+++ b/qtbase/src/gui/image/qxpmhandler.cpp
@@ -845,8 +845,16 @@ static bool read_xpm_header(
#ifdef Q_CC_MSVC
if (sscanf_s(buf, "%d %d %d %d", w, h, ncols, cpp) < 4)
#else
+#ifdef Q_OS_GENODE
+ *w = QString(buf).section(" ", 0, 0, QString::SectionSkipEmpty).toInt();
+ *h = QString(buf).section(" ", 1, 1, QString::SectionSkipEmpty).toInt();
+ *ncols = QString(buf).section(" ", 2, 2, QString::SectionSkipEmpty).toInt();
+ *cpp = QString(buf).section(" ", 3, 3, QString::SectionSkipEmpty).toInt();
+ if (*w <= 0 || *h <= 0 || *ncols <= 0 || *cpp <= 0)
+#else
if (sscanf(buf, "%d %d %d %d", w, h, ncols, cpp) < 4)
#endif
+#endif
return false; // < 4 numbers parsed
if (*w <= 0 || *w > 32767 || *h <= 0 || *h > 32767 || *ncols <= 0 || *ncols > (64 * 64 * 64 * 64) || *cpp <= 0 || *cpp > 15)
diff --git a/qtbase/src/gui/painting/qbrush.cpp b/qtbase/src/gui/painting/qbrush.cpp
index f56be55..5998aa0 100644
--- a/qtbase/src/gui/painting/qbrush.cpp
+++ b/qtbase/src/gui/painting/qbrush.cpp
@@ -1402,7 +1402,12 @@ QGradient::QGradient(Preset preset)
}
QT_END_NAMESPACE
-static void initGradientPresets() { Q_INIT_RESOURCE(qmake_webgradients); }
+static void initGradientPresets()
+{
+#ifndef Q_OS_GENODE
+ Q_INIT_RESOURCE(qmake_webgradients);
+#endif
+}
Q_CONSTRUCTOR_FUNCTION(initGradientPresets);
QT_BEGIN_NAMESPACE
diff --git a/qtbase/src/gui/qtgui-config.h b/qtbase/src/gui/qtgui-config.h
index 7444e61..1ae740d 100644
--- a/qtbase/src/gui/qtgui-config.h
+++ b/qtbase/src/gui/qtgui-config.h
@@ -34,7 +34,7 @@
#define QT_FEATURE_openvg -1
#define QT_FEATURE_pdf 1
#define QT_FEATURE_picture 1
-#define QT_QPA_DEFAULT_PLATFORM_NAME "minimal"
+#define QT_QPA_DEFAULT_PLATFORM_NAME "nitpicker"
#define QT_FEATURE_sessionmanager -1
#define QT_NO_SESSIONMANAGER
#define QT_FEATURE_shortcut 1
diff --git a/qtbase/src/network/access/qhttpnetworkreply.cpp b/qtbase/src/network/access/qhttpnetworkreply.cpp
index c9c3172..ff53f70 100644
--- a/qtbase/src/network/access/qhttpnetworkreply.cpp
+++ b/qtbase/src/network/access/qhttpnetworkreply.cpp
@@ -249,8 +249,16 @@ void QHttpNetworkReply::setReadBufferSize(qint64 size)
bool QHttpNetworkReply::supportsUserProvidedDownloadBuffer()
{
+#ifdef Q_OS_GENODE
+ /*
+ * Without this change Arora shows garbage when loading, for example,
+ * www.genode.org
+ */
+ return false;
+#else
Q_D(QHttpNetworkReply);
return (!d->isChunked() && !d->autoDecompress && d->bodyLength > 0 && d->statusCode == 200);
+#endif
}
void QHttpNetworkReply::setUserProvidedDownloadBuffer(char* b)
diff --git a/qtbase/src/network/access/qnetworkaccessfilebackend.cpp b/qtbase/src/network/access/qnetworkaccessfilebackend.cpp
index 60353cb..5ecd1b7 100644
--- a/qtbase/src/network/access/qnetworkaccessfilebackend.cpp
+++ b/qtbase/src/network/access/qnetworkaccessfilebackend.cpp
@@ -127,6 +127,7 @@ void QNetworkAccessFileBackend::open()
url.setPath(QLatin1String("/"));
setUrl(url);
+#ifndef Q_OS_GENODE
QString fileName = url.toLocalFile();
if (fileName.isEmpty()) {
if (url.scheme() == QLatin1String("qrc")) {
@@ -140,6 +141,10 @@ void QNetworkAccessFileBackend::open()
fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery);
}
}
+#else
+ QString fileName = QLatin1String(":") + url.path();
+#endif
+
file.setFileName(fileName);
if (operation() == QNetworkAccessManager::GetOperation) {
diff --git a/qtbase/src/network/kernel/qhostinfo.cpp b/qtbase/src/network/kernel/qhostinfo.cpp
index 4b5acc1..1cb4e75 100644
--- a/qtbase/src/network/kernel/qhostinfo.cpp
+++ b/qtbase/src/network/kernel/qhostinfo.cpp
@@ -728,7 +728,12 @@ QHostInfoLookupManager::QHostInfoLookupManager() : mutex(QMutex::Recursive), was
moveToThread(QCoreApplicationPrivate::mainThread());
#if QT_CONFIG(thread)
connect(QCoreApplication::instance(), SIGNAL(destroyed()), SLOT(waitForThreadPoolDone()), Qt::DirectConnection);
+#ifdef Q_OS_GENODE
+ /* 'getaddrinfo()' is currently not thread-safe on Genode */
+ threadPool.setMaxThreadCount(1);
+#else
threadPool.setMaxThreadCount(20); // do up to 20 DNS lookups in parallel
+#endif /* Q_OS_GENODE */
#endif
}
diff --git a/qtbase/src/network/kernel/qhostinfo_unix.cpp b/qtbase/src/network/kernel/qhostinfo_unix.cpp
index e4810d6..fd1be48 100644
--- a/qtbase/src/network/kernel/qhostinfo_unix.cpp
+++ b/qtbase/src/network/kernel/qhostinfo_unix.cpp
@@ -221,7 +221,6 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
char hbuf[NI_MAXHOST];
if (sa && getnameinfo(sa, saSize, hbuf, sizeof(hbuf), 0, 0, 0) == 0)
results.setHostName(QString::fromLatin1(hbuf));
-
if (results.hostName().isEmpty())
results.setHostName(address.toString());
results.setAddresses(QList<QHostAddress>() << address);
diff --git a/qtbase/src/network/socket/qnativesocketengine_unix.cpp b/qtbase/src/network/socket/qnativesocketengine_unix.cpp
index 24c1712..2dffde6 100644
--- a/qtbase/src/network/socket/qnativesocketengine_unix.cpp
+++ b/qtbase/src/network/socket/qnativesocketengine_unix.cpp
@@ -472,6 +472,22 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16
case EISCONN:
socketState = QAbstractSocket::ConnectedState;
break;
+#ifdef Q_OS_GENODE
+ /* to have Arora get an error indication, socketState needs to change
+ * to "ConnectingState" before changing to "UnconnectedState" again
+ */
+ case ECONNABORTED:
+ if (socketState == QAbstractSocket::UnconnectedState) {
+ /* interpret ECONNABORTED as EINPROGRESS */
+ setError(QAbstractSocket::UnfinishedSocketOperationError, InvalidSocketErrorString);
+ socketState = QAbstractSocket::ConnectingState;
+ } else {
+ /* interpret ECONNABORTED as EHOSTUNREACH */
+ setError(QAbstractSocket::NetworkError, HostUnreachableErrorString);
+ socketState = QAbstractSocket::UnconnectedState;
+ }
+ break;
+#endif
case ECONNREFUSED:
case EINVAL:
setError(QAbstractSocket::ConnectionRefusedError, ConnectionRefusedErrorString);
diff --git a/qtbase/src/network/socket/qnet_unix_p.h b/qtbase/src/network/socket/qnet_unix_p.h
index e038352..94ed684 100644
--- a/qtbase/src/network/socket/qnet_unix_p.h
+++ b/qtbase/src/network/socket/qnet_unix_p.h
@@ -173,6 +173,10 @@ static inline int qt_safe_ioctl(int sockfd, unsigned long request, T arg)
static inline int qt_safe_sendmsg(int sockfd, const struct msghdr *msg, int flags)
{
+#ifdef Q_OS_GENODE
+ qWarning("qt_safe_sendmsg(): not implemented");
+ return -1;
+#else
#ifdef MSG_NOSIGNAL
flags |= MSG_NOSIGNAL;
#else
@@ -182,14 +186,20 @@ static inline int qt_safe_sendmsg(int sockfd, const struct msghdr *msg, int flag
int ret;
EINTR_LOOP(ret, ::sendmsg(sockfd, msg, flags));
return ret;
+#endif /* Q_OS_GENODE */
}
static inline int qt_safe_recvmsg(int sockfd, struct msghdr *msg, int flags)
{
+#ifdef Q_OS_GENODE
+ qWarning("qt_safe_recvmsg(): not implemented");
+ return -1;
+#else
int ret;
EINTR_LOOP(ret, ::recvmsg(sockfd, msg, flags));
return ret;
+#endif /* Q_OS_GENODE */
}
QT_END_NAMESPACE
diff --git a/qtbase/src/network/ssl/qsslconfiguration_p.h b/qtbase/src/network/ssl/qsslconfiguration_p.h
index 83126bb..7cd978b 100644
--- a/qtbase/src/network/ssl/qsslconfiguration_p.h
+++ b/qtbase/src/network/ssl/qsslconfiguration_p.h
@@ -85,7 +85,16 @@ public:
QSslConfigurationPrivate()
: sessionProtocol(QSsl::UnknownProtocol),
protocol(QSsl::SecureProtocols),
+#ifdef Q_OS_GENODE
+ /*
+ * With enabled peer verification, currently often a 'handshake error'
+ * occurs. This patch disables the peer verification until a fix for
+ * the handshake problem has been found.
+ */
+ peerVerifyMode(QSslSocket::VerifyNone),
+#else
peerVerifyMode(QSslSocket::AutoVerifyPeer),
+#endif
peerVerifyDepth(0),
allowRootCertOnDemandLoading(true),
peerSessionShared(false),
diff --git a/qtbase/src/network/ssl/qsslsocket_opensslpre11.cpp b/qtbase/src/network/ssl/qsslsocket_opensslpre11.cpp
index f5aab82..f84baaa 100644
--- a/qtbase/src/network/ssl/qsslsocket_opensslpre11.cpp
+++ b/qtbase/src/network/ssl/qsslsocket_opensslpre11.cpp
@@ -221,7 +221,10 @@ bool QSslSocketPrivate::ensureLibraryLoaded()
if (q_SSL_library_init() != 1)
return false;
q_SSL_load_error_strings();
+#ifndef Q_OS_GENODE
+ /* FIXME: currently, on Genode this function causes 'exit(1)' */
q_OpenSSL_add_all_algorithms_safe();
+#endif
#if OPENSSL_VERSION_NUMBER >= 0x10001000L
if (q_SSLeay() >= 0x10001000L)
diff --git a/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h b/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h
index 17bf0fb..2908374 100644
--- a/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h
+++ b/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h
@@ -55,7 +55,9 @@
#ifdef Q_OS_FREEBSD
#include <dev/evdev/input.h>
#else
+#ifndef Q_OS_GENODE
#include "linux/input.h"
+#endif /* Q_OS_GENODE */
#endif
// no QT_BEGIN_NAMESPACE, since we include it internally...
@@ -648,6 +650,7 @@ const QEvdevKeyboardMap::Mapping QEvdevKeyboardHandler::s_keymap_default[] = {
{ 111, 0xffff, 0x01000000, 0x06, 0x08, 0x0200 },
{ 111, 0xffff, 0x01000000, 0x0c, 0x08, 0x0200 },
+#ifndef Q_OS_GENODE
// 113 -> 248
{ KEY_MUTE, 0xffff, Qt::Key_VolumeMute, 0x00, 0x00, 0x0000 },
{ KEY_VOLUMEDOWN, 0xffff, Qt::Key_VolumeDown, 0x00, 0x00, 0x0000 },
@@ -676,6 +679,7 @@ const QEvdevKeyboardMap::Mapping QEvdevKeyboardHandler::s_keymap_default[] = {
{ KEY_BLUE, 0xffff, Qt::Key_Blue, 0x00, 0x00, 0x0000 },
{ KEY_CHANNELUP, 0xffff, Qt::Key_ChannelUp, 0x00, 0x00, 0x0000 },
{ KEY_CHANNELDOWN, 0xffff, Qt::Key_ChannelDown, 0x00, 0x00, 0x0000 },
+#endif /* Q_OS_GENODE */
};
const QEvdevKeyboardMap::Composing QEvdevKeyboardHandler::s_keycompose_default[] = {
diff --git a/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
index 666613f..e99bf58 100644
--- a/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+++ b/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
@@ -55,7 +55,9 @@
#ifdef Q_OS_FREEBSD
#include <dev/evdev/input.h>
#else
+#ifndef Q_OS_GENODE
#include <linux/input.h>
+#endif /* Q_OS_GENODE */
#endif
QT_BEGIN_NAMESPACE
@@ -88,9 +90,11 @@ QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, QFdContainer
if (keymapFile.isEmpty() || !loadKeymap(keymapFile))
unloadKeymap();
+#ifndef Q_OS_GENODE
// socket notifier for events on the keyboard device
m_notify = new QSocketNotifier(m_fd.get(), QSocketNotifier::Read, this);
connect(m_notify, &QSocketNotifier::activated, this, &QEvdevKeyboardHandler::readKeycode);
+#endif /* Q_OS_GENODE */
}
QEvdevKeyboardHandler::~QEvdevKeyboardHandler()
@@ -98,6 +102,7 @@ QEvdevKeyboardHandler::~QEvdevKeyboardHandler()
unloadKeymap();
}
+#ifndef Q_OS_GENODE
QEvdevKeyboardHandler *QEvdevKeyboardHandler::create(const QString &device,
const QString &specification,
const QString &defaultKeymapFile)
@@ -221,10 +226,21 @@ void QEvdevKeyboardHandler::readKeycode()
}
}
}
+#endif /* Q_OS_GENODE */
void QEvdevKeyboardHandler::processKeyEvent(int nativecode, int unicode, int qtcode,
Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat)
{
+#ifdef Q_OS_GENODE
+ /* characters are handled separately by the QPA plugin */
+ unicode = 0xffff;
+
+ /* Ctrl-A .. Ctrl-Z is handled separately by the QPA plugin */
+ if ((modifiers & Qt::ControlModifier) &&
+ ((qtcode >= Qt::Key_A) && (qtcode <= Qt::Key_Z)))
+ return;
+#endif
+
if (!autoRepeat)
QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(QEvdevKeyboardHandler::toQtModifiers(m_modifiers));
@@ -491,6 +507,7 @@ void QEvdevKeyboardHandler::unloadKeymap()
m_composing = 0;
m_dead_unicode = 0xffff;
+#ifndef Q_OS_GENODE
//Set locks according to keyboard leds
quint16 ledbits[1];
memset(ledbits, 0, sizeof(ledbits));
@@ -513,6 +530,7 @@ void QEvdevKeyboardHandler::unloadKeymap()
}
m_langLock = 0;
+#endif /* Q_OS_GENODE */
}
bool QEvdevKeyboardHandler::loadKeymap(const QString &file)
diff --git a/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h b/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
index 21e6d05..b3f18b0 100644
--- a/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
+++ b/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
@@ -189,7 +189,10 @@ public:
bool loadKeymap(const QString &file);
void unloadKeymap();
+#ifndef Q_OS_GENODE
+private slots:
void readKeycode();
+#endif /* Q_OS_GENODE */
KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat);
void switchLang();
diff --git a/qtbase/src/testlib/qtestcase.cpp b/qtbase/src/testlib/qtestcase.cpp
index 1f69429..938990f 100644
--- a/qtbase/src/testlib/qtestcase.cpp
+++ b/qtbase/src/testlib/qtestcase.cpp
@@ -1554,7 +1554,7 @@ FatalSignalHandler::FatalSignalHandler()
// tvOS/watchOS both define SA_ONSTACK (in sys/signal.h) but mark sigaltstack() as
// unavailable (__WATCHOS_PROHIBITED __TVOS_PROHIBITED in signal.h)
-#if defined(SA_ONSTACK) && !defined(Q_OS_TVOS) && !defined(Q_OS_WATCHOS)
+#if defined(SA_ONSTACK) && !defined(Q_OS_TVOS) && !defined(Q_OS_WATCHOS) && !defined(Q_OS_GENODE)
// Let the signal handlers use an alternate stack
// This is necessary if SIGSEGV is to catch a stack overflow
# if defined(Q_CC_GNU) && defined(Q_OF_ELF)
diff --git a/qtbase/src/widgets/dialogs/qfiledialog.cpp b/qtbase/src/widgets/dialogs/qfiledialog.cpp
index f772eb1..9844056 100644
--- a/qtbase/src/widgets/dialogs/qfiledialog.cpp
+++ b/qtbase/src/widgets/dialogs/qfiledialog.cpp
@@ -1146,7 +1146,7 @@ Q_AUTOTEST_EXPORT QString qt_tildeExpansion(const QString &path)
const QString homePath = QDir::homePath();
#else
const QByteArray userName = path.midRef(1, separatorPosition - 1).toLocal8Bit();
-# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_WASM)
+# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_WASM) && !defined(Q_OS_GENODE)
passwd pw;
passwd *tmpPw;
char buf[200];
diff --git a/qtbase/src/widgets/styles/qstylefactory.cpp b/qtbase/src/widgets/styles/qstylefactory.cpp
index b0ce5e5..fe0366b 100644
--- a/qtbase/src/widgets/styles/qstylefactory.cpp
+++ b/qtbase/src/widgets/styles/qstylefactory.cpp
@@ -123,6 +123,13 @@ QStringList QStyleFactory::keys()
const PluginKeyMap::const_iterator cend = keyMap.constEnd();
for (PluginKeyMap::const_iterator it = keyMap.constBegin(); it != cend; ++it)
list.append(it.value());
+#ifdef Q_OS_GENODE
+/* on Genode, the first style in the list gets selected by default and we want the "Fusion" style */
+#if QT_CONFIG(style_fusion)
+ if (!list.contains(QLatin1String("Fusion")))
+ list << QLatin1String("Fusion");
+#endif
+#endif
#if QT_CONFIG(style_windows)
if (!list.contains(QLatin1String("Windows")))
list << QLatin1String("Windows");