Accepting request 238711 from KDE:Qt5

- Update to 5.3.1
  * Bugfix release, for more details please see:
    http://blog.qt.digia.com/blog/2014/06/25/qt-5-3-1-released/
- Drop libqt5-fix-the-modal-dialogs-can-go-behind.patch, merged upstream
- Added patches from upstream:
  0001-Do-not-overwrite-existing-event-mask-of-root-window.patch -- QTBUG-39648
  0002-Properly-check-which-OpenGL-features-are-supported.patch -- QTBUG-39730
  0003-Fix-data-race-on-QLoggingCategory-when-using-qDebug-.patch -- Fix data race on QLoggingCategory
  0004-QDBus-fix-data-race-on-isDebugging-bool.patch -- fix data race on isDebugging bool
  0005-Translate-Super-Hyper-keys-to-MetaModifier.patch -- QTBUG-38428

OBS-URL: https://build.opensuse.org/request/show/238711
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=22
This commit is contained in:
Stephan Kulow 2014-06-30 19:44:19 +00:00 committed by Git OBS Bridge
parent 6fe871c76c
commit 154cc92f96
10 changed files with 533 additions and 381 deletions

View File

@ -0,0 +1,50 @@
From 075c36e39beedb33ec4b239d57075f54acb21acf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= <mgraesslin@kde.org>
Date: Mon, 16 Jun 2014 14:20:05 +0200
Subject: [PATCH 1/1] Do not overwrite existing event mask of root window
QXcbScreen installs its own event mask on the screen's root window.
This overwrites any existing event mask already set and by that
breaks applications when a new screen is added.
By first fetching the existing event mask and adding it to the newly
installed event mask, Qt does no longer break applications also
installing an event mask on the root window.
Task-number: QTBUG-39648
Change-Id: I8686dd6ae49d0e807c6fe1ea4a231ff728bfcf25
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
---
src/plugins/platforms/xcb/qxcbscreen.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 9f19841..01e7846 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -106,6 +106,11 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
qDebug(" root ID........: %x", screen()->root);
#endif
+ QScopedPointer<xcb_get_window_attributes_reply_t, QScopedPointerPodDeleter> rootAttribs(
+ xcb_get_window_attributes_reply(xcb_connection(),
+ xcb_get_window_attributes_unchecked(xcb_connection(), screen()->root), NULL));
+ const quint32 existingEventMask = rootAttribs.isNull() ? 0 : rootAttribs->your_event_mask;
+
const quint32 mask = XCB_CW_EVENT_MASK;
const quint32 values[] = {
// XCB_CW_EVENT_MASK
@@ -113,6 +118,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
| XCB_EVENT_MASK_LEAVE_WINDOW
| XCB_EVENT_MASK_PROPERTY_CHANGE
| XCB_EVENT_MASK_STRUCTURE_NOTIFY // for the "MANAGER" atom (system tray notification).
+ | existingEventMask // don't overwrite the event mask on the root window
};
xcb_change_window_attributes(xcb_connection(), screen()->root, mask, values);
--
1.9.3

View File

@ -0,0 +1,120 @@
From 473ed1c1aa67ceb345b20d13c408ed8bd65a9e41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= <mgraesslin@kde.org>
Date: Wed, 18 Jun 2014 13:03:15 +0200
Subject: [PATCH 1/1] Properly check which OpenGL features are supported
QOpenGLShaderProgram::hasOpenGLShaderPrograms tests whether
QOpenGLFunctions::Shaders is provided for the given context. As the
initialization code assumed OpenGL 2 this always was true. But
unfortunately we still cannot assume that OpenGL 2 is universally
supported. E.g. indirect rendering (no matter how bad that idea is)
does not support OpenGL 2 on all hardware and the Shader related
extensions are not available.
This change makes sure that only when OpenGL 2 is available the
features provided by OpenGL 2 are enabled. If OpenGL 2 is not
available the extensions are tested. The checks are slightly
reordered to not do the extension tests at all if OpenGL 2 is
available.
Task-number: QTBUG-39730
Change-Id: Ic775163e0dcc519925b1287f3c4ca5e8ebf101d5
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
---
src/gui/opengl/qopenglfunctions.cpp | 78 +++++++++++++++++++------------------
1 file changed, 40 insertions(+), 38 deletions(-)
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index a0d1775..bc4a714 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -283,46 +283,48 @@ static int qt_gl_resolve_features()
QSurfaceFormat format = QOpenGLContext::currentContext()->format();
QOpenGLExtensionMatcher extensions;
- // Recognize features by extension name.
- if (extensions.match("GL_ARB_multitexture"))
- features |= QOpenGLFunctions::Multitexture;
- if (extensions.match("GL_ARB_shader_objects"))
- features |= QOpenGLFunctions::Shaders;
- if (extensions.match("GL_EXT_framebuffer_object") ||
- extensions.match("GL_ARB_framebuffer_object"))
- features |= QOpenGLFunctions::Framebuffers;
- if (extensions.match("GL_EXT_blend_color"))
- features |= QOpenGLFunctions::BlendColor;
- if (extensions.match("GL_EXT_blend_equation_separate"))
- features |= QOpenGLFunctions::BlendEquationSeparate;
- if (extensions.match("GL_EXT_blend_func_separate"))
- features |= QOpenGLFunctions::BlendFuncSeparate;
- if (extensions.match("GL_EXT_blend_subtract"))
- features |= QOpenGLFunctions::BlendSubtract;
- if (extensions.match("GL_ARB_texture_compression"))
- features |= QOpenGLFunctions::CompressedTextures;
- if (extensions.match("GL_ARB_multisample"))
- features |= QOpenGLFunctions::Multisample;
- if (extensions.match("GL_ARB_texture_non_power_of_two"))
- features |= QOpenGLFunctions::NPOTTextures |
- QOpenGLFunctions::NPOTTextureRepeat;
-
- // assume version 2.0 or higher
- features |= QOpenGLFunctions::BlendColor |
- QOpenGLFunctions::BlendEquation |
- QOpenGLFunctions::Multitexture |
- QOpenGLFunctions::CompressedTextures |
- QOpenGLFunctions::Multisample |
- QOpenGLFunctions::BlendFuncSeparate |
- QOpenGLFunctions::Buffers |
- QOpenGLFunctions::Shaders |
- QOpenGLFunctions::StencilSeparate |
- QOpenGLFunctions::BlendEquationSeparate |
- QOpenGLFunctions::NPOTTextures |
- QOpenGLFunctions::NPOTTextureRepeat;
-
if (format.majorVersion() >= 3)
features |= QOpenGLFunctions::Framebuffers;
+ else if (extensions.match("GL_EXT_framebuffer_object") ||
+ extensions.match("GL_ARB_framebuffer_object"))
+ features |= QOpenGLFunctions::Framebuffers;
+
+ if (format.majorVersion() >= 2) {
+ features |= QOpenGLFunctions::BlendColor |
+ QOpenGLFunctions::BlendEquation |
+ QOpenGLFunctions::BlendSubtract |
+ QOpenGLFunctions::Multitexture |
+ QOpenGLFunctions::CompressedTextures |
+ QOpenGLFunctions::Multisample |
+ QOpenGLFunctions::BlendFuncSeparate |
+ QOpenGLFunctions::Buffers |
+ QOpenGLFunctions::Shaders |
+ QOpenGLFunctions::StencilSeparate |
+ QOpenGLFunctions::BlendEquationSeparate |
+ QOpenGLFunctions::NPOTTextures |
+ QOpenGLFunctions::NPOTTextureRepeat;
+ } else {
+ // Recognize features by extension name.
+ if (extensions.match("GL_ARB_multitexture"))
+ features |= QOpenGLFunctions::Multitexture;
+ if (extensions.match("GL_ARB_shader_objects"))
+ features |= QOpenGLFunctions::Shaders;
+ if (extensions.match("GL_EXT_blend_color"))
+ features |= QOpenGLFunctions::BlendColor;
+ if (extensions.match("GL_EXT_blend_equation_separate"))
+ features |= QOpenGLFunctions::BlendEquationSeparate;
+ if (extensions.match("GL_EXT_blend_subtract"))
+ features |= QOpenGLFunctions::BlendSubtract;
+ if (extensions.match("GL_EXT_blend_func_separate"))
+ features |= QOpenGLFunctions::BlendFuncSeparate;
+ if (extensions.match("GL_ARB_texture_compression"))
+ features |= QOpenGLFunctions::CompressedTextures;
+ if (extensions.match("GL_ARB_multisample"))
+ features |= QOpenGLFunctions::Multisample;
+ if (extensions.match("GL_ARB_texture_non_power_of_two"))
+ features |= QOpenGLFunctions::NPOTTextures |
+ QOpenGLFunctions::NPOTTextureRepeat;
+ }
const QPair<int, int> version = format.version();
if (version < qMakePair(3, 0)
--
1.9.3

View File

@ -0,0 +1,236 @@
From 884b38157689a893ace0a4c793fab921167abb2c Mon Sep 17 00:00:00 2001
From: David Faure <david.faure@kdab.com>
Date: Sun, 8 Jun 2014 21:46:24 +0200
Subject: [PATCH 1/1] Fix data race on QLoggingCategory when using qDebug from
multiple threads
setEnabled() would race with isEnabled()/isDebugEnabled()/etc.
Change-Id: I2004cba81d5417a634b97f5c2f98d3a4ab71770d
Reviewed-by: David Faure <david.faure@kdab.com>
---
src/corelib/arch/qatomic_bootstrap.h | 4 ++-
src/corelib/io/qloggingcategory.cpp | 36 ++++++++++++++++++--------
src/corelib/io/qloggingcategory.h | 35 +++++++++++++++++++------
tests/auto/corelib/io/qdebug/qdebug.pro | 2 +-
tests/auto/corelib/io/qdebug/tst_qdebug.cpp | 40 +++++++++++++++++++++++++++++
5 files changed, 97 insertions(+), 20 deletions(-)
diff --git a/src/corelib/arch/qatomic_bootstrap.h b/src/corelib/arch/qatomic_bootstrap.h
index 7f17387..0d6843a 100644
--- a/src/corelib/arch/qatomic_bootstrap.h
+++ b/src/corelib/arch/qatomic_bootstrap.h
@@ -67,8 +67,10 @@ template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> >
return --_q_value != 0;
}
- static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
+ static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue = 0) Q_DECL_NOTHROW
{
+ if (currentValue)
+ *currentValue = _q_value;
if (_q_value == expectedValue) {
_q_value = newValue;
return true;
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index 518052e..45fab11 100644
--- a/src/corelib/io/qloggingcategory.cpp
+++ b/src/corelib/io/qloggingcategory.cpp
@@ -50,6 +50,18 @@ const char qtDefaultCategoryName[] = "default";
Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
(qtDefaultCategoryName))
+#ifndef Q_ATOMIC_INT8_IS_SUPPORTED
+static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
+{
+ const int bit = 1 << shift;
+
+ if (enable)
+ atomic->fetchAndOrRelaxed(bit);
+ else
+ atomic->fetchAndAndRelaxed(~bit);
+}
+#endif
+
/*!
\class QLoggingCategory
\inmodule QtCore
@@ -171,13 +183,11 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
*/
QLoggingCategory::QLoggingCategory(const char *category)
: d(0),
- name(0),
- enabledDebug(true),
- enabledWarning(true),
- enabledCritical(true)
+ name(0)
{
Q_UNUSED(d);
Q_UNUSED(placeholder);
+ enabled.store(0x01010101); // enabledDebug = enabledWarning = enabledCritical = true;
const bool isDefaultCategory
= (category == 0) || (strcmp(category, qtDefaultCategoryName) == 0);
@@ -249,9 +259,9 @@ QLoggingCategory::~QLoggingCategory()
bool QLoggingCategory::isEnabled(QtMsgType msgtype) const
{
switch (msgtype) {
- case QtDebugMsg: return enabledDebug;
- case QtWarningMsg: return enabledWarning;
- case QtCriticalMsg: return enabledCritical;
+ case QtDebugMsg: return isDebugEnabled();
+ case QtWarningMsg: return isWarningEnabled();
+ case QtCriticalMsg: return isCriticalEnabled();
case QtFatalMsg: return true;
}
return false;
@@ -270,9 +280,15 @@ bool QLoggingCategory::isEnabled(QtMsgType msgtype) const
void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
{
switch (type) {
- case QtDebugMsg: enabledDebug = enable; break;
- case QtWarningMsg: enabledWarning = enable; break;
- case QtCriticalMsg: enabledCritical = enable; break;
+#ifdef Q_ATOMIC_INT8_IS_SUPPORTED
+ case QtDebugMsg: bools.enabledDebug.store(enable); break;
+ case QtWarningMsg: bools.enabledWarning.store(enable); break;
+ case QtCriticalMsg: bools.enabledCritical.store(enable); break;
+#else
+ case QtDebugMsg: setBoolLane(&enabled, enable, DebugShift); break;
+ case QtWarningMsg: setBoolLane(&enabled, enable, WarningShift); break;
+ case QtCriticalMsg: setBoolLane(&enabled, enable, CriticalShift); break;
+#endif
case QtFatalMsg: break;
}
}
diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h
index 4aec8e6..573af21 100644
--- a/src/corelib/io/qloggingcategory.h
+++ b/src/corelib/io/qloggingcategory.h
@@ -57,10 +57,15 @@ public:
bool isEnabled(QtMsgType type) const;
void setEnabled(QtMsgType type, bool enable);
- bool isDebugEnabled() const { return enabledDebug; }
- bool isWarningEnabled() const { return enabledWarning; }
- bool isCriticalEnabled() const { return enabledCritical; }
-
+#ifdef Q_ATOMIC_INT8_IS_SUPPORTED
+ bool isDebugEnabled() const { return bools.enabledDebug.load(); }
+ bool isWarningEnabled() const { return bools.enabledWarning.load(); }
+ bool isCriticalEnabled() const { return bools.enabledCritical.load(); }
+#else
+ bool isDebugEnabled() const { return enabled.load() >> DebugShift & 1; }
+ bool isWarningEnabled() const { return enabled.load() >> WarningShift & 1; }
+ bool isCriticalEnabled() const { return enabled.load() >> CriticalShift & 1; }
+#endif
const char *categoryName() const { return name; }
// allows usage of both factory method and variable in qCX macros
@@ -78,10 +83,24 @@ private:
void *d; // reserved for future use
const char *name;
- bool enabledDebug;
- bool enabledWarning;
- bool enabledCritical;
- bool placeholder[5]; // reserve for future use
+#ifdef Q_BIG_ENDIAN
+ enum { DebugShift = 0, WarningShift = 8, CriticalShift = 16 };
+#else
+ enum { DebugShift = 24, WarningShift = 16, CriticalShift = 8 };
+#endif
+
+ struct AtomicBools {
+#ifdef Q_ATOMIC_INT8_IS_SUPPORTED
+ QBasicAtomicInteger<bool> enabledDebug;
+ QBasicAtomicInteger<bool> enabledWarning;
+ QBasicAtomicInteger<bool> enabledCritical;
+#endif
+ };
+ union {
+ AtomicBools bools;
+ QBasicAtomicInt enabled;
+ };
+ bool placeholder[4]; // reserve for future use
};
#define Q_DECLARE_LOGGING_CATEGORY(name) \
diff --git a/tests/auto/corelib/io/qdebug/qdebug.pro b/tests/auto/corelib/io/qdebug/qdebug.pro
index 820c17f..5e902bb 100644
--- a/tests/auto/corelib/io/qdebug/qdebug.pro
+++ b/tests/auto/corelib/io/qdebug/qdebug.pro
@@ -1,5 +1,5 @@
CONFIG += testcase parallel_test
TARGET = tst_qdebug
-QT = core testlib
+QT = core testlib concurrent
SOURCES = tst_qdebug.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index 80144db..8fd830a 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -44,6 +44,9 @@
#include <QtCore/QtDebug>
#include <QtTest/QtTest>
+#include <QtConcurrentRun>
+#include <QFutureSynchronizer>
+
class tst_QDebug: public QObject
{
Q_OBJECT
@@ -59,6 +62,7 @@ private slots:
void qDebugQLatin1String() const;
void textStreamModifiers() const;
void defaultMessagehandler() const;
+ void threadSafety() const;
};
void tst_QDebug::assignment() const
@@ -305,5 +309,41 @@ void tst_QDebug::defaultMessagehandler() const
QVERIFY(same);
}
+QMutex s_mutex;
+QStringList s_messages;
+QSemaphore s_sema;
+
+static void threadSafeMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
+{
+ QMutexLocker lock(&s_mutex);
+ s_messages.append(msg);
+ Q_UNUSED(type);
+ Q_UNUSED(context);
+}
+
+static void doDebug() // called in each thread
+{
+ s_sema.acquire();
+ qDebug() << "doDebug";
+}
+
+void tst_QDebug::threadSafety() const
+{
+ MessageHandlerSetter mhs(threadSafeMessageHandler);
+ const int numThreads = 10;
+ QThreadPool::globalInstance()->setMaxThreadCount(numThreads);
+ QFutureSynchronizer<void> sync;
+ for (int i = 0; i < numThreads; ++i) {
+ sync.addFuture(QtConcurrent::run(&doDebug));
+ }
+ s_sema.release(numThreads);
+ sync.waitForFinished();
+ QMutexLocker lock(&s_mutex);
+ QCOMPARE(s_messages.count(), numThreads);
+ for (int i = 0; i < numThreads; ++i) {
+ QCOMPARE(s_messages.at(i), QStringLiteral("doDebug"));
+ }
+}
+
QTEST_MAIN(tst_QDebug);
#include "tst_qdebug.moc"
--
1.9.3

View File

@ -0,0 +1,46 @@
From 7a4dcbaabf037a6913a5662ebb74cc47e04673b9 Mon Sep 17 00:00:00 2001
From: David Faure <david.faure@kdab.com>
Date: Sun, 8 Jun 2014 15:39:00 +0200
Subject: [PATCH 1/1] QDBus: fix data race on isDebugging bool
Change-Id: Id0b8bf8dac570abfc6c8768bd4264650ae0c199b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
---
src/dbus/qdbusintegrator.cpp | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 1fef6d4..260c188 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -73,8 +73,8 @@
QT_BEGIN_NAMESPACE
-static bool isDebugging;
-#define qDBusDebug if (!::isDebugging); else qDebug
+static QBasicAtomicInt isDebugging = Q_BASIC_ATOMIC_INITIALIZER(-1);
+#define qDBusDebug if (::isDebugging == 0); else qDebug
Q_GLOBAL_STATIC_WITH_ARGS(const QString, orgFreedesktopDBusString, (QLatin1String(DBUS_SERVICE_DBUS)))
@@ -1022,13 +1022,12 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
anonymousAuthenticationAllowed(false)
{
static const bool threads = q_dbus_threads_init_default();
- static const int debugging = qgetenv("QDBUS_DEBUG").toInt();
- ::isDebugging = debugging;
+ if (::isDebugging == -1)
+ ::isDebugging = qgetenv("QDBUS_DEBUG").toInt();
Q_UNUSED(threads)
- Q_UNUSED(debugging)
#ifdef QDBUS_THREAD_DEBUG
- if (debugging > 1)
+ if (::isDebugging > 1)
qdbusThreadDebug = qdbusDefaultThreadDebug;
#endif
--
1.9.3

View File

@ -0,0 +1,44 @@
From 51d6df1d18322c630f79567ed22de3718436d78d Mon Sep 17 00:00:00 2001
From: Gatis Paeglis <gatis.paeglis@digia.com>
Date: Tue, 17 Jun 2014 11:41:23 +0200
Subject: [PATCH 1/1] Translate Super/Hyper keys to MetaModifier
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is how it was done in Qt4. If users are interested
in an actual X11 keysym they can use QKeyEvent::nativeVirtualKey().
Change-Id: I710664e48c5db1633a357aa0a5d238f3453103ab
Task-number: QTBUG-38428
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Sebastian Kügler <sebas@kde.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
---
src/plugins/platforms/xcb/qxcbkeyboard.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 69601f4..4c84b19 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -929,6 +929,15 @@ int QXcbKeyboard::keysymToQtKey(xcb_keysym_t key) const
i += 2;
}
+ if (rmod_masks.meta) {
+ // translate Super/Hyper keys to Meta if we're using them as the MetaModifier
+ if (rmod_masks.meta == rmod_masks.super && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) {
+ code = Qt::Key_Meta;
+ } else if (rmod_masks.meta == rmod_masks.hyper && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) {
+ code = Qt::Key_Meta;
+ }
+ }
+
return code;
}
--
1.9.3

View File

@ -1,372 +0,0 @@
From 50b8506eaccc3c9bc3d717b241193bc8be9708b0 Mon Sep 17 00:00:00 2001
From: Jorgen Lind <jorgen.lind@digia.com>
Date: Thu, 3 Apr 2014 13:11:59 +0200
Subject: [PATCH] XCB: fix that modal dialogs can go behind other process
windows
Task-number: QTBUG-35302
Change-Id: I1ad7a66e530710d5338a15057254360dae676451
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
---
src/plugins/platforms/windows/qwindowscontext.cpp | 8 +
src/plugins/platforms/windows/qwindowswindow.cpp | 22 ++--
src/plugins/platforms/xcb/qxcbwindow.cpp | 104 +++++++++++++-------
src/plugins/platforms/xcb/qxcbwindow.h | 4
tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 113 ++++++++++++++++++++++
5 files changed, 206 insertions(+), 45 deletions(-)
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -49,11 +49,11 @@
#include "qwindowsmime.h"
#include "qwindowsinputcontext.h"
#include "qwindowstabletsupport.h"
+#include <private/qguiapplication_p.h>
#ifndef QT_NO_ACCESSIBILITY
# include "accessible/qwindowsaccessibility.h"
#endif
#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
-# include <private/qguiapplication_p.h>
# include <private/qsessionmanager_p.h>
# include "qwindowssessionmanager.h"
#endif
@@ -1025,6 +1025,12 @@ void QWindowsContext::handleFocusEvent(Q
{
QWindow *nextActiveWindow = 0;
if (et == QtWindows::FocusInEvent) {
+ QWindow *topWindow = QWindowsWindow::topLevelOf(platformWindow->window());
+ QWindow *modalWindow = 0;
+ if (QGuiApplicationPrivate::instance()->isWindowBlocked(topWindow, &modalWindow) && topWindow != modalWindow) {
+ modalWindow->requestActivate();
+ return;
+ }
nextActiveWindow = platformWindow->window();
} else {
// Focus out: Is the next window known and different
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1016,17 +1016,17 @@ QWindow *QWindowsWindow::topLevelOf(QWin
while (QWindow *parent = w->parent())
w = parent;
- const QWindowsWindow *ww = static_cast<const QWindowsWindow *>(w->handle());
-
- // In case the topmost parent is embedded, find next ancestor using native methods
- if (ww->isEmbedded(0)) {
- HWND parentHWND = GetAncestor(ww->handle(), GA_PARENT);
- const HWND desktopHwnd = GetDesktopWindow();
- const QWindowsContext *ctx = QWindowsContext::instance();
- while (parentHWND && parentHWND != desktopHwnd) {
- if (QWindowsWindow *ancestor = ctx->findPlatformWindow(parentHWND))
- return topLevelOf(ancestor->window());
- parentHWND = GetAncestor(parentHWND, GA_PARENT);
+ if (const QPlatformWindow *handle = w->handle()) {
+ const QWindowsWindow *ww = static_cast<const QWindowsWindow *>(handle);
+ if (ww->isEmbedded(0)) {
+ HWND parentHWND = GetAncestor(ww->handle(), GA_PARENT);
+ const HWND desktopHwnd = GetDesktopWindow();
+ const QWindowsContext *ctx = QWindowsContext::instance();
+ while (parentHWND && parentHWND != desktopHwnd) {
+ if (QWindowsWindow *ancestor = ctx->findPlatformWindow(parentHWND))
+ return topLevelOf(ancestor->window());
+ parentHWND = GetAncestor(parentHWND, GA_PARENT);
+ }
}
}
return w;
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -485,7 +485,7 @@ QXcbWindow::~QXcbWindow()
void QXcbWindow::destroy()
{
if (connection()->focusWindow() == this)
- connection()->setFocusWindow(0);
+ doFocusOut();
if (m_syncCounter && m_usingSyncProtocol)
Q_XCB_CALL(xcb_sync_destroy_counter(xcb_connection(), m_syncCounter));
@@ -671,6 +671,9 @@ void QXcbWindow::show()
Q_XCB_CALL(xcb_map_window(xcb_connection(), m_window));
+ if (QGuiApplication::modalWindow() == window())
+ requestActivateWindow();
+
m_screen->windowShown(this);
connection()->sync();
@@ -694,6 +697,68 @@ void QXcbWindow::hide()
m_mapped = false;
}
+static QWindow *tlWindow(QWindow *window)
+{
+ if (window && window->parent())
+ return tlWindow(window->parent());
+ return window;
+}
+
+bool QXcbWindow::relayFocusToModalWindow() const
+{
+ QWindow *w = tlWindow(static_cast<QWindowPrivate *>(QObjectPrivate::get(window()))->eventReceiver());
+ QWindow *modal_window = 0;
+ if (QGuiApplicationPrivate::instance()->isWindowBlocked(w,&modal_window) && modal_window != w) {
+ modal_window->requestActivate();
+ connection()->flush();
+ return true;
+ }
+
+ return false;
+}
+
+void QXcbWindow::doFocusIn()
+{
+ if (relayFocusToModalWindow())
+ return;
+ QWindow *w = static_cast<QWindowPrivate *>(QObjectPrivate::get(window()))->eventReceiver();
+ connection()->setFocusWindow(static_cast<QXcbWindow *>(w->handle()));
+ QWindowSystemInterface::handleWindowActivated(w, Qt::ActiveWindowFocusReason);
+}
+
+static bool focusInPeeker(QXcbConnection *connection, xcb_generic_event_t *event)
+{
+ if (!event) {
+ // FocusIn event is not in the queue, proceed with FocusOut normally.
+ QWindowSystemInterface::handleWindowActivated(0, Qt::ActiveWindowFocusReason);
+ return true;
+ }
+ uint response_type = event->response_type & ~0x80;
+ if (response_type == XCB_FOCUS_IN)
+ return true;
+
+ /* We are also interested in XEMBED_FOCUS_IN events */
+ if (response_type == XCB_CLIENT_MESSAGE) {
+ xcb_client_message_event_t *cme = (xcb_client_message_event_t *)event;
+ if (cme->type == connection->atom(QXcbAtom::_XEMBED)
+ && cme->data.data32[1] == XEMBED_FOCUS_IN)
+ return true;
+ }
+
+ return false;
+}
+
+void QXcbWindow::doFocusOut()
+{
+ if (relayFocusToModalWindow())
+ return;
+ connection()->setFocusWindow(0);
+ // Do not set the active window to 0 if there is a FocusIn coming.
+ // There is however no equivalent for XPutBackEvent so register a
+ // callback for QXcbConnection instead.
+ connection()->addPeekFunc(focusInPeeker);
+}
+
struct QtMotifWmHints {
quint32 flags, functions, decorations;
qint32 input_mode;
@@ -1514,6 +1579,8 @@ void QXcbWindow::handleClientMessageEven
QWindowSystemInterface::handleCloseEvent(window());
} else if (event->data.data32[0] == atom(QXcbAtom::WM_TAKE_FOCUS)) {
connection()->setTime(event->data.data32[1]);
+ relayFocusToModalWindow();
+ return;
} else if (event->data.data32[0] == atom(QXcbAtom::_NET_WM_PING)) {
if (event->window == m_screen->root())
return;
@@ -1549,8 +1616,7 @@ void QXcbWindow::handleClientMessageEven
} else if (event->type == atom(QXcbAtom::_XEMBED)) {
handleXEmbedMessage(event);
} else if (event->type == atom(QXcbAtom::_NET_ACTIVE_WINDOW)) {
- connection()->setFocusWindow(this);
- QWindowSystemInterface::handleWindowActivated(window(), Qt::ActiveWindowFocusReason);
+ doFocusIn();
} else if (event->type == atom(QXcbAtom::MANAGER)
|| event->type == atom(QXcbAtom::_NET_WM_STATE)
|| event->type == atom(QXcbAtom::WM_CHANGE_STATE)) {
@@ -1868,41 +1934,13 @@ void QXcbWindow::handlePropertyNotifyEve
void QXcbWindow::handleFocusInEvent(const xcb_focus_in_event_t *)
{
- QWindow *w = window();
- w = static_cast<QWindowPrivate *>(QObjectPrivate::get(w))->eventReceiver();
- connection()->setFocusWindow(static_cast<QXcbWindow *>(w->handle()));
- QWindowSystemInterface::handleWindowActivated(w, Qt::ActiveWindowFocusReason);
+ doFocusIn();
}
-static bool focusInPeeker(QXcbConnection *connection, xcb_generic_event_t *event)
-{
- if (!event) {
- // FocusIn event is not in the queue, proceed with FocusOut normally.
- QWindowSystemInterface::handleWindowActivated(0, Qt::ActiveWindowFocusReason);
- return true;
- }
- uint response_type = event->response_type & ~0x80;
- if (response_type == XCB_FOCUS_IN)
- return true;
-
- /* We are also interested in XEMBED_FOCUS_IN events */
- if (response_type == XCB_CLIENT_MESSAGE) {
- xcb_client_message_event_t *cme = (xcb_client_message_event_t *)event;
- if (cme->type == connection->atom(QXcbAtom::_XEMBED)
- && cme->data.data32[1] == XEMBED_FOCUS_IN)
- return true;
- }
-
- return false;
-}
void QXcbWindow::handleFocusOutEvent(const xcb_focus_out_event_t *)
{
- connection()->setFocusWindow(0);
- // Do not set the active window to 0 if there is a FocusIn coming.
- // There is however no equivalent for XPutBackEvent so register a
- // callback for QXcbConnection instead.
- connection()->addPeekFunc(focusInPeeker);
+ doFocusOut();
}
void QXcbWindow::updateSyncRequestCounter()
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -176,6 +176,10 @@ private:
void show();
void hide();
+ bool relayFocusToModalWindow() const;
+ void doFocusIn();
+ void doFocusOut();
+
QXcbScreen *m_screen;
xcb_window_t m_window;
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -88,6 +88,10 @@ private slots:
void visibility();
void mask();
void initialSize();
+ void modalDialog();
+ void modalDialogClosingOneOfTwoModal();
+ void modalWithChildWindow();
+ void modalWindowModallity();
void initTestCase()
{
@@ -1316,6 +1320,115 @@ void tst_QWindow::initialSize()
}
}
+void tst_QWindow::modalDialog()
+{
+ QWindow normalWindow;
+ normalWindow.resize(400, 400);
+ normalWindow.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&normalWindow));
+
+ QWindow dialog;
+ dialog.resize(200,200);
+ dialog.setModality(Qt::ApplicationModal);
+ dialog.setFlags(Qt::Dialog);
+ dialog.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&dialog));
+
+ normalWindow.requestActivate();
+
+ QGuiApplication::sync();
+ QGuiApplication::processEvents();
+ QTRY_COMPARE(QGuiApplication::focusWindow(), &dialog);
+}
+
+void tst_QWindow::modalDialogClosingOneOfTwoModal()
+{
+ QWindow normalWindow;
+ normalWindow.resize(400, 400);
+ normalWindow.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&normalWindow));
+
+ QWindow first_dialog;
+ first_dialog.resize(200,200);
+ first_dialog.setModality(Qt::ApplicationModal);
+ first_dialog.setFlags(Qt::Dialog);
+ first_dialog.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&first_dialog));
+
+ {
+ QWindow second_dialog;
+ second_dialog.resize(200,200);
+ second_dialog.setModality(Qt::ApplicationModal);
+ second_dialog.setFlags(Qt::Dialog);
+ second_dialog.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&second_dialog));
+
+ QTRY_COMPARE(QGuiApplication::focusWindow(), &second_dialog);
+
+ second_dialog.close();
+ }
+
+ QGuiApplication::sync();
+ QGuiApplication::processEvents();
+ QTRY_COMPARE(QGuiApplication::focusWindow(), &first_dialog);
+}
+
+void tst_QWindow::modalWithChildWindow()
+{
+ QWindow normalWindow;
+ normalWindow.resize(400, 400);
+ normalWindow.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&normalWindow));
+
+ QWindow tlw_dialog;
+ tlw_dialog.resize(400,200);
+ tlw_dialog.setModality(Qt::ApplicationModal);
+ tlw_dialog.setFlags(Qt::Dialog);
+ tlw_dialog.create();
+
+ QWindow sub_window(&tlw_dialog);
+ sub_window.resize(200,300);
+ sub_window.show();
+
+ tlw_dialog.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&tlw_dialog));
+ QVERIFY(QTest::qWaitForWindowExposed(&sub_window));
+
+ QTRY_COMPARE(QGuiApplication::focusWindow(), &tlw_dialog);
+
+ sub_window.requestActivate();
+ QGuiApplication::sync();
+ QGuiApplication::processEvents();
+ QTRY_COMPARE(QGuiApplication::focusWindow(), &sub_window);
+}
+
+void tst_QWindow::modalWindowModallity()
+{
+ QWindow normal_window;
+ normal_window.resize(400, 400);
+ normal_window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&normal_window));
+
+ QWindow parent_to_modal;
+ parent_to_modal.resize(400, 400);
+ parent_to_modal.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&parent_to_modal));
+ QTRY_COMPARE(QGuiApplication::focusWindow(), &parent_to_modal);
+
+ QWindow modal_dialog;
+ modal_dialog.resize(400,200);
+ modal_dialog.setModality(Qt::WindowModal);
+ modal_dialog.setFlags(Qt::Dialog);
+ modal_dialog.setTransientParent(&parent_to_modal);
+ modal_dialog.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&modal_dialog));
+ QTRY_COMPARE(QGuiApplication::focusWindow(), &modal_dialog);
+
+ normal_window.requestActivate();
+ QTRY_COMPARE(QGuiApplication::focusWindow(), &normal_window);
+
+}
+
#include <tst_qwindow.moc>
QTEST_MAIN(tst_QWindow)

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Wed Jun 25 10:38:00 UTC 2014 - hrvoje.senjan@gmail.com
- Update to 5.3.1
* Bugfix release, for more details please see:
http://blog.qt.digia.com/blog/2014/06/25/qt-5-3-1-released/
- Drop libqt5-fix-the-modal-dialogs-can-go-behind.patch, merged upstream
- Added patches from upstream:
0001-Do-not-overwrite-existing-event-mask-of-root-window.patch -- QTBUG-39648
0002-Properly-check-which-OpenGL-features-are-supported.patch -- QTBUG-39730
0003-Fix-data-race-on-QLoggingCategory-when-using-qDebug-.patch -- Fix data race on QLoggingCategory
0004-QDBus-fix-data-race-on-isDebugging-bool.patch -- fix data race on isDebugging bool
0005-Translate-Super-Hyper-keys-to-MetaModifier.patch -- QTBUG-38428
-------------------------------------------------------------------
Sun Jun 1 23:43:25 UTC 2014 - hrvoje.senjan@gmail.com

View File

@ -20,15 +20,15 @@
%define journald 0
Name: libqt5-qtbase
Version: 5.3.0
Version: 5.3.1
Release: 0
Summary: C++ Program Library, Core Components
License: GPL-3.0 or SUSE-LGPL-2.1-with-digia-exception-1.1
Group: System/Libraries
Url: http://qt.digia.com
%define base_name libqt5
%define real_version 5.3.0
%define so_version 5.3.0
%define real_version 5.3.1
%define so_version 5.3.1
%if %qt5_snapshot
%define tar_version qtbase-%{real_version}
%else
@ -53,8 +53,18 @@ Patch134: libqt5-add-support-for-byte-swapping.patch
Patch135: libqt5-byte-order-byte-is-address0.patch
# PATCH-FIX-SUSE libqt5-Fix-Gujarati-font.patch bnc#878292 fix broken Gujarati font rendering
Patch136: libqt5-Fix-Gujarati-font.patch
# PATCH-FIX-UPSTREAM libqt5-fix-the-modal-dialogs-can-go-behind.patch -- fix that modal dialogs can go behind other process window
Patch137: libqt5-fix-the-modal-dialogs-can-go-behind.patch
# patches 1000 and above from upstream 5.3 branch #
# PATCH-FIX-UPSTREAM 0001-Do-not-overwrite-existing-event-mask-of-root-window.patch -- QTBUG-39648
Patch1000: 0001-Do-not-overwrite-existing-event-mask-of-root-window.patch
# PATCH-FIX-UPSTREAM 0002-Properly-check-which-OpenGL-features-are-supported.patch -- QTBUG-39730
Patch1001: 0002-Properly-check-which-OpenGL-features-are-supported.patch
# PATCH-FIX-UPSTREAM 0003-Fix-data-race-on-QLoggingCategory-when-using-qDebug-.patch -- Fix data race on QLoggingCategory
Patch1002: 0003-Fix-data-race-on-QLoggingCategory-when-using-qDebug-.patch
# PATCH-FIX-UPSTREAM 0004-QDBus-fix-data-race-on-isDebugging-bool.patch -- fix data race on isDebugging bool
Patch1003: 0004-QDBus-fix-data-race-on-isDebugging-bool.patch
# PATCH-FIX-UPSTREAM 0005-Translate-Super-Hyper-keys-to-MetaModifier.patch -- QTBUG-38428
Patch1004: 0005-Translate-Super-Hyper-keys-to-MetaModifier.patch
BuildRequires: alsa-devel
BuildRequires: cups-devel
BuildRequires: fdupes
@ -144,7 +154,11 @@ handling.
%patch134 -p1
%patch135 -p1
%patch136 -p1
%patch137 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
# be sure not to use them
rm -r src/3rdparty/{libjpeg,freetype,libpng,zlib}

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:07320bc8bbb718c420e22486942985c79fb2e2743981a19954aa09cc8a7147ab
size 46643328

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7b5a138d30d7c0228a51084407d5210f6d1acfbee2f95b87f189872cfcd3a569
size 46679724