Compare commits

..

6 Commits
master ... f22

Author SHA1 Message Date
Rex Dieter 04661b7de7 Item views don't handle insert/remove of rows robustly (QTBUG-48870) 2016-02-24 22:04:57 -06:00
Than Ngo f1a8d41bb2 enable -qt-xcb to fix non-US keys under VNC (#1295713) 2016-01-15 17:27:47 +01:00
Rex Dieter 73aff94c60 Release++ 2016-01-05 17:09:14 -06:00
Rex Dieter 9f91c6fd2e Crash in QXcbWindow::setParent() due to NULL xcbScreen (QTBUG-50081, #1291003) 2016-01-05 17:08:50 -06:00
Jan Grulich 1c75053c8f QLineEdit - fix visibility of side widgets
QTBUG:4246
2016-01-05 13:33:48 +01:00
Rex Dieter 21748c29f1 qt-5.5 segfault on QFileDialog without parent (#1291003) 2015-12-31 10:34:51 -06:00
40 changed files with 2202 additions and 1468 deletions

10
.gitignore vendored
View File

@ -1,6 +1,4 @@
/qtbase-everywhere-src-5.12.1.tar.xz
/qtbase-everywhere-src-5.12.3.tar.xz
/qtbase-everywhere-src-5.12.4.tar.xz
/qtbase-everywhere-src-5.12.5.tar.xz
/qtbase-everywhere-src-5.13.2.tar.xz
/qtbase-everywhere-src-5.14.2.tar.xz
/qtbase-opensource-src-5.4.2.tar.xz
/qtbase-opensource-src-5.5.0.tar.xz
/qtbase-opensource-src-5.5.1-rc1.tar.xz
/qtbase-opensource-src-5.5.1.tar.xz

View File

@ -0,0 +1,47 @@
From 0cfdfcc82ec58b2016f4ab2973343eb85874f27d Mon Sep 17 00:00:00 2001
From: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
Date: Sun, 11 Oct 2015 15:27:37 +0200
Subject: [PATCH 2/3] QListView: Use correct available size when calculating
scrollbars.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Calculation was working as long as one didn't use per pixel scrolling.
Task-number: QTBUG-48579
Change-Id: Ie02e28b008c5c81ed45d7dd17fed96148c23b598
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: David Faure <david.faure@kdab.com>
---
src/widgets/itemviews/qlistview.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index f3fd3e7..8257944 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -1846,8 +1846,7 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
- const QSize viewportSize(viewport()->width() + (qq->verticalScrollBar()->maximum() > 0 ? qq->verticalScrollBar()->width() : 0),
- viewport()->height() + (qq->horizontalScrollBar()->maximum() > 0 ? qq->horizontalScrollBar()->height() : 0));
+ const QSize viewportSize = qq->contentsRect().size();
bool verticalWantsToShow = contentsSize.height() > viewportSize.height();
bool horizontalWantsToShow;
@@ -1877,8 +1876,7 @@ void QCommonListViewBase::updateVerticalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
- const QSize viewportSize(viewport()->width() + (qq->verticalScrollBar()->maximum() > 0 ? qq->verticalScrollBar()->width() : 0),
- viewport()->height() + (qq->horizontalScrollBar()->maximum() > 0 ? qq->horizontalScrollBar()->height() : 0));
+ const QSize viewportSize = qq->contentsRect().size();
bool horizontalWantsToShow = contentsSize.width() > viewportSize.width();
bool verticalWantsToShow;
--
2.5.0

View File

@ -0,0 +1,32 @@
From a3b8e355fc17783a5d4badfb9ad50247655000cd Mon Sep 17 00:00:00 2001
From: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Date: Fri, 12 Feb 2016 15:31:07 +0300
Subject: [PATCH 3/3] QListView: fix skipping indexes in selectedIndexes().
Remove spurious increment of i.
Task-number: QTBUG-51086
Change-Id: I4307a6728de1e7f25c8afa31fe2066f92373f3fc
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
---
src/widgets/itemviews/qlistview.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 9c79509..a17d89e 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -1437,7 +1437,7 @@ QModelIndexList QListView::selectedIndexes() const
return QModelIndexList();
QModelIndexList viewSelected = d->selectionModel->selectedIndexes();
- for (int i = 0; i < viewSelected.count(); ++i) {
+ for (int i = 0; i < viewSelected.count();) {
const QModelIndex &index = viewSelected.at(i);
if (!isIndexHidden(index) && index.parent() == d->root && index.column() == d->column)
++i;
--
2.5.0

View File

@ -1,109 +0,0 @@
From 276fa8383a7535765be7182883ef4aade17ce013 Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@intel.com>
Date: Thu, 2 Apr 2020 12:08:41 -0300
Subject: [PATCH 44/49] QLibrary: fix deadlock caused by fix to QTBUG-39642
Commit ae6f73e8566fa76470937aca737141183929a5ec inserted a mutex around
the entire load_sys(). We had reasoed that deadlocks would only occur if
the object creation in instance() recursed into its own instance(),
which was already a bug. But we had forgotten that dlopen()/
LoadLibrary() executes initialization code from the module being loaded,
which could cause a recursion back into the same QPluginLoader or
QLibrary object. This recursion is benign because the module *is* loaded
and dlopen()/LoadLibrary() returns the same handle.
[ChangeLog][QtCore][QLibrary and QPluginLoader] Fixed a deadlock that
would happen if the plugin or library being loaded has load-time
initialization code (C++ global variables) that recursed back into the
same QLibrary or QPluginLoader object.
PS: QLibraryPrivate::loadPlugin() updates pluginState outside a mutex
lock, so pluginState should be made an atomic variable. Once that is
done, we'll only need locking the mutex to update errorString (no
locking before loading).
Fixes: QTBUG-83207
Task-number: QTBUG-39642
Change-Id: Ibdc95e9af7bd456a94ecfffd160209304e5ab2eb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
---
src/corelib/plugin/qlibrary.cpp | 2 --
src/corelib/plugin/qlibrary_unix.cpp | 4 ++++
src/corelib/plugin/qlibrary_win.cpp | 3 +++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index ddb053c26f..be9d92b204 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -576,9 +576,7 @@ bool QLibraryPrivate::load()
Q_TRACE(QLibraryPrivate_load_entry, fileName);
- mutex.lock();
bool ret = load_sys();
- mutex.unlock();
if (qt_debug_component()) {
if (ret) {
qDebug() << "loaded library" << fileName;
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index 017aa97b66..a5c72f81d9 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -123,6 +123,7 @@ QStringList QLibraryPrivate::prefixes_sys()
bool QLibraryPrivate::load_sys()
{
+ QMutexLocker locker(&mutex);
QString attempt;
QFileSystemEntry fsEntry(fileName);
@@ -213,6 +214,7 @@ bool QLibraryPrivate::load_sys()
}
#endif
+ locker.unlock();
bool retry = true;
Handle hnd = nullptr;
for (int prefix = 0; retry && !hnd && prefix < prefixes.size(); prefix++) {
@@ -273,6 +275,8 @@ bool QLibraryPrivate::load_sys()
}
}
#endif
+
+ locker.relock();
if (!hnd) {
errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName, qdlerror());
}
diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp
index 000bf76276..ef58724be8 100644
--- a/src/corelib/plugin/qlibrary_win.cpp
+++ b/src/corelib/plugin/qlibrary_win.cpp
@@ -78,6 +78,7 @@ bool QLibraryPrivate::load_sys()
// fileName
//
// NB If it's a plugin we do not ever try the ".dll" extension
+ QMutexLocker locker(&mutex);
QStringList attempts;
if (pluginState != IsAPlugin)
@@ -95,6 +96,7 @@ bool QLibraryPrivate::load_sys()
attempts.prepend(QDir::rootPath() + fileName);
#endif
+ locker.unlock();
Handle hnd = nullptr;
for (const QString &attempt : qAsConst(attempts)) {
#ifndef Q_OS_WINRT
@@ -115,6 +117,7 @@ bool QLibraryPrivate::load_sys()
#ifndef Q_OS_WINRT
SetErrorMode(oldmode);
#endif
+ locker.relock();
if (!hnd) {
errorString = QLibrary::tr("Cannot load library %1: %2").arg(
QDir::toNativeSeparators(fileName), qt_error_string());
--
2.25.2

View File

@ -0,0 +1,44 @@
From eaa3a9d0108cdf692f1686cafefb7b834f0e5af6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= <spaz16@wp.pl>
Date: Fri, 1 Jan 2016 20:02:42 +0100
Subject: [PATCH 84/87] Fix crash because of NULL screen in QXcbWindow
Change-Id: If7bbe3ad1656dadcb098bcd3ece2e7b064eeb44d
Task-number: QTBUG-50081
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
---
src/gui/kernel/qwindow.cpp | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index e728d32..83e8777 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -609,18 +609,16 @@ void QWindow::setParent(QWindow *parent)
}
QObject::setParent(parent);
- if (parent)
+
+ QPlatformWindow *parentPlatformWindow = parent ? parent->d_func()->platformWindow : Q_NULLPTR;
+
+ if (parentPlatformWindow)
d->disconnectFromScreen();
else
d->connectToScreen(newScreen);
- if (d->platformWindow) {
- if (parent && parent->d_func()->platformWindow) {
- d->platformWindow->setParent(parent->d_func()->platformWindow);
- } else {
- d->platformWindow->setParent(0);
- }
- }
+ if (d->platformWindow)
+ d->platformWindow->setParent(parentPlatformWindow);
d->parentWindow = parent;
--
2.5.0

View File

@ -0,0 +1,56 @@
From ae51e360f986698eaf41fdb38f8a878a50f69be1 Mon Sep 17 00:00:00 2001
From: Alexander Volkov <a.volkov@rusbitech.ru>
Date: Fri, 19 Jun 2015 13:34:11 +0300
Subject: [PATCH 197/412] xcb: Ignore disabling of outputs in the middle of the
mode switch
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X server may send RROutputChangeNotify event with null crtc and mode,
when it switches an output mode. Request RROutputInfo to distinguish
this case from the case when the output is explicitly disabled.
Change-Id: I4c2356ec71dbcc8013009ea8a6f46dd11f19d6bb
Task-number: QTBUG-44158
Task-number: QTBUG-46786
Task-number: QTBUG-46822
Reviewed-by: Daniel Vrátil <dvratil@redhat.com>
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
---
src/plugins/platforms/xcb/qxcbconnection.cpp | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 0867615..29e1fd1 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -265,11 +265,19 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
} else if (screen) {
// Screen has been disabled -> remove
if (output.crtc == XCB_NONE && output.mode == XCB_NONE) {
- qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled";
- m_screens.removeOne(screen);
- foreach (QXcbScreen *otherScreen, m_screens)
- otherScreen->removeVirtualSibling((QPlatformScreen *) screen);
- QXcbIntegration::instance()->destroyScreen(screen);
+ xcb_randr_get_output_info_cookie_t outputInfoCookie =
+ xcb_randr_get_output_info(xcb_connection(), output.output, output.config_timestamp);
+ QScopedPointer<xcb_randr_get_output_info_reply_t, QScopedPointerPodDeleter> outputInfo(
+ xcb_randr_get_output_info_reply(xcb_connection(), outputInfoCookie, NULL));
+ if (outputInfo->crtc == XCB_NONE) {
+ qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled";
+ m_screens.removeOne(screen);
+ foreach (QXcbScreen *otherScreen, m_screens)
+ otherScreen->removeVirtualSibling((QPlatformScreen *) screen);
+ QXcbIntegration::instance()->destroyScreen(screen);
+ } else {
+ qCDebug(lcQpaScreen) << "output" << screen->name() << "has been temporarily disabled for the mode switch";
+ }
} else {
// Just update existing screen
screen->updateGeometry(output.config_timestamp);
--
2.5.0

View File

@ -1,14 +1,6 @@
#!/bin/bash
if [ -z "$QT_XCB_FORCE_SOFTWARE_OPENGL" ]; then
QT5_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 [ "$QT5_CHECK_OPENGL_VERSION" == "1" ]; then
#!/bin/sh
OPENGL_VERSION=`LANG=C glxinfo | grep '^OpenGL version string: ' | head -n 1 | sed -e 's/^OpenGL version string: \([0-9]\).*$/\1/g'`
if [ "$OPENGL_VERSION" -lt 2 ]; then
QT_XCB_FORCE_SOFTWARE_OPENGL=1
export QT_XCB_FORCE_SOFTWARE_OPENGL
fi
unset QT5_CHECK_OPENGL_VERSION
fi

369
138201.patch Normal file
View File

@ -0,0 +1,369 @@
diff -rupN qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/qxcbconnection.cpp qtbase-opensource-src-5.5.1-new/src/plugins/platforms/xcb/qxcbconnection.cpp
--- qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/qxcbconnection.cpp 2015-10-13 06:35:27.000000000 +0200
+++ qtbase-opensource-src-5.5.1-new/src/plugins/platforms/xcb/qxcbconnection.cpp 2015-10-21 21:02:53.056198256 +0200
@@ -242,20 +241,18 @@ void QXcbConnection::updateScreens(const
if (screen && output.connection == XCB_RANDR_CONNECTION_DISCONNECTED) {
qCDebug(lcQpaScreen) << "screen" << screen->name() << "has been disconnected";
-
- // Known screen removed -> delete it
- m_screens.removeOne(screen);
- foreach (QXcbScreen *otherScreen, m_screens)
- otherScreen->removeVirtualSibling((QPlatformScreen *) screen);
-
- QXcbIntegration::instance()->destroyScreen(screen);
-
- // QTBUG-40174, QTBUG-42985: If all screens are removed, wait
- // and start rendering again later if a screen becomes available.
-
+ destroyScreen(screen, true);
} else if (!screen && output.connection == XCB_RANDR_CONNECTION_CONNECTED) {
// New XRandR output is available and it's enabled
if (output.crtc != XCB_NONE && output.mode != XCB_NONE) {
+ // QTBUG-40174, QTBUG-42985: If virtual screen exists,
+ // remove it and next add a physical screen.
+ if (m_onlyVirtualScreen) {
+ qCDebug(lcQpaScreen) << "default screen" << screen->name() << "has been removed";
+ destroyScreen(m_screens.at(0), false);
+ m_onlyVirtualScreen = false;
+ }
+
xcb_randr_get_output_info_cookie_t outputInfoCookie =
xcb_randr_get_output_info(xcb_connection(), output.output, output.config_timestamp);
QScopedPointer<xcb_randr_get_output_info_reply_t, QScopedPointerPodDeleter> outputInfo(
@@ -270,34 +267,25 @@ void QXcbConnection::updateScreens(const
otherScreen->addVirtualSibling(screen);
m_screens << screen;
QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary());
-
- // Windows which had null screens have already had expose events by now.
- // They need to be told the screen is back, it's OK to render.
- foreach (QWindow *window, QGuiApplication::topLevelWindows()) {
- QXcbWindow *xcbWin = static_cast<QXcbWindow*>(window->handle());
- if (xcbWin)
- xcbWin->maybeSetScreen(screen);
- }
+ maybeSetScreenForTopLevelWindows(screen);
}
- // else ignore disabled screens
} else if (screen) {
- // Screen has been disabled -> remove
if (output.crtc == XCB_NONE && output.mode == XCB_NONE) {
+ // Screen has been disabled
xcb_randr_get_output_info_cookie_t outputInfoCookie =
xcb_randr_get_output_info(xcb_connection(), output.output, output.config_timestamp);
QScopedPointer<xcb_randr_get_output_info_reply_t, QScopedPointerPodDeleter> outputInfo(
xcb_randr_get_output_info_reply(xcb_connection(), outputInfoCookie, NULL));
if (outputInfo->crtc == XCB_NONE) {
qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled";
- m_screens.removeOne(screen);
- foreach (QXcbScreen *otherScreen, m_screens)
- otherScreen->removeVirtualSibling((QPlatformScreen *) screen);
- QXcbIntegration::instance()->destroyScreen(screen);
+ destroyScreen(screen, true);
} else {
qCDebug(lcQpaScreen) << "output" << screen->name() << "has been temporarily disabled for the mode switch";
+ screen->setCrtc(XCB_NONE); //Invalidate crtc
}
} else {
// Just update existing screen
+ screen->setCrtc(output.crtc); //Set the new crtc, because it may be invalidated
screen->updateGeometry(output.config_timestamp);
const bool wasPrimary = screen->isPrimary();
screen->setPrimary(checkOutputIsPrimary(output.window, output.output));
@@ -316,19 +304,61 @@ void QXcbConnection::updateScreens(const
qCDebug(lcQpaScreen) << "output has changed" << screen;
}
}
+
if (!m_screens.isEmpty())
qCDebug(lcQpaScreen) << "primary output is" << m_screens.first()->name();
else
qCDebug(lcQpaScreen) << "no outputs";
}
}
+void QXcbConnection::destroyScreen(QXcbScreen *screen, bool canCreateVirtualScreen)
+{
+ // Known screen removed -> delete it
+ m_screens.removeOne(screen);
+ foreach (QXcbScreen *otherScreen, m_screens)
+ otherScreen->removeVirtualSibling((QPlatformScreen *)screen);
+ QXcbIntegration::instance()->destroyScreen(screen);
+
+ // QTBUG-40174, QTBUG-42985: If all screens are removed, add a virtual
+ // screen and remove it later if a physical screen becomes available.
+ if (canCreateVirtualScreen && m_screens.isEmpty())
+ createVirtualScreen();
+}
+void QXcbConnection::createVirtualScreen()
+{
+ QXcbVirtualDesktop *virtualDesktop = m_virtualDesktops.value(0);
+ if (virtualDesktop && !virtualDesktop->size().isEmpty()) {
+ Q_ASSERT(m_screens.isEmpty());
+ QXcbScreen *screen = createScreen(virtualDesktop, 0, Q_NULLPTR);
+ screen->setVirtualSiblings(QList<QPlatformScreen *>() << screen);
+ screen->setPrimary(true);
+ m_onlyVirtualScreen = true;
+ m_screens << screen;
+ QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary());
+ maybeSetScreenForTopLevelWindows(screen);
+ qCDebug(lcQpaScreen) << "virtual screen was created" << screen;
+ }
+}
+void QXcbConnection::maybeSetScreenForTopLevelWindows(QXcbScreen *screen)
+{
+ // Windows which had null screens have already had expose events by now.
+ // They need to be told the screen is back, it's OK to render.
+ bool doFlush = false;
+ foreach (QWindow *window, QGuiApplication::topLevelWindows()) {
+ QXcbWindow *xcbWin = static_cast<QXcbWindow*>(window->handle());
+ if (xcbWin)
+ doFlush |= xcbWin->maybeSetScreen(screen);
+ }
+ // Flush Window System Events to prevent disappearing windows
+ if (doFlush)
+ QWindowSystemInterface::flushWindowSystemEvents();
+}
void QXcbConnection::initializeScreens()
{
xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup);
int xcbScreenNumber = 0; // screen number in the xcb sense
QXcbScreen* primaryScreen = Q_NULLPTR;
- bool hasOutputs = false;
while (it.rem) {
// Each "screen" in xcb terminology is a virtual desktop,
// potentially a collection of separate juxtaposed monitors.
@@ -407,7 +437,6 @@ void QXcbConnection::initializeScreens()
QXcbScreen *screen = createScreen(virtualDesktop, outputs[i], output.data());
siblings << screen;
- hasOutputs = true;
m_screens << screen;
// There can be multiple outputs per screen, use either
@@ -434,39 +463,23 @@ void QXcbConnection::initializeScreens()
++xcbScreenNumber;
} // for each xcb screen
- // If there's no randr extension, or there was some error above, or we found a
- // screen which doesn't have outputs for some other reason (e.g. on VNC or ssh -X),
- // but the dimensions are known anyway, and we don't already have any lingering
- // (possibly disconnected) screens, then showing windows should be possible,
- // so create one screen. (QTBUG-31389)
- QXcbVirtualDesktop *virtualDesktop = m_virtualDesktops.value(0);
- if (virtualDesktop && !hasOutputs && !virtualDesktop->size().isEmpty() && m_screens.isEmpty()) {
- QXcbScreen *screen = createScreen(virtualDesktop, 0, Q_NULLPTR);
- screen->setVirtualSiblings(QList<QPlatformScreen *>() << screen);
- m_screens << screen;
- primaryScreen = screen;
- primaryScreen->setPrimary(true);
- qCDebug(lcQpaScreen) << "found a screen with zero outputs" << screen;
- }
-
- // Ensure the primary screen is first in the list
- if (primaryScreen) {
- Q_ASSERT(!m_screens.isEmpty());
- if (m_screens.first() != primaryScreen) {
- m_screens.removeOne(primaryScreen);
- m_screens.prepend(primaryScreen);
+ if (m_screens.isEmpty()) {
+ createVirtualScreen();
+ } else {
+ // Ensure the primary screen is first in the list
+ if (primaryScreen) {
+ if (m_screens.first() != primaryScreen) {
+ m_screens.removeOne(primaryScreen);
+ m_screens.prepend(primaryScreen);
+ }
}
- }
- // Push the screens to QApplication
- QXcbIntegration *integration = QXcbIntegration::instance();
- foreach (QXcbScreen* screen, m_screens) {
- qCDebug(lcQpaScreen) << "adding" << screen << "(Primary:" << screen->isPrimary() << ")";
- integration->screenAdded(screen, screen->isPrimary());
- }
-
- if (!m_screens.isEmpty())
- qCDebug(lcQpaScreen) << "primary output is" << m_screens.first()->name();
+ // Push the screens to QGuiApplication
+ foreach (QXcbScreen *screen, m_screens) {
+ qCDebug(lcQpaScreen) << "adding" << screen << "(Primary:" << screen->isPrimary() << ")";
+ QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary());
+ }
+ }
}
QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGrabServer, xcb_visualid_t defaultVisualId, const char *displayName)
@@ -474,6 +487,7 @@ QXcbConnection::QXcbConnection(QXcbNativ
, m_canGrabServer(canGrabServer)
, m_defaultVisualId(defaultVisualId)
, m_primaryScreenNumber(0)
+ , m_onlyVirtualScreen(false)
, m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY"))
, m_nativeInterface(nativeInterface)
#ifdef XCB_USE_XLIB
@@ -1110,8 +1124,19 @@ void QXcbConnection::handleXcbEvent(xcb_
handled = false;
break;
case XCB_PROPERTY_NOTIFY:
- HANDLE_PLATFORM_WINDOW_EVENT(xcb_property_notify_event_t, window, handlePropertyNotifyEvent);
+ {
+ // Update geometry for all screens, because availableGeometry must be changed
+ const xcb_property_notify_event_t *propertyNotifyEvent = (const xcb_property_notify_event_t *)event;
+ if (propertyNotifyEvent->atom == atom(QXcbAtom::_NET_WORKAREA)) {
+ foreach (QXcbScreen *screen, m_screens) {
+ if (propertyNotifyEvent->window == screen->root())
+ screen->updateGeometry(propertyNotifyEvent->time);
+ }
+ } else {
+ HANDLE_PLATFORM_WINDOW_EVENT(xcb_property_notify_event_t, window, handlePropertyNotifyEvent);
+ }
break;
+ }
#if defined(XCB_USE_XINPUT2)
case XCB_GE_GENERIC:
// Here the windowEventListener is invoked from xi2HandleEvent()
diff -rupN qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/qxcbconnection.h qtbase-opensource-src-5.5.1-new/src/plugins/platforms/xcb/qxcbconnection.h
--- qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/qxcbconnection.h 2015-10-13 06:35:27.000000000 +0200
+++ qtbase-opensource-src-5.5.1-new/src/plugins/platforms/xcb/qxcbconnection.h 2015-10-21 21:00:21.767613360 +0200
@@ -519,6 +519,9 @@ private:
QXcbVirtualDesktop* virtualDesktopForRootWindow(xcb_window_t rootWindow);
bool checkOutputIsPrimary(xcb_window_t rootWindow, xcb_randr_output_t output);
void initializeScreens();
+ void destroyScreen(QXcbScreen *screen, bool canCreateVirtualScreen);
+ void createVirtualScreen();
+ void maybeSetScreenForTopLevelWindows(QXcbScreen *screen);
void updateScreens(const xcb_randr_notify_event_t *event);
bool m_xi2Enabled;
@@ -583,6 +586,7 @@ private:
QList<QXcbVirtualDesktop *> m_virtualDesktops;
QList<QXcbScreen *> m_screens;
int m_primaryScreenNumber;
+ bool m_onlyVirtualScreen;
xcb_atom_t m_allAtoms[QXcbAtom::NAtoms];
diff -rupN qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/qxcbscreen.cpp qtbase-opensource-src-5.5.1-new/src/plugins/platforms/xcb/qxcbscreen.cpp
--- qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/qxcbscreen.cpp 2015-10-13 06:35:27.000000000 +0200
+++ qtbase-opensource-src-5.5.1-new/src/plugins/platforms/xcb/qxcbscreen.cpp 2015-10-21 21:00:21.768613377 +0200
@@ -438,14 +438,6 @@ void QXcbScreen::handleScreenChange(xcb_
QDpi ldpi = logicalDpi();
QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QPlatformScreen::screen(), ldpi.first, ldpi.second);
-
- // Windows which had null screens have already had expose events by now.
- // They need to be told the screen is back, it's OK to render.
- foreach (QWindow *window, QGuiApplication::topLevelWindows()) {
- QXcbWindow *xcbWin = static_cast<QXcbWindow*>(window->handle());
- if (xcbWin)
- xcbWin->maybeSetScreen(this);
- }
}
void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp)
diff -rupN qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/qxcbscreen.h qtbase-opensource-src-5.5.1-new/src/plugins/platforms/xcb/qxcbscreen.h
--- qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/qxcbscreen.h 2015-10-13 06:35:27.000000000 +0200
+++ qtbase-opensource-src-5.5.1-new/src/plugins/platforms/xcb/qxcbscreen.h 2015-10-21 21:00:21.768613377 +0200
@@ -116,6 +116,8 @@ public:
xcb_randr_crtc_t crtc() const { return m_crtc; }
xcb_randr_mode_t mode() const { return m_mode; }
+ void setCrtc(xcb_randr_crtc_t crtc) { m_crtc = crtc; }
+
void windowShown(QXcbWindow *window);
QString windowManagerName() const { return m_windowManagerName; }
bool syncRequestSupported() const { return m_syncRequestSupported; }
diff -rupN qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/qxcbwindow.cpp qtbase-opensource-src-5.5.1-new/src/plugins/platforms/xcb/qxcbwindow.cpp
--- qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/qxcbwindow.cpp 2015-10-13 06:35:27.000000000 +0200
+++ qtbase-opensource-src-5.5.1-new/src/plugins/platforms/xcb/qxcbwindow.cpp 2015-10-21 21:01:17.324562601 +0200
@@ -694,12 +694,17 @@ void QXcbWindow::destroy()
m_pendingSyncRequest->invalidate();
}
-void QXcbWindow::maybeSetScreen(QXcbScreen *screen)
+bool QXcbWindow::maybeSetScreen(QXcbScreen *screen)
{
- if (!window()->screen() && screen->geometry().contains(geometry().topLeft())) {
+ // Every window must have a screen. Otherwise application can
+ // crash and the window contents are invisible e.g. in x11vnc.
+ if (!window()->screen()) {
QWindowSystemInterface::handleWindowScreenChanged(window(), static_cast<QPlatformScreen *>(screen)->screen());
- QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(0, 0), window()->size())));
+ if (screen->geometry().contains(geometry().topLeft()))
+ QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(0, 0), window()->size())));
+ return true;
}
+ return false;
}
void QXcbWindow::setGeometry(const QRect &rect)
@@ -1243,8 +1248,6 @@ void QXcbWindow::changeNetWmState(bool s
event.data.data32[3] = 0;
event.data.data32[4] = 0;
- if (!xcbScreen())
- return;
Q_XCB_CALL(xcb_send_event(xcb_connection(), 0, xcbScreen()->root(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&event));
}
@@ -2323,8 +2324,6 @@ void QXcbWindow::handleEnterNotifyEvent(
const int dpr = int(devicePixelRatio());
const QPoint local(event->event_x/dpr, event->event_y/dpr);
- if (!xcbScreen())
- return;
QPoint global = xcbScreen()->mapFromNative(QPoint(event->root_x, event->root_y));
QWindowSystemInterface::handleEnterEvent(window(), local, global);
}
@@ -2343,8 +2342,6 @@ void QXcbWindow::handleLeaveNotifyEvent(
if (enterWindow) {
const int dpr = int(devicePixelRatio());
QPoint local(enter->event_x/dpr, enter->event_y/dpr);
- if (!xcbScreen())
- return;
QPoint global = xcbScreen()->mapFromNative(QPoint(event->root_x, event->root_y));
QWindowSystemInterface::handleEnterLeaveEvent(enterWindow->window(), window(), local, global);
@@ -2360,8 +2357,6 @@ void QXcbWindow::handlePropertyNotifyEve
connection()->setTime(event->time);
const bool propertyDeleted = event->state == XCB_PROPERTY_DELETE;
- if (!xcbScreen())
- return;
if (event->atom == atom(QXcbAtom::_NET_WM_STATE) || event->atom == atom(QXcbAtom::WM_STATE)) {
if (propertyDeleted)
@@ -2403,8 +2398,6 @@ void QXcbWindow::handlePropertyNotifyEve
return;
} else if (event->atom == atom(QXcbAtom::_NET_FRAME_EXTENTS)) {
m_dirtyFrameMargins = true;
- } else if (event->atom == atom(QXcbAtom::_NET_WORKAREA) && xcbScreen() && event->window == xcbScreen()->root()) {
- xcbScreen()->updateGeometry(event->time);
}
}
@@ -2682,8 +2675,6 @@ bool QXcbWindow::needsSync() const
void QXcbWindow::postSyncWindowRequest()
{
- if (!xcbScreen())
- return;
if (!m_pendingSyncRequest) {
QXcbSyncWindowRequest *e = new QXcbSyncWindowRequest(this);
m_pendingSyncRequest = e;
diff -rupN qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/qxcbwindow.h qtbase-opensource-src-5.5.1-new/src/plugins/platforms/xcb/qxcbwindow.h
--- qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/qxcbwindow.h 2015-10-13 06:35:27.000000000 +0200
+++ qtbase-opensource-src-5.5.1-new/src/plugins/platforms/xcb/qxcbwindow.h 2015-10-21 21:00:21.769613394 +0200
@@ -158,7 +158,7 @@ public:
virtual void create();
virtual void destroy();
- void maybeSetScreen(QXcbScreen *screen);
+ bool maybeSetScreen(QXcbScreen *screen);
QXcbScreen *screenForNativeGeometry(const QRect &newGeometry) const;
public Q_SLOTS:

30
macros.qt5 Normal file
View File

@ -0,0 +1,30 @@
%_qt5 @@NAME@@
%_qt5_epoch @@EPOCH@@
%_qt5_version @@VERSION@@
%_qt5_evr @@EVR@@
%_qt5_prefix %{_libdir}/qt5
%_qt5_archdatadir %{_qt5_prefix}
%_qt5_bindir %{_qt5_prefix}/bin
%_qt5_datadir %{_datadir}/qt5
%_qt5_docdir %{_docdir}/qt5
%_qt5_examplesdir %{_qt5_prefix}/examples
%_qt5_headerdir %{_includedir}/qt5
%_qt5_importdir %{_qt5_archdatadir}/imports
%_qt5_libdir %{_libdir}
%_qt5_libexecdir %{_qt5_archdatadir}/libexec
%_qt5_plugindir %{_qt5_archdatadir}/plugins
%_qt5_qmake %{_qt5_bindir}/qmake
%_qt5_settingsdir %{_sysconfdir}/xdg
%_qt5_sysconfdir %{_qt5_settingsdir}
%_qt5_translationdir %{_datadir}/qt5/translations
%qmake_qt5 \
%{_qt5_qmake} \\\
QMAKE_CFLAGS_DEBUG="${CFLAGS:-%optflags}" \\\
QMAKE_CFLAGS_RELEASE="${CFLAGS:-%optflags}" \\\
QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS:-%optflags}" \\\
QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS:-%optflags}" \\\
QMAKE_LFLAGS_DEBUG="${LDFLAGS:-%{?__global_ldflags}}" \\\
QMAKE_LFLAGS_RELEASE="${LDFLAGS:-%{?__global_ldflags}}" \\\
QMAKE_STRIP=

View File

@ -1,4 +0,0 @@
%_qt5 @@NAME@@
%_qt5_epoch @@EPOCH@@
%_qt5_version @@VERSION@@
%_qt5_evr @@EVR@@

View File

@ -6,10 +6,7 @@
#ifndef QCONFIG_MULTILIB_H
#define QCONFIG_MULTILIB_H
#ifndef __WORDSIZE
#include <bits/wordsize.h>
#endif
#if __WORDSIZE == 32
#include "QtCore/qconfig-32.h"

7
qdoc.valgrind Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
# run process through valgrind instead
DIRNAME=$(dirname $0)
set -x
valgrind ${DIRNAME}/qdoc.orig $@

735
qt5-poll.patch Normal file
View File

@ -0,0 +1,735 @@
commit 8a2d9073e959356808ce1685822b839d880e6498
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Sep 14 17:27:35 2012 +0200
Replace most calls to select(2) with poll(2)
select(2) limits the number of file descriptor in a process to
FD_SETSIZE (typically 1023). Process creation and certain socket
operations fail because they call select(2) on a file descriptor outside
the FD_SETSIZE range.
The remaining select(2) calls are used for timeouts only, or are in the
traditional event loop. The glib-based event loop does not use
select(2), so this should be sufficient.
This change adds a poll emulation for VxWorks, which only offers
select(2).
Change-Id: I9b0cf5bec81da70b29c501c62d14fb57df87fa61
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index e159bf8..bb8a3ae 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -134,13 +134,6 @@ static void qt_sa_sigchld_handler(int signum)
oldAction(signum);
}
-static inline void add_fd(int &nfds, int fd, fd_set *fdset)
-{
- FD_SET(fd, fdset);
- if ((fd) > nfds)
- nfds = fd;
-}
-
struct QProcessInfo {
QProcess *process;
int deathPipe;
@@ -235,9 +228,9 @@ QProcessManager::~QProcessManager()
void QProcessManager::run()
{
forever {
- fd_set readset;
- FD_ZERO(&readset);
- FD_SET(qt_qprocess_deadChild_pipe[0], &readset);
+ pollfd fd;
+ fd.fd = qt_qprocess_deadChild_pipe[0];
+ fd.events = POLLIN;
#if defined (QPROCESS_DEBUG)
qDebug() << "QProcessManager::run() waiting for children to die";
@@ -246,8 +239,8 @@ void QProcessManager::run()
// block forever, or until activity is detected on the dead child
// pipe. the only other peers are the SIGCHLD signal handler, and the
// QProcessManager destructor.
- int nselect = select(qt_qprocess_deadChild_pipe[0] + 1, &readset, 0, 0, 0);
- if (nselect < 0) {
+ int ret = qt_safe_poll(&fd, 1, -1, /* retry_eintr */ false);
+ if (ret < 0) {
if (errno == EINTR)
continue;
break;
@@ -996,17 +989,6 @@ void QProcessPrivate::killProcess()
::kill(pid_t(pid), SIGKILL);
}
-static int select_msecs(int nfds, fd_set *fdread, fd_set *fdwrite, int timeout)
-{
- if (timeout < 0)
- return qt_safe_select(nfds, fdread, fdwrite, 0, 0);
-
- struct timeval tv;
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000;
- return qt_safe_select(nfds, fdread, fdwrite, 0, &tv);
-}
-
/*
Returns the difference between msecs and elapsed. If msecs is -1,
however, -1 is returned.
@@ -1029,10 +1011,10 @@ bool QProcessPrivate::waitForStarted(int msecs)
childStartedPipe[0]);
#endif
- fd_set fds;
- FD_ZERO(&fds);
- FD_SET(childStartedPipe[0], &fds);
- if (select_msecs(childStartedPipe[0] + 1, &fds, 0, msecs) == 0) {
+ pollfd fd;
+ fd.fd = childStartedPipe[0];
+ fd.events = POLLIN;
+ if (qt_safe_poll(&fd, 1, msecs) == 0) {
processError = QProcess::Timedout;
q->setErrorString(QProcess::tr("Process operation timed out"));
#if defined (QPROCESS_DEBUG)
@@ -1048,6 +1030,47 @@ bool QProcessPrivate::waitForStarted(int msecs)
return startedEmitted;
}
+class QProcessFDSet {
+ pollfd fds[5];
+
+ static size_t size()
+ {
+ return sizeof(fds)/sizeof(fds[0]);
+ }
+
+public:
+ QProcessFDSet(QProcessPrivate &proc)
+ {
+ for (size_t i = 0; i < size(); ++i) {
+ fds[i].fd = -1;
+ fds[i].events = POLLIN;
+ }
+ death().fd = proc.deathPipe[0];
+
+ if (proc.processState == QProcess::Starting)
+ started().fd = proc.childStartedPipe[0];
+
+ stdout().fd = proc.stdoutChannel.pipe[0];
+ stderr().fd = proc.stderrChannel.pipe[0];
+
+ if (!proc.writeBuffer.isEmpty()) {
+ stdin().fd = proc.stdinChannel.pipe[1];
+ stdin().events = POLLOUT;
+ }
+ }
+
+ int poll(int timeout)
+ {
+ return qt_safe_poll(fds, size(), timeout);
+ }
+
+ pollfd &death() { return fds[0]; }
+ pollfd &started() { return fds[1]; }
+ pollfd &stdout() { return fds[2]; }
+ pollfd &stderr() { return fds[3]; }
+ pollfd &stdin() { return fds[4]; }
+};
+
bool QProcessPrivate::waitForReadyRead(int msecs)
{
Q_Q(QProcess);
@@ -1059,28 +1082,9 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
stopWatch.start();
forever {
- fd_set fdread;
- fd_set fdwrite;
-
- FD_ZERO(&fdread);
- FD_ZERO(&fdwrite);
-
- int nfds = deathPipe[0];
- FD_SET(deathPipe[0], &fdread);
-
- if (processState == QProcess::Starting)
- add_fd(nfds, childStartedPipe[0], &fdread);
-
- if (stdoutChannel.pipe[0] != -1)
- add_fd(nfds, stdoutChannel.pipe[0], &fdread);
- if (stderrChannel.pipe[0] != -1)
- add_fd(nfds, stderrChannel.pipe[0], &fdread);
-
- if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
- add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
-
+ QProcessFDSet fdset(*this);
int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
- int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
+ int ret = fdset.poll(timeout);
if (ret < 0) {
break;
}
@@ -1090,18 +1094,18 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
return false;
}
- if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) {
+ if (qt_readable(fdset.started())) {
if (!_q_startupNotification())
return false;
}
bool readyReadEmitted = false;
- if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread)) {
+ if (qt_readable(fdset.stdout())) {
bool canRead = _q_canReadStandardOutput();
if (processChannel == QProcess::StandardOutput && canRead)
readyReadEmitted = true;
}
- if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread)) {
+ if (qt_readable(fdset.stderr())) {
bool canRead = _q_canReadStandardError();
if (processChannel == QProcess::StandardError && canRead)
readyReadEmitted = true;
@@ -1109,13 +1113,13 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
if (readyReadEmitted)
return true;
- if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite))
+ if (qt_writable(fdset.stdin()))
_q_canWrite();
- if (deathPipe[0] == -1 || FD_ISSET(deathPipe[0], &fdread)) {
+ if (qt_readable(fdset.death())) {
if (_q_processDied())
return false;
- }
+ }
}
return false;
}
@@ -1131,29 +1135,9 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
stopWatch.start();
while (!writeBuffer.isEmpty()) {
- fd_set fdread;
- fd_set fdwrite;
-
- FD_ZERO(&fdread);
- FD_ZERO(&fdwrite);
-
- int nfds = deathPipe[0];
- FD_SET(deathPipe[0], &fdread);
-
- if (processState == QProcess::Starting)
- add_fd(nfds, childStartedPipe[0], &fdread);
-
- if (stdoutChannel.pipe[0] != -1)
- add_fd(nfds, stdoutChannel.pipe[0], &fdread);
- if (stderrChannel.pipe[0] != -1)
- add_fd(nfds, stderrChannel.pipe[0], &fdread);
-
-
- if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
- add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
-
+ QProcessFDSet fdset(*this);
int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
- int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
+ int ret = fdset.poll(timeout);
if (ret < 0) {
break;
}
@@ -1164,24 +1148,24 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
return false;
}
- if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) {
+ if (qt_readable(fdset.started())) {
if (!_q_startupNotification())
return false;
}
- if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite))
+ if (qt_writable(fdset.stdin()))
return _q_canWrite();
- if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread))
+ if (qt_readable(fdset.stdout()))
_q_canReadStandardOutput();
- if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread))
+ if (qt_readable(fdset.stderr()))
_q_canReadStandardError();
- if (deathPipe[0] == -1 || FD_ISSET(deathPipe[0], &fdread)) {
- if (_q_processDied())
- return false;
- }
+ if (qt_readable(fdset.death())) {
+ if (_q_processDied())
+ return false;
+ }
}
return false;
@@ -1198,29 +1182,9 @@ bool QProcessPrivate::waitForFinished(int msecs)
stopWatch.start();
forever {
- fd_set fdread;
- fd_set fdwrite;
- int nfds = -1;
-
- FD_ZERO(&fdread);
- FD_ZERO(&fdwrite);
-
- if (processState == QProcess::Starting)
- add_fd(nfds, childStartedPipe[0], &fdread);
-
- if (stdoutChannel.pipe[0] != -1)
- add_fd(nfds, stdoutChannel.pipe[0], &fdread);
- if (stderrChannel.pipe[0] != -1)
- add_fd(nfds, stderrChannel.pipe[0], &fdread);
-
- if (processState == QProcess::Running)
- add_fd(nfds, deathPipe[0], &fdread);
-
- if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
- add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
-
+ QProcessFDSet fdset(*this);
int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
- int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
+ int ret = fdset.poll(timeout);
if (ret < 0) {
break;
}
@@ -1230,20 +1194,20 @@ bool QProcessPrivate::waitForFinished(int msecs)
return false;
}
- if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) {
+ if (qt_readable(fdset.started())) {
if (!_q_startupNotification())
return false;
}
- if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite))
+ if (qt_writable(fdset.stdin()))
_q_canWrite();
- if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread))
+ if (qt_readable(fdset.stdout()))
_q_canReadStandardOutput();
- if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread))
+ if (qt_readable(fdset.stderr()))
_q_canReadStandardError();
- if (deathPipe[0] == -1 || FD_ISSET(deathPipe[0], &fdread)) {
+ if (qt_readable(fdset.death())) {
if (_q_processDied())
return true;
}
@@ -1253,10 +1217,10 @@ bool QProcessPrivate::waitForFinished(int msecs)
bool QProcessPrivate::waitForWrite(int msecs)
{
- fd_set fdwrite;
- FD_ZERO(&fdwrite);
- FD_SET(stdinChannel.pipe[1], &fdwrite);
- return select_msecs(stdinChannel.pipe[1] + 1, 0, &fdwrite, msecs < 0 ? 0 : msecs) == 1;
+ pollfd fd;
+ fd.fd = stdinChannel.pipe[1];
+ fd.events = POLLIN;
+ return qt_safe_poll(&fd, 1, msecs);
}
void QProcessPrivate::findExitCode()
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
index cc54798..ca178bb 100644
--- a/src/corelib/kernel/qcore_unix.cpp
+++ b/src/corelib/kernel/qcore_unix.cpp
@@ -103,4 +103,165 @@ int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
}
}
+#ifndef Q_OS_VXWORKS
+
+int qt_safe_poll(struct pollfd *fds, int nfds, int timeout_ms, bool retry_eintr)
+{
+ if (nfds == 0)
+ return 0;
+ if (nfds < 0) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ // Retry on ret == 0 if the deadline has not yet passed because
+ // Linux can return early from the syscall, without setting EINTR.
+ if (timeout_ms < 0) {
+ forever {
+ int ret = ::poll(fds, nfds, -1);
+ if (ret > 0)
+ return ret;
+ if (retry_eintr) {
+ if (ret == 0 || ret == -1 && errno == EINTR) {
+ continue;
+ } else {
+ return -1;
+ }
+ }
+ if (ret == 0) {
+ errno = EINTR;
+ return -1;
+ }
+ return ret;
+ }
+ }
+
+ timeval previous = qt_gettime();
+ timeval deadline = previous;
+ deadline.tv_sec += timeout_ms / 1000;
+ deadline.tv_usec += (timeout_ms % 1000) * 1000;
+ if (deadline.tv_usec >= 1000000) {
+ ++deadline.tv_sec;
+ deadline.tv_usec -= 1000000;
+ }
+ int remaining = timeout_ms;
+
+ forever {
+ int ret = ::poll(fds, nfds, remaining);
+ if (ret > 0)
+ return ret;
+ timeval now = qt_gettime();
+ if ((now.tv_sec > deadline.tv_sec // past deadline
+ || (now.tv_sec == deadline.tv_sec
+ && now.tv_usec >= deadline.tv_usec))
+ || (now.tv_sec < previous.tv_sec // time warp
+ || (now.tv_sec == previous.tv_sec
+ && now.tv_usec < previous.tv_usec))
+ || (ret < 0 && (errno != EINTR || !retry_eintr))) // other error
+ return ret;
+ if (ret == 0 && !retry_eintr) {
+ errno = EINTR;
+ return -1;
+ }
+ remaining = (deadline.tv_sec - now.tv_sec) * 1000
+ + (deadline.tv_usec - now.tv_usec) / 1000;
+ previous = now;
+ }
+}
+
+#else
+
+// Poll emulation for VxWorks.
+
+static int mark_bad_descriptors(pollfd *fds, int nfds)
+{
+ fd_set r;
+ FD_ZERO(&r);
+ struct timeval tv;
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ int ret = 0;
+
+ // Check each descriptor invidually for badness.
+ for (int i = 0; i < nfds; ++i) {
+ pollfd &fd(fds[i]);
+ if (fd.fd >= 0) {
+ FD_SET(fd.fd, &r);
+ int ret = qt_safe_select(fd.fd + 1, &r, NULL, NULL, &tv);
+ FD_CLR(fd.fd, &r);
+ if (ret < 0 && errno == EBADF) {
+ fd.revents = POLLNVAL;
+ ++ret;
+ }
+ }
+ }
+ Q_ASSERT(ret > 0);
+ return ret;
+}
+
+int qt_safe_poll(pollfd *fds, int nfds, int timeout, bool retry_eintr)
+{
+ fd_set r, w;
+ FD_ZERO(&r);
+ FD_ZERO(&w);
+ int maxfd = -1;
+
+ // Extract the watched descriptors.
+ for (int i = 0; i < nfds; ++i) {
+ pollfd &fd(fds[i]);
+ if (fd.fd >= 0 && fd.fd < FD_SETSIZE) {
+ if (fd.events & POLLIN) {
+ FD_SET(fd.fd, &r);
+ if (fd.fd > maxfd)
+ maxfd = fd.fd;
+ }
+ if (fd.events & POLLOUT) {
+ FD_SET(fd.fd, &w);
+ if (fd.fd > maxfd)
+ maxfd = fd.fd;
+ }
+ }
+ }
+
+ // If timeout is negative, wait indefinitely for activity.
+ timeval tv;
+ timeval *ptv;
+ if (timeout >= 0) {
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout % 1000) * 1000;
+ ptv = &tv;
+ } else
+ ptv = NULL;
+
+ int ret;
+ if (retry_eintr)
+ ret = qt_safe_select(maxfd + 1, &r, &w, NULL, ptv);
+ else
+ ret = ::select(maxfd + 1, &r, &w, NULL, ptv);
+ if (ret < 0 && errno == EBADF) {
+ return mark_bad_descriptors(fds, nfds);
+ }
+ if (ret <= 0)
+ return ret;
+
+ // Set the revents flags.
+ ret = 0;
+ for (int i = 0; i < nfds; ++i) {
+ pollfd &fd(fds[i]);
+ fd.revents = 0;
+ if (fd.fd >= 0 && fd.fd < FD_SETSIZE) {
+ if ((fd.events & POLLIN) && FD_ISSET(fd.fd, &r))
+ fd.revents |= POLLIN;
+ if ((fd.events & POLLOUT) && FD_ISSET(fd.fd, &w))
+ fd.revents |= POLLOUT;
+ if (fd.revents)
+ ++ret;
+ }
+ }
+ Q_ASSERT(ret > 0);
+ return ret;
+}
+
+#endif // Q_OS_VXWORKS
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index 6342b03..f7f4767 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -71,6 +71,8 @@
#if defined(Q_OS_VXWORKS)
# include <ioLib.h>
+#else
+# include <poll.h>
#endif
struct sockaddr;
@@ -341,6 +343,36 @@ void qt_nanosleep(timespec amount);
Q_CORE_EXPORT int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
const struct timeval *tv);
+#ifdef Q_OS_VXWORKS
+// Poll emulation for VxWorks. Provided by <poll.h> on other systems.
+
+struct pollfd {
+ int fd;
+ short events;
+ short revents;
+};
+
+#define POLLIN 1
+#define POLLOUT 2
+#define POLLERR 4
+#define POLLHUP 8
+#define POLLNVAL 16
+#endif
+
+inline bool qt_readable(const pollfd &fd)
+{
+ return fd.fd >= 0 && (fd.revents & (POLLIN | POLLHUP | POLLERR | POLLNVAL)) != 0;
+}
+
+inline bool qt_writable(const pollfd &fd)
+{
+ return fd.fd >= 0 && (fd.revents & (POLLOUT | POLLHUP | POLLERR | POLLNVAL)) != 0;
+}
+
+// Deprecated due to FD_SETSIZE limitation, use qt_safe_poll instead.
+Q_CORE_EXPORT int qt_safe_poll(pollfd *fds, int nfds, int timeout,
+ bool retry_eintr = true);
+
// according to X/OPEN we have to define semun ourselves
// we use prefix as on some systems sem.h will have it
struct semid_ds;
diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp
index 2bcf1ac..efb8128 100644
--- a/src/network/socket/qlocalserver_unix.cpp
+++ b/src/network/socket/qlocalserver_unix.cpp
@@ -293,16 +293,11 @@ void QLocalServerPrivate::_q_onNewConnection()
void QLocalServerPrivate::waitForNewConnection(int msec, bool *timedOut)
{
- fd_set readfds;
- FD_ZERO(&readfds);
- FD_SET(listenSocket, &readfds);
+ struct pollfd fd;
+ fd.fd = listenSocket;
+ fd.events = POLLIN;
- timeval timeout;
- timeout.tv_sec = msec / 1000;
- timeout.tv_usec = (msec % 1000) * 1000;
-
- int result = -1;
- result = qt_safe_select(listenSocket + 1, &readfds, 0, 0, (msec == -1) ? 0 : &timeout);
+ int result = qt_safe_poll(&fd, 1, msec);
if (-1 == result) {
setError(QLatin1String("QLocalServer::waitForNewConnection"));
closeServer();
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
index 49eb71a..c598c2b 100644
--- a/src/network/socket/qlocalsocket_unix.cpp
+++ b/src/network/socket/qlocalsocket_unix.cpp
@@ -56,10 +56,6 @@
#include <qdebug.h>
#include <qelapsedtimer.h>
-#ifdef Q_OS_VXWORKS
-# include <selectLib.h>
-#endif
-
#define QT_CONNECT_TIMEOUT 30000
QT_BEGIN_NAMESPACE
@@ -524,25 +520,16 @@ bool QLocalSocket::waitForConnected(int msec)
if (state() != ConnectingState)
return (state() == ConnectedState);
- fd_set fds;
- FD_ZERO(&fds);
- FD_SET(d->connectingSocket, &fds);
-
- timeval timeout;
- timeout.tv_sec = msec / 1000;
- timeout.tv_usec = (msec % 1000) * 1000;
+ pollfd fd;
+ fd.fd = d->connectingSocket;
+ fd.events = POLLIN | POLLOUT;
- // timeout can not be 0 or else select will return an error.
- if (0 == msec)
- timeout.tv_usec = 1000;
-
- int result = -1;
- // on Linux timeout will be updated by select, but _not_ on other systems.
+ int result;
QElapsedTimer timer;
+ int remaining = msec > 0 ? msec : 1000;
timer.start();
- while (state() == ConnectingState
- && (-1 == msec || timer.elapsed() < msec)) {
- result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout);
+ while (state() == ConnectingState) {
+ result = qt_safe_poll(&fd, 1, remaining, /* retry_eintr */ false);
if (-1 == result && errno != EINTR) {
d->errorOccurred( QLocalSocket::UnknownSocketError,
QLatin1String("QLocalSocket::waitForConnected"));
@@ -550,6 +537,11 @@ bool QLocalSocket::waitForConnected(int msec)
}
if (result > 0)
d->_q_connectToSocket();
+ if (msec >= 0) {
+ remaining = timer.elapsed() - msec;
+ if (remaining < 0)
+ break;
+ }
}
return (state() == ConnectedState);
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index 4f3408b..a1bb298 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -1122,48 +1122,40 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize)
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const
{
- fd_set fds;
- FD_ZERO(&fds);
- FD_SET(socketDescriptor, &fds);
-
- struct timeval tv;
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000;
-
- int retval;
- if (selectForRead)
- retval = qt_safe_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv);
- else
- retval = qt_safe_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv);
-
- return retval;
+ struct pollfd fd;
+ fd.fd = socketDescriptor;
+ if (selectForRead) {
+ fd.events = POLLIN;
+ } else {
+ fd.events = POLLOUT;
+ }
+ return qt_safe_poll(&fd, 1, timeout);
}
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite,
bool *selectForRead, bool *selectForWrite) const
{
- fd_set fdread;
- FD_ZERO(&fdread);
+ struct pollfd fd;
+ fd.fd = socketDescriptor;
if (checkRead)
- FD_SET(socketDescriptor, &fdread);
-
- fd_set fdwrite;
- FD_ZERO(&fdwrite);
+ fd.events = POLLIN;
+ else
+ fd.events = 0;
if (checkWrite)
- FD_SET(socketDescriptor, &fdwrite);
-
- struct timeval tv;
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000;
-
- int ret;
- ret = qt_safe_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv);
-
+ fd.events |= POLLOUT;
+ int ret = qt_safe_poll(&fd, 1, timeout);
if (ret <= 0)
- return ret;
- *selectForRead = FD_ISSET(socketDescriptor, &fdread);
- *selectForWrite = FD_ISSET(socketDescriptor, &fdwrite);
-
+ return ret;
+ bool r = (fd.revents & (POLLIN | POLLHUP | POLLERR)) != 0;
+ bool w = (fd.revents & (POLLOUT | POLLHUP | POLLERR)) != 0;
+ // Emulate the return value from select(2).
+ ret = 0;
+ if (r)
+ ++ret;
+ if (w)
+ ++ret;
+ *selectForRead = r;
+ *selectForWrite = w;
return ret;
}

View File

@ -1,29 +0,0 @@
diff -up qtbase-everywhere-src-5.12.1/src/plugins/sqldrivers/configure.json.firebird qtbase-everywhere-src-5.12.1/src/plugins/sqldrivers/configure.json
--- qtbase-everywhere-src-5.12.1/src/plugins/sqldrivers/configure.json.firebird 2019-01-28 11:11:52.000000000 -0600
+++ qtbase-everywhere-src-5.12.1/src/plugins/sqldrivers/configure.json 2019-02-03 13:41:27.392305128 -0600
@@ -49,10 +49,11 @@
"ibase": {
"label": "InterBase",
"test": {},
- "headers": "ibase.h",
+ "headers": "firebird/ibase.h",
"sources": [
{ "libs": "-lgds32_ms", "condition": "config.win32" },
- { "libs": "-lgds", "condition": "!config.win32" }
+ { "libs": "-lgds", "condition": "!config.win32" },
+ { "libs": "-lfbclient", "condition": "!config.win32" }
]
},
"mysql": {
diff -up qtbase-everywhere-src-5.12.1/src/plugins/sqldrivers/ibase/qsql_ibase_p.h.firebird qtbase-everywhere-src-5.12.1/src/plugins/sqldrivers/ibase/qsql_ibase_p.h
--- qtbase-everywhere-src-5.12.1/src/plugins/sqldrivers/ibase/qsql_ibase_p.h.firebird 2019-01-28 11:11:52.000000000 -0600
+++ qtbase-everywhere-src-5.12.1/src/plugins/sqldrivers/ibase/qsql_ibase_p.h 2019-02-03 13:27:30.683142996 -0600
@@ -52,7 +52,7 @@
//
#include <QtSql/qsqldriver.h>
-#include <ibase.h>
+#include <firebird/ibase.h>
#ifdef QT_PLUGIN
#define Q_EXPORT_SQLDRIVER_IBASE

View File

@ -1,146 +0,0 @@
From f432c08882ffebe5074ea28de871559a98a4d094 Mon Sep 17 00:00:00 2001
From: Lars Knoll <lars.knoll@qt.io>
Date: Wed, 26 Feb 2020 10:42:10 +0100
Subject: Add an expansion limit for entities
Recursively defined entities can easily exhaust all available
memory. Limit entity expansion to a default of 4096 characters to
avoid DoS attacks when a user loads untrusted content.
[ChangeLog][QtCore][QXmlStream] QXmlStreamReader does now
limit the expansion of entities to 4096 characters. Documents where
a single entity expands to more characters than the limit are not
considered well formed. The limit is there to avoid DoS attacks through
recursively expanding entities when loading untrusted content. Qt 5.15
will add methods that allow changing that limit.
Fixes: QTBUG-47417
Change-Id: I94387815d74fcf34783e136387ee57fac5ded0c9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fd4be84d23a0db4186cb42e736a9de3af722c7f7)
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
---
src/corelib/serialization/qxmlstream.g | 14 ++++++++++++-
src/corelib/serialization/qxmlstream_p.h | 14 ++++++++++++-
.../serialization/qxmlstream/tst_qxmlstream.cpp | 23 ++++++++++++++++++++--
3 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/src/corelib/serialization/qxmlstream.g b/src/corelib/serialization/qxmlstream.g
index 10bfcd491c..5726bafb26 100644
--- a/src/corelib/serialization/qxmlstream.g
+++ b/src/corelib/serialization/qxmlstream.g
@@ -277,9 +277,19 @@ public:
QHash<QStringView, Entity> entityHash;
QHash<QStringView, Entity> parameterEntityHash;
QXmlStreamSimpleStack<Entity *>entityReferenceStack;
+ int entityExpansionLimit = 4096;
+ int entityLength = 0;
inline bool referenceEntity(Entity &entity) {
if (entity.isCurrentlyReferenced) {
- raiseWellFormedError(QXmlStream::tr("Recursive entity detected."));
+ raiseWellFormedError(QXmlStream::tr("Self-referencing entity detected."));
+ return false;
+ }
+ // entityLength represents the amount of additional characters the
+ // entity expands into (can be negative for e.g. &amp;). It's used to
+ // avoid DoS attacks through recursive entity expansions
+ entityLength += entity.value.size() - entity.name.size() - 2;
+ if (entityLength > entityExpansionLimit) {
+ raiseWellFormedError(QXmlStream::tr("Entity expands to more characters than the entity expansion limit."));
return false;
}
entity.isCurrentlyReferenced = true;
@@ -830,6 +840,8 @@ entity_done ::= ENTITY_DONE;
/.
case $rule_number:
entityReferenceStack.pop()->isCurrentlyReferenced = false;
+ if (entityReferenceStack.isEmpty())
+ entityLength = 0;
clearSym();
break;
./
diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h
index 61f501f81b..31053f8e0b 100644
--- a/src/corelib/serialization/qxmlstream_p.h
+++ b/src/corelib/serialization/qxmlstream_p.h
@@ -774,9 +774,19 @@ public:
QHash<QStringView, Entity> entityHash;
QHash<QStringView, Entity> parameterEntityHash;
QXmlStreamSimpleStack<Entity *>entityReferenceStack;
+ int entityExpansionLimit = 4096;
+ int entityLength = 0;
inline bool referenceEntity(Entity &entity) {
if (entity.isCurrentlyReferenced) {
- raiseWellFormedError(QXmlStream::tr("Recursive entity detected."));
+ raiseWellFormedError(QXmlStream::tr("Self-referencing entity detected."));
+ return false;
+ }
+ // entityLength represents the amount of additional characters the
+ // entity expands into (can be negative for e.g. &amp;). It's used to
+ // avoid DoS attacks through recursive entity expansions
+ entityLength += entity.value.size() - entity.name.size() - 2;
+ if (entityLength > entityExpansionLimit) {
+ raiseWellFormedError(QXmlStream::tr("Entity expands to more characters than the entity expansion limit."));
return false;
}
entity.isCurrentlyReferenced = true;
@@ -1308,6 +1318,8 @@ bool QXmlStreamReaderPrivate::parse()
case 10:
entityReferenceStack.pop()->isCurrentlyReferenced = false;
+ if (entityReferenceStack.isEmpty())
+ entityLength = 0;
clearSym();
break;
diff --git a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp
index 8fdf91b090..1f9a0d575d 100644
--- a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp
+++ b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp
@@ -393,8 +393,6 @@ public:
return true;
}
- QXmlStreamReader reader(&inputFile);
-
/* See testcases.dtd which reads: 'Nonvalidating parsers
* must also accept "invalid" testcases, but validating ones must reject them.' */
if(type == QLatin1String("invalid") || type == QLatin1String("valid"))
@@ -580,6 +578,8 @@ private slots:
void roundTrip() const;
void roundTrip_data() const;
+ void entityExpansionLimit() const;
+
private:
static QByteArray readFile(const QString &filename);
@@ -1756,6 +1756,25 @@ void tst_QXmlStream::roundTrip_data() const
"</root>\n";
}
+void tst_QXmlStream::entityExpansionLimit() const
+{
+ QString xml = QStringLiteral("<?xml version=\"1.0\"?>"
+ "<!DOCTYPE foo ["
+ "<!ENTITY a \"0123456789\" >"
+ "<!ENTITY b \"&a;&a;&a;&a;&a;&a;&a;&a;&a;&a;\" >"
+ "<!ENTITY c \"&b;&b;&b;&b;&b;&b;&b;&b;&b;&b;\" >"
+ "<!ENTITY d \"&c;&c;&c;&c;&c;&c;&c;&c;&c;&c;\" >"
+ "]>"
+ "<foo>&d;&d;&d;</foo>");
+ {
+ QXmlStreamReader reader(xml);
+ do {
+ reader.readNext();
+ } while (!reader.atEnd());
+ QCOMPARE(reader.error(), QXmlStreamReader::NotWellFormedError);
+ }
+}
+
void tst_QXmlStream::roundTrip() const
{
QFETCH(QString, in);
--
cgit v0.2.1

View File

@ -0,0 +1,45 @@
From b0b08cc0e4e38504d6b833702f7477aee4e2a192 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Sun, 5 Jul 2015 12:15:29 +0200
Subject: [PATCH] When a screen comes back online, the windows need to be told
about it
On my system, this fixes the misbehavior of Qt applications when the (only) active screen is
switched, e.g. from an external screen to the laptop.
This behavior is caused by the screen() of widgets to be set to NULL when their screen goes away.
When a new screen comes online, the widgets *should* be told about it, but they are not. The only
place that "maybeSetScreen" is called is when an existing screen changes its geometry, but not
when a screen gets enabled without its geometry being affected in any way (e.g. because it was
just disabled via xrandr, but has been connected all along). This makes sure that "maybeSetScreen"
is also called when a screen gets enabled.
Task-number: QTBUG-47041
Change-Id: Ic72d6beaa544bf9a4efdbea0830b1bc0d6ce5362
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
---
src/plugins/platforms/xcb/qxcbconnection.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 74f48b0..0867615 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -252,6 +252,14 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
otherScreen->addVirtualSibling(screen);
m_screens << screen;
QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary());
+
+ // Windows which had null screens have already had expose events by now.
+ // They need to be told the screen is back, it's OK to render.
+ foreach (QWindow *window, QGuiApplication::topLevelWindows()) {
+ QXcbWindow *xcbWin = static_cast<QXcbWindow*>(window->handle());
+ if (xcbWin)
+ xcbWin->maybeSetScreen(screen);
+ }
}
// else ignore disabled screens
} else if (screen) {
--
2.3.5

View File

@ -1,13 +0,0 @@
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

View File

@ -0,0 +1,120 @@
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 6645a37..e24cc8a 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -329,7 +329,7 @@ void QLineEditIconButton::actionEvent(QActionEvent *e)
switch (e->type()) {
case QEvent::ActionChanged: {
const QAction *action = e->action();
- if (isVisible() != action->isVisible()) {
+ if (isVisibleTo(parentWidget()) != action->isVisible()) {
setVisible(action->isVisible());
if (QLineEdit *le = qobject_cast<QLineEdit *>(parentWidget()))
static_cast<QLineEditPrivate *>(qt_widget_private(le))->positionSideWidgets();
@@ -433,13 +433,13 @@ void QLineEditPrivate::positionSideWidgets()
QRect widgetGeometry(QPoint(QLineEditIconButton::IconMargin, (contentRect.height() - iconSize.height()) / 2), iconSize);
foreach (const SideWidgetEntry &e, leftSideWidgetList()) {
e.widget->setGeometry(widgetGeometry);
- if (e.widget->isVisible())
+ if (e.action->isVisible())
widgetGeometry.moveLeft(widgetGeometry.left() + delta);
}
widgetGeometry.moveLeft(contentRect.width() - iconSize.width() - QLineEditIconButton::IconMargin);
foreach (const SideWidgetEntry &e, rightSideWidgetList()) {
e.widget->setGeometry(widgetGeometry);
- if (e.widget->isVisible())
+ if (e.action->isVisible())
widgetGeometry.moveLeft(widgetGeometry.left() - delta);
}
}
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index e6d63ee..1a5acbd 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -4319,10 +4319,10 @@ void tst_QLineEdit::clearButtonVisibleAfterSettingText_QTBUG_45518()
#endif // QT_BUILD_INTERNAL
}
-static inline QIcon sideWidgetTestIcon()
+static inline QIcon sideWidgetTestIcon(Qt::GlobalColor color = Qt::yellow)
{
QImage image(QSize(20, 20), QImage::Format_ARGB32);
- image.fill(Qt::yellow);
+ image.fill(color);
return QIcon(QPixmap::fromImage(image));
}
@@ -4360,6 +4360,15 @@ void tst_QLineEdit::sideWidgets()
lineEdit->addAction(iconAction);
}
+template <class T> T *findAssociatedWidget(const QAction *a)
+{
+ foreach (QWidget *w, a->associatedWidgets()) {
+ if (T *result = qobject_cast<T *>(w))
+ return result;
+ }
+ return Q_NULLPTR;
+}
+
void tst_QLineEdit::sideWidgetsActionEvents()
{
// QTBUG-39660, verify whether action events are handled by the widget.
@@ -4369,27 +4378,43 @@ void tst_QLineEdit::sideWidgetsActionEvents()
l->addWidget(lineEdit);
l->addSpacerItem(new QSpacerItem(0, 50, QSizePolicy::Ignored, QSizePolicy::Fixed));
QAction *iconAction = lineEdit->addAction(sideWidgetTestIcon(), QLineEdit::LeadingPosition);
+ QAction *iconAction1 = lineEdit->addAction(sideWidgetTestIcon(Qt::red), QLineEdit::LeadingPosition);
+ QAction *iconAction2 = lineEdit->addAction(sideWidgetTestIcon(Qt::blue), QLineEdit::LeadingPosition);
+ QAction *iconAction3 = lineEdit->addAction(sideWidgetTestIcon(Qt::yellow), QLineEdit::LeadingPosition);
+ iconAction3->setVisible(false);
+
testWidget.move(300, 300);
testWidget.show();
QVERIFY(QTest::qWaitForWindowExposed(&testWidget));
- QWidget *toolButton = Q_NULLPTR;
- foreach (QWidget *w, iconAction->associatedWidgets()) {
- if (qobject_cast<QToolButton *>(w)) {
- toolButton = w;
- break;
- }
- }
- QVERIFY(toolButton);
+ QWidget *toolButton1 = findAssociatedWidget<QToolButton>(iconAction1);
+ QWidget *toolButton2 = findAssociatedWidget<QToolButton>(iconAction2);
+ QWidget *toolButton3 = findAssociatedWidget<QToolButton>(iconAction3);
+
+ QVERIFY(toolButton1);
+ QVERIFY(toolButton2);
+ QVERIFY(toolButton3);
+
+ QVERIFY(!toolButton3->isVisible()); // QTBUG-48899 , action hidden before show().
+
+ QVERIFY(toolButton1->isVisible());
+ QVERIFY(toolButton1->isEnabled());
+
+ QVERIFY(toolButton2->isVisible());
+ QVERIFY(toolButton2->isEnabled());
+
+ const int toolButton1X = toolButton1->x();
+ const int toolButton2X = toolButton2->x();
+ QVERIFY(toolButton1X < toolButton2X); // QTBUG-48806, positioned beside each other.
- QVERIFY(toolButton->isVisible());
- QVERIFY(toolButton->isEnabled());
+ iconAction1->setEnabled(false);
+ QVERIFY(!toolButton1->isEnabled());
- iconAction->setEnabled(false);
- QVERIFY(!toolButton->isEnabled());
+ iconAction1->setVisible(false);
+ QVERIFY(!toolButton1->isVisible());
- iconAction->setVisible(false);
- QVERIFY(!toolButton->isVisible());
+ // QTBUG-39660, button 2 takes position of invisible button 1.
+ QCOMPARE(toolButton2->x(), toolButton1X);
}
Q_DECLARE_METATYPE(Qt::AlignmentFlag)

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
diff -up qtbase-everywhere-src-5.11.1/mkspecs/features/uikit/devices.py.me qtbase-everywhere-src-5.11.1/mkspecs/features/uikit/devices.py
--- qtbase-everywhere-src-5.11.1/mkspecs/features/uikit/devices.py.me 2018-06-23 11:29:21.750066271 +0200
+++ qtbase-everywhere-src-5.11.1/mkspecs/features/uikit/devices.py 2018-06-23 11:30:07.457292033 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
#############################################################################
##

View File

@ -1,14 +0,0 @@
diff -up qtbase-everywhere-src-5.12.1/src/gui/Qt5GuiConfigExtras.cmake.in.foo qtbase-everywhere-src-5.12.1/src/gui/Qt5GuiConfigExtras.cmake.in
--- qtbase-everywhere-src-5.12.1/src/gui/Qt5GuiConfigExtras.cmake.in.foo 2019-04-30 15:18:24.886346423 -0500
+++ qtbase-everywhere-src-5.12.1/src/gui/Qt5GuiConfigExtras.cmake.in 2019-04-30 15:19:48.303873296 -0500
@@ -66,8 +66,10 @@ unset(_GL_INCDIRS)
# Don\'t check for existence of the "_qt5gui_OPENGL_INCLUDE_DIR" because it is
# optional.
+if (NOT ${_qt5gui_OPENGL_INCLUDE_DIR} STREQUAL "/usr/include")
list(APPEND Qt5Gui_INCLUDE_DIRS ${_qt5gui_OPENGL_INCLUDE_DIR})
set_property(TARGET Qt5::Gui APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5gui_OPENGL_INCLUDE_DIR})
+endif()
unset(_qt5gui_OPENGL_INCLUDE_DIR CACHE)

View File

@ -1,16 +0,0 @@
diff -up qtbase-everywhere-src-5.14.2/src/corelib/global/qlibraryinfo.cpp.no_relocatable qtbase-everywhere-src-5.14.2/src/corelib/global/qlibraryinfo.cpp
--- qtbase-everywhere-src-5.14.2/src/corelib/global/qlibraryinfo.cpp.no_relocatable 2020-03-27 04:49:31.000000000 -0500
+++ qtbase-everywhere-src-5.14.2/src/corelib/global/qlibraryinfo.cpp 2020-04-13 15:13:44.075705226 -0500
@@ -671,8 +671,11 @@ static QString getPrefix(
# if QT_CONFIGURE_CROSSBUILD
if (group == QLibraryInfo::DevicePaths)
return QString::fromLocal8Bit(QT_CONFIGURE_PREFIX_PATH);
-# endif
+# elif 0 //QT_CONFIG(relocatable)
return getExtPrefixFromHostBinDir();
+# else
+ return QString::fromLocal8Bit(QT_CONFIGURE_PREFIX_PATH);
+# endif
#elif QT_CONFIG(relocatable)
return getRelocatablePrefix();
#else

View File

@ -1,12 +0,0 @@
diff -up qtbase-everywhere-src-5.12.1/src/plugins/platforms/xcb/qxcbscreen.cpp.hidpi_scale_at_192 qtbase-everywhere-src-5.12.1/src/plugins/platforms/xcb/qxcbscreen.cpp
--- qtbase-everywhere-src-5.12.1/src/plugins/platforms/xcb/qxcbscreen.cpp.hidpi_scale_at_192 2019-02-03 13:21:27.866906481 -0600
+++ qtbase-everywhere-src-5.12.1/src/plugins/platforms/xcb/qxcbscreen.cpp 2019-02-03 13:23:47.554767565 -0600
@@ -744,7 +744,7 @@ void QXcbScreen::updateGeometry(const QR
// 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_pixelDensity = qMax(1, (int) (dpi/referenceDpi)); //instead of rounding at 1.5, round at 2.0 (same as GNOME)
m_geometry = geometry;
m_availableGeometry = geometry & m_virtualDesktop->workArea();
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry);

View File

@ -1,33 +1,39 @@
diff -r -u a/mkspecs/linux-g++/qmake.conf b/mkspecs/linux-g++/qmake.conf
--- a/mkspecs/linux-g++/qmake.conf 2015-10-30 06:20:01.000000000 -0200
+++ b/mkspecs/linux-g++/qmake.conf 2015-11-05 11:23:23.230741601 -0200
@@ -5,6 +5,7 @@
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
+QMAKE_CFLAGS_RELEASE += -O2
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
diff -r -u a/mkspecs/linux-g++-32/qmake.conf b/mkspecs/linux-g++-32/qmake.conf
--- a/mkspecs/linux-g++-32/qmake.conf 2015-10-30 06:20:01.000000000 -0200
+++ b/mkspecs/linux-g++-32/qmake.conf 2015-11-05 11:22:19.761494470 -0200
@@ -10,6 +10,7 @@
diff --git a/mkspecs/linux-g++-32/qmake.conf b/mkspecs/linux-g++-32/qmake.conf
index 340aa85..571a559 100644
--- a/mkspecs/linux-g++-32/qmake.conf
+++ b/mkspecs/linux-g++-32/qmake.conf
@@ -9,6 +9,8 @@ QMAKE_INCREMENTAL_STYLE = sublib
QMAKE_CFLAGS = -m32
QMAKE_LFLAGS = -m32
+QMAKE_CFLAGS_RELEASE += -O2
+QMAKE_CFLAGS_RELEASE += -O2
+
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
diff -r -u a/mkspecs/linux-g++-64/qmake.conf b/mkspecs/linux-g++-64/qmake.conf
--- a/mkspecs/linux-g++-64/qmake.conf 2015-10-30 06:20:01.000000000 -0200
+++ b/mkspecs/linux-g++-64/qmake.conf 2015-11-05 11:22:49.497610248 -0200
@@ -13,6 +13,7 @@
diff --git a/mkspecs/linux-g++-64/qmake.conf b/mkspecs/linux-g++-64/qmake.conf
index 36fb6a8..9a07595 100644
--- a/mkspecs/linux-g++-64/qmake.conf
+++ b/mkspecs/linux-g++-64/qmake.conf
@@ -12,6 +12,8 @@ QMAKE_INCREMENTAL_STYLE = sublib
QMAKE_CFLAGS = -m64
QMAKE_LFLAGS = -m64
+QMAKE_CFLAGS_RELEASE += -O2
+QMAKE_CFLAGS_RELEASE += -O2
+
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
diff --git a/mkspecs/linux-g++/qmake.conf b/mkspecs/linux-g++/qmake.conf
index 35bce8f..5186f98 100644
--- a/mkspecs/linux-g++/qmake.conf
+++ b/mkspecs/linux-g++/qmake.conf
@@ -6,6 +6,8 @@ MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
+QMAKE_CFLAGS_RELEASE += -O2
+
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)

View File

@ -0,0 +1,12 @@
diff -up qtbase-opensource-src-5.2.0/src/gui/text/qfontengine_ft.cpp.lcdfilter qtbase-opensource-src-5.2.0/src/gui/text/qfontengine_ft.cpp
--- qtbase-opensource-src-5.2.0/src/gui/text/qfontengine_ft.cpp.lcdfilter 2013-12-08 11:09:51.000000000 -0600
+++ qtbase-opensource-src-5.2.0/src/gui/text/qfontengine_ft.cpp 2014-01-27 13:09:28.426065603 -0600
@@ -69,7 +69,7 @@
#include FT_CONFIG_OPTIONS_H
#endif
-#if defined(FT_LCD_FILTER_H) && defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING)
+#if defined(FT_LCD_FILTER_H)
#define QT_USE_FREETYPE_LCDFILTER
#endif

View File

@ -0,0 +1,13 @@
diff -up qtbase-opensource-src-5.3.2/src/xml/sax/qxml.cpp.QTBUG-35459 qtbase-opensource-src-5.3.2/src/xml/sax/qxml.cpp
diff -up qtbase-opensource-src-5.3.2/src/xml/sax/qxml_p.h.QTBUG-35459 qtbase-opensource-src-5.3.2/src/xml/sax/qxml_p.h
--- qtbase-opensource-src-5.3.2/src/xml/sax/qxml_p.h.QTBUG-35459 2014-09-11 05:48:05.000000000 -0500
+++ qtbase-opensource-src-5.3.2/src/xml/sax/qxml_p.h 2014-09-16 09:35:01.189255615 -0500
@@ -223,7 +223,7 @@ private:
// for the DTD currently being parsed.
static const int dtdRecursionLimit = 2;
// The maximum amount of characters an entity value may contain, after expansion.
- static const int entityCharacterLimit = 1024;
+ static const int entityCharacterLimit = 65536;
const QString &string();
void stringClear();

View File

@ -0,0 +1,12 @@
diff -up qtbase-opensource-src-5.4.0/src/tools/qdoc/qdocindexfiles.cpp.QTBUG-43057 qtbase-opensource-src-5.4.0/src/tools/qdoc/qdocindexfiles.cpp
--- qtbase-opensource-src-5.4.0/src/tools/qdoc/qdocindexfiles.cpp.QTBUG-43057 2014-12-05 10:24:31.000000000 -0600
+++ qtbase-opensource-src-5.4.0/src/tools/qdoc/qdocindexfiles.cpp 2014-12-17 14:47:19.393037164 -0600
@@ -1327,7 +1327,7 @@ void QDocIndexFiles::generateIndexSectio
const InnerNode* inner = static_cast<const InnerNode*>(node);
NodeList cnodes = inner->childNodes();
- std::sort(cnodes.begin(), cnodes.end(), compareNodes);
+ qSort(cnodes.begin(), cnodes.end(), compareNodes);
foreach (Node* child, cnodes) {
generateIndexSections(writer, child, generateInternalNodes);

View File

@ -0,0 +1,196 @@
diff --git a/configure b/configure
index 5ad29bb..7ff0df1 100644
--- a/configure
+++ b/configure
@@ -5060,10 +5060,8 @@ if [ "$CFG_XCB" != "no" ]; then
QMAKE_LIBS_XCB="`$PKG_CONFIG --libs $XCB_PACKAGES 2>/dev/null`"
fi
- # libxcb version 1.10 was the first version that enables xcb-xkb by default,
- # therefore the minimal xcb-xkb version we support is 1.10
CFG_XKB=no
- if $PKG_CONFIG --exists "xcb-xkb >= 1.10" 2>/dev/null; then
+ if $PKG_CONFIG --exists "xcb-xkb" 2>/dev/null; then
QMAKE_CFLAGS_XKB="`$PKG_CONFIG --cflags xcb xcb-xkb 2>/dev/null`"
QMAKE_LIBS_XKB="`$PKG_CONFIG --libs xcb xcb-xkb 2>/dev/null`"
if compileTest qpa/xcb-xkb "xcb-xkb" $QMAKE_CFLAGS_XKB $QMAKE_LIBS_XKB; then
@@ -5172,16 +5170,16 @@ MIN_REQ_XKBCOMMON="0.4.1"
if [ "$CFG_XCB" != "no" ]; then
if [ "$CFG_XKBCOMMON" != "no" ] && [ "$CFG_XKBCOMMON" != "qt" ]; then
# Check if there is a suitable system-wide xkbcommon
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xkbcommon xkbcommon-x11 >= $MIN_REQ_XKBCOMMON" 2>/dev/null; then
- QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon xkbcommon-x11 2>/dev/null`"
- QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon xkbcommon-x11 2>/dev/null`"
+ if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xkbcommon >= $MIN_REQ_XKBCOMMON" 2>/dev/null; then
+ QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
+ QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
QMakeVar set QMAKE_CFLAGS_XKBCOMMON "$QMAKE_CFLAGS_XKBCOMMON"
QMakeVar set QMAKE_LIBS_XKBCOMMON "$QMAKE_LIBS_XKBCOMMON"
CFG_XKBCOMMON=system
elif [ "$CFG_XKBCOMMON" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo " xkbcommon support cannot be enabled because either xkbcommon or "
- echo " xkbcommon-x11 >= $MIN_REQ_XKBCOMMON was not found via pkg-config!"
+ echo " xkbcommon support cannot be enabled because xkbcommon"
+ echo " >= $MIN_REQ_XKBCOMMON was not found via pkg-config!"
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
echo " Turn on verbose messaging (-v) to $0 to see the final report."
echo " If you believe this message is in error you may use the continue"
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 5510c3b..4762977 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -1761,7 +1761,7 @@ void QXcbConnection::initializeXKB()
xcb_xkb_use_extension_cookie_t xkb_query_cookie;
xcb_xkb_use_extension_reply_t *xkb_query;
- xkb_query_cookie = xcb_xkb_use_extension(c, XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION);
+ xkb_query_cookie = xcb_xkb_use_extension(c, XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION);
xkb_query = xcb_xkb_use_extension_reply(c, xkb_query_cookie, 0);
if (!xkb_query) {
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 5fb7457..487c3ba 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -693,50 +693,65 @@ void QXcbKeyboard::updateKeymap()
// log only critical errors, we do our own error logging from printKeymapError()
xkb_context_set_log_level(xkb_context, (xkb_log_level)XKB_LOG_LEVEL_CRITICAL);
}
- // update xkb keymap object
- xkb_keymap_unref(xkb_keymap);
- xkb_keymap = 0;
- struct xkb_state *new_state = 0;
-#ifndef QT_NO_XKB
- if (connection()->hasXKB()) {
- xkb_keymap = xkb_x11_keymap_new_from_device(xkb_context, xcb_connection(), core_device_id, (xkb_keymap_compile_flags)0);
- if (xkb_keymap) {
- // Create a new keyboard state object for a keymap
- new_state = xkb_x11_state_new_from_device(xkb_keymap, xcb_connection(), core_device_id);
- }
- }
-#endif
+ readXKBConfig();
+ // Compile a keymap from RMLVO (rules, models, layouts, variants and options) names
+ if (xkb_keymap)
+ xkb_keymap_unref(xkb_keymap);
+
+ xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0);
if (!xkb_keymap) {
- // Compile a keymap from RMLVO (rules, models, layouts, variants and options) names
- readXKBConfig();
+ // last fallback is to used hard-coded keymap name, see DEFAULT_XKB_* in xkbcommon.pri
+ qWarning() << "Qt: Could not determine keyboard configuration data"
+ " from X server, will use hard-coded keymap configuration.";
+ clearXKBConfig();
xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0);
- if (!xkb_keymap) {
- // last fallback is to used hard-coded keymap name, see DEFAULT_XKB_* in xkbcommon.pri
- qWarning() << "Qt: Could not determine keyboard configuration data"
- " from X server, will use hard-coded keymap configuration.";
- clearXKBConfig();
- xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0);
- }
- if (xkb_keymap) {
- new_state = xkb_state_new(xkb_keymap);
- } else {
- printKeymapError("Qt: Failed to compile a keymap!");
- m_config = false;
- return;
- }
-
}
+ if (!xkb_keymap) {
+ printKeymapError("Qt: Failed to compile a keymap!");
+ m_config = false;
+ return;
+ }
+
+ struct xkb_state *new_state = xkb_state_new(xkb_keymap);
if (!new_state) {
qWarning("Qt: Failed to create xkb state!");
m_config = false;
return;
}
- // update xkb state object
- xkb_state_unref(xkb_state);
- xkb_state = new_state;
- if (!connection()->hasXKB())
- updateXKBMods();
+
+ if (xkb_state) {
+ xkb_state_unref(xkb_state);
+ xkb_state = new_state;
+ } else {
+ xkb_state = new_state;
+#ifndef QT_NO_XKB
+ if (connection()->hasXKB()) {
+ // get initial state from the X server (and keep it up-to-date at all times)
+ xcb_xkb_get_state_cookie_t state;
+ xcb_xkb_get_state_reply_t *init_state;
+
+ xcb_connection_t *c = xcb_connection();
+ state = xcb_xkb_get_state(c, XCB_XKB_ID_USE_CORE_KBD);
+ init_state = xcb_xkb_get_state_reply(c, state, 0);
+ if (!init_state) {
+ qWarning("Qt: couldn't retrieve an initial keyboard state");
+ return;
+ }
+ /* The xkb keyboard state is comprised of the state of all keyboard modifiers,
+ the keyboard group, and the state of the pointer buttons */
+ xkb_state_update_mask(xkb_state,
+ init_state->baseMods,
+ init_state->latchedMods,
+ init_state->lockedMods,
+ init_state->baseGroup,
+ init_state->latchedGroup,
+ init_state->lockedGroup);
+ free(init_state);
+ } else
+#endif
+ updateXKBMods();
+ }
checkForLatinLayout();
}
@@ -1097,11 +1112,23 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection)
if (connection->hasXKB()) {
updateVModMapping();
updateVModToRModMapping();
- core_device_id = xkb_x11_get_core_keyboard_device_id(xcb_connection());
- if (core_device_id == -1) {
+
+ // get the core keyboard id
+ xcb_xkb_get_device_info_cookie_t device_id_cookie;
+ xcb_xkb_get_device_info_reply_t *device_id;
+
+ device_id_cookie = xcb_xkb_get_device_info(xcb_connection(),
+ XCB_XKB_ID_USE_CORE_KBD,
+ 0, 0, 0, 0, 0, 0);
+
+ device_id = xcb_xkb_get_device_info_reply(xcb_connection(), device_id_cookie, 0);
+ if (!device_id) {
qWarning("Qt: couldn't get core keyboard device info");
return;
}
+
+ core_device_id = device_id->deviceID;
+ free(device_id);
} else {
#endif
m_key_symbols = xcb_key_symbols_alloc(xcb_connection());
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h
index 9f1cf16..3beee7b 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
@@ -39,9 +39,6 @@
#include <xcb/xcb_keysyms.h>
#include <xkbcommon/xkbcommon.h>
-#ifndef QT_NO_XKB
-#include <xkbcommon/xkbcommon-x11.h>
-#endif
#include <QEvent>

View File

@ -0,0 +1,77 @@
diff -ur qtbase-opensource-src-5.4.0-rc-old_xcb/configure qtbase-opensource-src-5.4.0-rc-old_xkbcommon/configure
--- qtbase-opensource-src-5.4.0-rc-old_xcb/configure 2014-11-29 03:07:40.000000000 +0100
+++ qtbase-opensource-src-5.4.0-rc-old_xkbcommon/configure 2014-11-29 03:32:16.000000000 +0100
@@ -5144,7 +5144,7 @@
fi
# Detect libxkbcommon
-MIN_REQ_XKBCOMMON="0.4.1"
+MIN_REQ_XKBCOMMON="0.3.0"
# currently only xcb platform plugin supports building xkbcommon
if [ "$CFG_XCB" != "no" ]; then
if [ "$CFG_XKBCOMMON" != "no" ] && [ "$CFG_XKBCOMMON" != "qt" ]; then
diff -ur qtbase-opensource-src-5.4.0-rc-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp qtbase-opensource-src-5.4.0-rc-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.cpp
--- qtbase-opensource-src-5.4.0-rc-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-11-29 03:29:53.000000000 +0100
+++ qtbase-opensource-src-5.4.0-rc-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-11-29 03:35:36.000000000 +0100
@@ -971,7 +971,7 @@
}
QList<int> result;
- int baseQtKey = keysymToQtKey(sym, modifiers, lookupString(kb_state, keycode));
+ int baseQtKey = keysymToQtKey(sym, modifiers, keysymToUnicode(sym));
result += (baseQtKey + modifiers); // The base key is _always_ valid, of course
xkb_mod_index_t shiftMod = xkb_keymap_mod_get_index(xkb_keymap, "Shift");
@@ -1008,7 +1008,7 @@
continue;
Qt::KeyboardModifiers mods = modifiers & ~neededMods;
- qtKey = keysymToQtKey(sym, mods, lookupString(kb_state, keycode));
+ qtKey = keysymToQtKey(sym, mods, keysymToUnicode(sym));
if (!qtKey || qtKey == baseQtKey)
continue;
@@ -1462,7 +1462,7 @@
return;
}
- QString string = lookupString(xkb_state, code);
+ QString string = keysymToUnicode(sym);
int count = string.size();
string.truncate(count);
@@ -1535,12 +1535,18 @@
}
}
-QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) const
+QString QXcbKeyboard::keysymToUnicode(xcb_keysym_t sym) const
{
QByteArray chars;
- chars.resize(1 + xkb_state_key_get_utf8(state, code, 0, 0));
- // equivalent of XLookupString
- xkb_state_key_get_utf8(state, code, chars.data(), chars.size());
+ int bytes;
+ chars.resize(7);
+
+ bytes = xkb_keysym_to_utf8(sym, chars.data(), chars.size());
+
+ if (bytes == -1)
+ qWarning("QXcbKeyboard::handleKeyEvent - buffer too small");
+ chars.resize(bytes-1);
+
return QString::fromUtf8(chars);
}
diff -ur qtbase-opensource-src-5.4.0-rc-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.h qtbase-opensource-src-5.4.0-rc-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.h
--- qtbase-opensource-src-5.4.0-rc-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-11-29 03:07:40.000000000 +0100
+++ qtbase-opensource-src-5.4.0-rc-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-11-29 03:32:16.000000000 +0100
@@ -75,7 +75,7 @@
void handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time);
void resolveMaskConflicts();
- QString lookupString(struct xkb_state *state, xcb_keycode_t code) const;
+ QString keysymToUnicode(xcb_keysym_t sym) const;
int keysymToQtKey(xcb_keysym_t keysym) const;
int keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, QString text) const;
void printKeymapError(const char *error) const;

View File

@ -0,0 +1,41 @@
diff -rupN qtbase-opensource-src-5.5.0/src/gui/kernel/qplatformintegration.cpp qtbase-opensource-src-5.5.0-new/src/gui/kernel/qplatformintegration.cpp
--- qtbase-opensource-src-5.5.0/src/gui/kernel/qplatformintegration.cpp 2015-06-29 22:04:53.000000000 +0200
+++ qtbase-opensource-src-5.5.0-new/src/gui/kernel/qplatformintegration.cpp 2015-07-12 10:24:17.195000304 +0200
@@ -456,6 +456,14 @@ void QPlatformIntegration::screenAdded(Q
} else {
QGuiApplicationPrivate::screen_list.append(screen);
}
+
+ // All screens might have been removed before a new one is added, so
+ // iterate over the toplevel windows and set their screen to the current
+ // primary screen if the window has no screen set
+ foreach (QWindow *window, QGuiApplication::topLevelWindows()) {
+ if (window->screen() == 0)
+ window->setScreen(QGuiApplicationPrivate::screen_list.at(0));
+ }
emit qGuiApp->screenAdded(screen);
}
diff -rupN qtbase-opensource-src-5.5.0/src/gui/kernel/qwindow.cpp qtbase-opensource-src-5.5.0-new/src/gui/kernel/qwindow.cpp
--- qtbase-opensource-src-5.5.0/src/gui/kernel/qwindow.cpp 2015-06-29 22:04:52.000000000 +0200
+++ qtbase-opensource-src-5.5.0-new/src/gui/kernel/qwindow.cpp 2015-07-12 11:51:18.832889497 +0200
@@ -372,15 +372,14 @@ void QWindowPrivate::setTopLevelScreen(Q
return;
}
if (newScreen != topLevelScreen) {
- const bool shouldRecreate = recreate && windowRecreationRequired(newScreen);
- const bool shouldShow = visibilityOnDestroy && !topLevelScreen;
+ const bool shouldRecreate = recreate/* && windowRecreationRequired(newScreen)*/;
if (shouldRecreate && platformWindow)
q->destroy();
connectToScreen(newScreen);
- if (shouldShow)
- q->setVisible(true);
- else if (newScreen && shouldRecreate)
+ if (newScreen && shouldRecreate) {
create(true);
+ q->setVisible(visibilityOnDestroy);
+ }
emitScreenChangedRecursion(newScreen);
}
}

View File

@ -0,0 +1,14 @@
diff -up qtbase-opensource-src-5.4.1/src/dbus/qdbusconnection.cpp.qdbusconnection_no_debug qtbase-opensource-src-5.4.1/src/dbus/qdbusconnection.cpp
--- qtbase-opensource-src-5.4.1/src/dbus/qdbusconnection.cpp.qdbusconnection_no_debug 2015-02-16 22:56:38.000000000 -0600
+++ qtbase-opensource-src-5.4.1/src/dbus/qdbusconnection.cpp 2015-04-25 10:48:52.099668703 -0500
@@ -1056,8 +1056,10 @@ public:
// make sure this connection is running on the main thread
QCoreApplication *instance = QCoreApplication::instance();
if (!instance) {
+#ifndef QT_NO_DEBUG
qWarning("QDBusConnection: %s D-Bus connection created before QCoreApplication. Application may misbehave.",
type == SessionBus ? "session" : type == SystemBus ? "system" : "generic");
+#endif
} else if (QDBusConnectionPrivate::d(*this)) {
QDBusConnectionPrivate::d(*this)->moveToThread(instance->thread());
}

View File

@ -1,15 +0,0 @@
diff -up qtbase-opensource-src-5.7.1/src/tools/moc/main.cpp.moc_WORDSIZE qtbase-opensource-src-5.7.1/src/tools/moc/main.cpp
--- qtbase-opensource-src-5.7.1/src/tools/moc/main.cpp.moc_WORDSIZE 2016-12-01 02:17:04.000000000 -0600
+++ qtbase-opensource-src-5.7.1/src/tools/moc/main.cpp 2016-12-08 12:37:28.931589338 -0600
@@ -179,6 +179,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;

View File

@ -1,11 +0,0 @@
--- qtbase-opensource-src-5.8.0/src/corelib/global/qglobal.h.orig 2017-01-26 10:45:40.905010896 +0100
+++ qtbase-opensource-src-5.8.0/src/corelib/global/qglobal.h 2017-01-26 10:46:50.299858887 +0100
@@ -55,7 +55,7 @@
/*
can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 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))
#ifdef QT_BOOTSTRAPPED
#include <QtCore/qconfig-bootstrapped.h>

View File

@ -1,12 +0,0 @@
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

View File

@ -1,12 +0,0 @@
diff -up qtbase-everywhere-src-5.10.1/qmake/Makefile.unix.qmake_LFLAGS qtbase-everywhere-src-5.10.1/qmake/Makefile.unix
--- qtbase-everywhere-src-5.10.1/qmake/Makefile.unix.qmake_LFLAGS 2018-02-08 12:24:48.000000000 -0600
+++ qtbase-everywhere-src-5.10.1/qmake/Makefile.unix 2018-02-15 10:25:07.077763061 -0600
@@ -142,7 +142,7 @@ CPPFLAGS = -g $(EXTRA_CPPFLAGS) \
-DQT_NO_FOREACH
CXXFLAGS = $(EXTRA_CXXFLAGS) $(CONFIG_CXXFLAGS) $(CPPFLAGS)
-LFLAGS = $(EXTRA_LFLAGS) $(CONFIG_LFLAGS)
+LFLAGS = $(EXTRA_LFLAGS) $(CONFIG_LFLAGS) $(QMAKE_LFLAGS_RELEASE)
first all: $(BUILD_PATH)/bin/qmake$(EXEEXT)
qmake: $(BUILD_PATH)/bin/qmake$(EXEEXT)

View File

@ -1,20 +0,0 @@
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index b8bfad4f16..676fdfad5e 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1376,14 +1376,7 @@ void QGuiApplicationPrivate::createPlatformIntegration()
if (sessionType == QByteArrayLiteral("x11") && !platformName.contains(QByteArrayLiteral("xcb"))) {
platformName = QByteArrayLiteral("xcb");
} else if (sessionType == QByteArrayLiteral("wayland") && !platformName.contains(QByteArrayLiteral("wayland"))) {
- QByteArray currentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toLower();
- QByteArray sessionDesktop = qgetenv("XDG_SESSION_DESKTOP").toLower();
- if (currentDesktop.contains("gnome") || sessionDesktop.contains("gnome")) {
- qInfo() << "Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome."
- << "Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.";
- } else {
- platformName = QByteArrayLiteral("wayland");
- }
+ platformName = QByteArrayLiteral("wayland");
}
}
#ifdef QT_QPA_DEFAULT_PLATFORM_NAME

View File

@ -1,3 +0,0 @@
[Rules]
*.debug=false
qt.qpa.xcb.xcberror.warning=false

View File

@ -1 +1 @@
SHA512 (qtbase-everywhere-src-5.14.2.tar.xz) = 8c83e06d58b56e9f288e83d6c3dd4ad6cc9f1eb1a32c7b44fb912fda34ed7255766fd9fa60cd740ee001df7d6172f25df05f1f95e986c3e793fbcd9bf4f18de9
687e2b122fa2c3390b5e20a166d38038 qtbase-opensource-src-5.5.1.tar.xz

View File

@ -1 +0,0 @@
qtbase-everywhere-src

View File

@ -1,16 +0,0 @@
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index e6a0d97..cf93041 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -216,9 +216,9 @@ android: CONFIG += qt_android_deps no_linker_version_script
QMAKE_LFLAGS += $${QMAKE_LFLAGS_VERSION_SCRIPT}$$verscript
internal_module {
- verscript_content = "Qt_$${QT_MAJOR_VERSION}_PRIVATE_API { *; };"
+ verscript_content = "Qt_$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}_PRIVATE_API { *; };"
} else {
- verscript_content = "Qt_$${QT_MAJOR_VERSION}_PRIVATE_API {" \
+ verscript_content = "Qt_$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}_PRIVATE_API {" \
" qt_private_api_tag*;"
private_api_headers = $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.QPA_HEADER_FILES