Accepting request 431274 from KDE:Qt5

The Time Has Come to Shoot You Down... What a Sound

OBS-URL: https://build.opensuse.org/request/show/431274
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=56
This commit is contained in:
Dominique Leuenberger 2016-10-01 21:50:22 +00:00 committed by Git OBS Bridge
parent 43869b4c19
commit 8b9e88c08a
13 changed files with 506 additions and 163 deletions

View File

@ -0,0 +1,60 @@
From 6f423555eba55ccdf7287071e10576bc1b687fd2 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Mon, 1 Aug 2016 13:39:53 +0200
Subject: REG: Fix unwanted cache flush in Freetype engine
The Freetype cache was almost completely disabled by
134c6db8587a8ce156d4fa31ffa62605821851b2 because after that
change, the lockedAlphaMapForGlyph() function would no longer
cut off early for empty glyphs like spaces, but rather go
through all alpha map functions before it realized that there
was nothing to render. This would in turn invalidate the cache
for every empty glyph, causing all glyphs to be rerendered for
every isolated word.
This change adds back a cut off. This is only needed in the
lockedAlphaMapForGlyph() function, since the superclass implementation
of the other alpha map functions already contains a cut off for
width/height == 0.
[ChangeLog][Qt Gui][Text] Fixed a performance regression in Freetype
engine that was introduced in Qt 5.5.
Change-Id: I381285939909e99cc5fb5f3497fecf9fa871f29a
Task-number: QTBUG-49452
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
---
src/gui/text/qfontengine_ft.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 4de41df..7c878da 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1716,7 +1716,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe
static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEngine::GlyphFormat glyphFormat)
{
- if (glyph == Q_NULLPTR)
+ if (glyph == Q_NULLPTR || glyph->height == 0 || glyph->width == 0)
return QImage();
QImage::Format format = QImage::Format_Invalid;
@@ -1764,11 +1764,15 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe
currentlyLockedAlphaMap = alphaMapFromGlyphData(glyph, neededFormat);
+ const bool glyphHasGeometry = glyph != Q_NULLPTR && glyph->height != 0 && glyph->width != 0;
if (!cacheEnabled && glyph != &emptyGlyph) {
currentlyLockedAlphaMap = currentlyLockedAlphaMap.copy();
delete glyph;
}
+ if (!glyphHasGeometry)
+ return Q_NULLPTR;
+
if (currentlyLockedAlphaMap.isNull())
return QFontEngine::lockedAlphaMapForGlyph(glyphIndex, subPixelPosition, neededFormat, t, offset);
--
cgit v1.0-4-g1e03

View File

@ -0,0 +1,78 @@
From 8081ab4938b192bb740c5ee3004468aa6840563d Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@intel.com>
Date: Thu, 12 Nov 2015 10:14:51 -0800
Subject: [PATCH] Stop unloading plugins in QPluginLoader and QFactoryLoader
QPluginLoader hasn't unloaded in its destructor since Qt 5.0, but we
missed the equivalent code in QFactoryLoader (which bypasses
QPluginLoader). Besides, QPluginLoader::unload() was still doing
unloading, which it won't anymore.
Not unloading plugins is Qt's policy, as decided during the 5.0
development process and reaffirmed now in 5.6. This is due to static
data in plugins leaking out and remaining in use past the unloading of
the plugin, causing crashes.
This does not affect QLibrary and QLibrary::unload(). Those are meant
for non-Qt loadable modules, so unloading them may be safe.
Task-number: QTBUG-49061
Task-number: QTBUG-52988
Discussed-on: http://lists.qt-project.org/pipermail/development/2015-November/023681.html
Change-Id: I6b3a1770e6c79cc4485a28ab286e069b88a149e5
---
src/corelib/plugin/qfactoryloader.cpp | 6 ++++--
src/corelib/plugin/qpluginloader.cpp | 5 +++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index dcf1b1a..b6558f5 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -208,10 +208,12 @@ void QFactoryLoader::update()
++keyUsageCount;
}
}
- if (keyUsageCount || keys.isEmpty())
+ if (keyUsageCount || keys.isEmpty()) {
+ library->setLoadHints(QLibrary::PreventUnloadHint); // once loaded, don't unload
d->libraryList += library;
- else
+ } else {
library->release();
+ }
}
}
#else
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index 37f2368..0ea8280 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -148,6 +148,7 @@ QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent)
: QObject(parent), d(0), did_load(false)
{
setFileName(fileName);
+ setLoadHints(QLibrary::PreventUnloadHint);
}
/*!
@@ -342,7 +343,7 @@ static QString locatePlugin(const QString& fileName)
void QPluginLoader::setFileName(const QString &fileName)
{
#if defined(QT_SHARED)
- QLibrary::LoadHints lh;
+ QLibrary::LoadHints lh = QLibrary::PreventUnloadHint;
if (d) {
lh = d->loadHints();
d->release();
@@ -391,7 +392,7 @@ Q_GLOBAL_STATIC(StaticPluginList, staticPluginList)
\brief Give the load() function some hints on how it should behave.
You can give hints on how the symbols in the plugin are
- resolved. By default, none of the hints are set.
+ resolved. By default since Qt 5.7, QLibrary::PreventUnloadHint is set.
See the documentation of QLibrary::loadHints for a complete
description of how this property works.
--
2.7.4

View File

@ -0,0 +1,34 @@
From 2c48695f04b0f4b3b11ec037b13132b146cad082 Mon Sep 17 00:00:00 2001
From: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Date: Thu, 15 Sep 2016 23:21:15 +0200
Subject: XCB Drop from external app: fix keyboard modifier state
Fix inspired by Qt 4 sources. When we get drop events that are not
coming from the same application, it's unlikely that the keyboard
modifiers are in a sensible state (the usual XCB events are not sent
during drag and drop), so set the keyboard modifier state explicitly.
Task-number: QTBUG-49645
Change-Id: I9360f2b7ffeaa5243a4dfe7ccf96df134c5d2156
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
---
src/plugins/platforms/xcb/qxcbdrag.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index f93e420..acfb580 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -960,6 +960,9 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e
} else {
dropData = platformDropData();
supported_drop_actions = accepted_drop_action;
+
+ // Drop coming from another app? Update keyboard modifiers.
+ QGuiApplicationPrivate::modifier_buttons = QGuiApplication::queryKeyboardModifiers();
}
if (!dropData)
--
cgit v1.0-4-g1e03

View File

@ -1,3 +1,43 @@
-------------------------------------------------------------------
Thu Sep 29 14:12:34 UTC 2016 - hrvoje.senjan@gmail.com
- Move gtk platformtheme again out of the libQt5Gui5 package (now
it's gtk-3 based)
-------------------------------------------------------------------
Tue Sep 27 08:52:43 UTC 2016 - schwab@suse.de
- Fix filelist for %gles configuration
-------------------------------------------------------------------
Tue Sep 27 08:00:02 UTC 2016 - hrvoje.senjan@gmail.com
- Added Stop-unloading-plugins-in-QPluginLoader-and-QFactoryLoader.patch
(boo#1001362, boo#965653)
-------------------------------------------------------------------
Sat Sep 24 18:39:00 UTC 2016 - hrvoje.senjan@gmail.com
- Update to 5.7.0
* For more details please see:
https://www.qt.io/qt5-7/
- Drop dead/absorbed patches:
xcb-Fix-drop-of-text-uri-list-and-text-html.patch and
xcb-Fix-dropping-URL-on-Firefox-window.patch
- Added Fix-unwanted-cache-flush-in-Freetype-engine.patch
and xcb-Dont-activate-bypassed-windows-on-mouse-press.patch
- Don't pass axed options to configure
- Add double-conversion-devel, libproxy-devel and pkgconfig(gtk+-3.0)
(instead of pkgconfig(gtk+-2.0)) BuildRequires
-------------------------------------------------------------------
Sat Sep 24 18:25:41 UTC 2016 - hrvoje.senjan@gmail.com
- Another set of upstream patches for the XCB plugin:
XCB-Drop-from-external-app-fix-keyboard-modifier-state.patch
xcb-Dont-send-QtWindowNoState-event-when-hiding-minimized-window.patch
xcb-Use-the-state-of-the-key-event-to-process-it.patch
-------------------------------------------------------------------
Sat Jul 2 18:52:10 UTC 2016 - hrvoje.senjan@gmail.com

View File

@ -26,15 +26,15 @@
%endif
Name: libqt5-qtbase
Version: 5.6.1
Version: 5.7.0
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.6.1
%define so_version 5.6.1
%define real_version 5.7.0
%define so_version 5.7.0
%define tar_version qtbase-opensource-src-%{real_version}
Source: %{tar_version}.tar.xz
# to get mtime of file:
@ -52,18 +52,24 @@ Patch5: libqt5-do-not-use-shm-if-display-name-doesnt-look-local.patch
# PATCH-FIX-OPENSUSE disable-rc4-ciphers-bnc865241.diff bnc#865241-- Exclude rc4 ciphers from being used by default
Patch6: disable-rc4-ciphers-bnc865241.diff
Patch7: tell-the-truth-about-private-api.patch
# patches 1000-2000 and above from upstream 5.6 branch #
Patch1000: xcb-Fix-drop-of-text-uri-list-and-text-html.patch
Patch1001: xcb-Fix-dropping-URL-on-Firefox-window.patch
Patch1002: xcb-Send-also-text-plain-when-a-text-uri-list-is-dropped.patch
# patches 2000-3000 and above from upstream 5.7 branch #
Patch8: xcb-Dont-activate-bypassed-windows-on-mouse-press.patch
Patch9: Fix-unwanted-cache-flush-in-Freetype-engine.patch
# patches 1000-2000 and above from upstream 5.7 branch #
Patch1000: xcb-Send-also-text-plain-when-a-text-uri-list-is-dropped.patch
Patch1001: xcb-Dont-send-QtWindowNoState-event-when-hiding-minimized-window.patch
Patch1002: XCB-Drop-from-external-app-fix-keyboard-modifier-state.patch
Patch1003: xcb-Use-the-state-of-the-key-event-to-process-it.patch
Patch1004: Stop-unloading-plugins-in-QPluginLoader-and-QFactoryLoader.patch
# patches 2000-3000 and above from upstream 5.8 branch #
BuildRequires: alsa-devel
BuildRequires: cups-devel
BuildRequires: double-conversion-devel
BuildRequires: gcc-c++
BuildRequires: libjpeg-devel
BuildRequires: libmng-devel
BuildRequires: libmysqlclient-devel
BuildRequires: libpng-devel
BuildRequires: libproxy-devel
BuildRequires: libtiff-devel
BuildRequires: openssl-devel
BuildRequires: pcre-devel
@ -96,7 +102,7 @@ BuildRequires: xcb-util-wm-devel
BuildRequires: xorg-x11-devel
BuildRequires: xz
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: pkgconfig(gtk+-3.0)
%if 0%{?is_opensuse}
BuildRequires: pkgconfig(harfbuzz)
%endif
@ -140,14 +146,16 @@ handling.
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -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}
#rm -r mkspecs/features/qt_module.prf.orig
#rm -r qtimageformats/src/3rdparty/{libtiff,libmng}
rm -rf src/3rdparty/{libjpeg,freetype,zlib}
%package devel
Summary: Qt Development Kit
@ -484,6 +492,15 @@ Obsoletes: libqt5-qtbase-platformtheme-gtk2 <= %{version}
%description -n libQt5Gui5
Qt 5 libraries which are depending on X11.
%package platformtheme-gtk3
Summary: Qt 5 gtk3 plugin
Group: Development/Libraries/C and C++
Supplements: packageand(libQt5Gui5:libgtk-3-0)
Requires: libQt5Gui5 = %{version}
%description platformtheme-gtk3
Qt 5 plugin for better integration with gtk3-based desktop enviroments.
%package -n libQt5Gui-devel
Summary: Qt 5 GUI related libraries - development files
Group: Development/Libraries/C and C++
@ -712,7 +729,6 @@ echo yes | ./configure $platform \
-dbus-linked \
-xfixes \
-xrandr \
-xinerama \
-sm \
-no-rpath \
-system-libjpeg \
@ -724,7 +740,6 @@ echo yes | ./configure $platform \
-fontconfig \
-system-freetype \
-cups \
-nis \
-system-zlib \
-iconv \
-no-pch \
@ -736,8 +751,6 @@ echo yes | ./configure $platform \
-journald \
%endif
-xsync \
-xinput \
-gtkstyle \
-xcb \
-egl \
-eglfs \
@ -772,22 +785,22 @@ popd
install -D -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/rpm/macros.qt5
# argggh, qmake is such a piece of <censored>
find %{buildroot}/%{libqt5_libdir} -type f -name '*prl' -exec perl -pi -e "s, -L$RPM_BUILD_DIR/\S+,,g" {} \;
find %{buildroot}/%{libqt5_libdir} -type f -name '*prl' -exec sed -i -e "/^QMAKE_PRL_BUILD_DIR/d" {} \;
find %{buildroot}/%{libqt5_libdir} -type f -name '*la' -print -exec perl -pi -e "s, -L$RPM_BUILD_DIR/?\S+,,g" {} \;
find %{buildroot}%{libqt5_libdir} -type f -name '*prl' -exec perl -pi -e "s, -L$RPM_BUILD_DIR/\S+,,g" {} \;
find %{buildroot}%{libqt5_libdir} -type f -name '*prl' -exec sed -i -e "/^QMAKE_PRL_BUILD_DIR/d" {} \;
find %{buildroot}%{libqt5_libdir} -type f -name '*la' -print -exec perl -pi -e "s, -L$RPM_BUILD_DIR/?\S+,,g" {} \;
# insanity ...
find %{buildroot}/%{libqt5_libdir} -type f -name '*pc' -print -exec perl -pi -e "s, -L$RPM_BUILD_DIR/?\S+,,g" {} \; -exec sed -i -e "s,^moc_location=.*,moc_location=%libqt5_bindir/moc," -e "s,uic_location=.*,uic_location=%libqt5_bindir/uic," {} \;
find %{buildroot}/%{libqt5_libdir}/ -name 'lib*.a' -exec chmod -x -- {} \;
find %{buildroot}%{libqt5_libdir} -type f -name '*pc' -print -exec perl -pi -e "s, -L$RPM_BUILD_DIR/?\S+,,g" {} \; -exec sed -i -e "s,^moc_location=.*,moc_location=%libqt5_bindir/moc," -e "s,uic_location=.*,uic_location=%libqt5_bindir/uic," {} \;
find %{buildroot}%{libqt5_libdir}/ -name 'lib*.a' -exec chmod -x -- {} \;
# kill .la files
rm -f %{buildroot}%{libqt5_libdir}/lib*.la
#
rm -fv %{buildroot}%{libqt5_libdir}/cmake/Qt5*/Q*Plugin.cmake
mkdir -p %{buildroot}/%{libqt5_plugindir}/sqldrivers
mkdir -p %{buildroot}%{libqt5_plugindir}/sqldrivers
# put all the binaries to %{_bindir}, add -qt5 suffix, and symlink them back to %_qt5_bindir
mkdir %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_bindir}
pushd %{buildroot}%{libqt5_bindir}
for i in * ; do
case "${i}" in
@ -1030,6 +1043,9 @@ popd
%{libqt5_libdir}/sse2/libQt5Gui.so.*
%endif
%{libqt5_libdir}/libQt5EglDeviceIntegration.so.*
%if %gles
%{libqt5_libdir}/libQt5EglFsKmsSupport.so.*
%endif
%{libqt5_libdir}/libQt5XcbQpa.so.*
%{libqt5_plugindir}/generic
%{libqt5_plugindir}/imageformats
@ -1037,13 +1053,22 @@ popd
%{libqt5_plugindir}/platforms
%{libqt5_plugindir}/egldeviceintegrations
%{libqt5_plugindir}/xcbglintegrations
%{libqt5_plugindir}/platformthemes/
%files platformtheme-gtk3
%defattr(-,root,root,755)
%doc *.txt LICENSE.*
%dir %{libqt5_plugindir}/platformthemes
%{libqt5_plugindir}/platformthemes/libqgtk3.so
%files -n libQt5Gui-devel
%defattr(-,root,root,755)
%doc *.txt LICENSE.*
%{libqt5_libdir}/libQt5Gui.so
%{libqt5_libdir}/libQt5Gui.prl
%if %gles
%{libqt5_libdir}/libQt5EglFsKmsSupport.prl
%{libqt5_libdir}/libQt5EglFsKmsSupport.so
%endif
%{libqt5_libdir}/cmake/Qt5Gui/
%{libqt5_libdir}/pkgconfig/Qt5Gui.pc
%{libqt5_includedir}/QtGui/

View File

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

View File

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

View File

@ -2,7 +2,7 @@ diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index aefd3ae..53a3f60 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -196,12 +196,14 @@ android: CONFIG += qt_android_deps no_li
@@ -195,12 +195,14 @@ android: CONFIG += qt_android_deps no_li
verscript = $${TARGET}.version
QMAKE_LFLAGS += $${QMAKE_LFLAGS_VERSION_SCRIPT}$$verscript
@ -20,7 +20,7 @@ index aefd3ae..53a3f60 100644
verscript_content += " @FILE:$${_PRO_FILE_PWD_}/$$header@"
verscript_content += "};"
@@ -222,7 +224,7 @@ android: CONFIG += qt_android_deps no_li
@@ -221,7 +223,7 @@ android: CONFIG += qt_android_deps no_li
verscriptprocess.name = linker version script ${QMAKE_FILE_BASE}
verscriptprocess.input = verscript_in
verscriptprocess.CONFIG += no_link target_predeps

View File

@ -0,0 +1,49 @@
From 444ba31a0a68421ee9ff7de788f6026599202455 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= <spaz16@wp.pl>
Date: Fri, 10 Jun 2016 00:11:35 +0200
Subject: xcb: Don't activate bypassed windows on mouse press
Windows with "Qt::BypassWindowManagerHint" flag can't be activated by
mouse. They can be activated only from code calling "activateWindow()"
or "requestActivate()" methods.
The patch applies also for "Qt::ToolTip" and "Qt::Popup" windows which
have implicit "Qt::BypassWindowManagerHint" flag.
The patch fixes some major issues:
- don't activate tooltips on mouse press - this causes that Qt "thinks"
that original windows loses its focus causing e.g. that text cursor
stops blinking,
- don't activate X11 tray icon - this causes that the active window
looses its focus by clicking tray icon.
The patch restores the Qt4 behavior.
Task-number: QTBUG-53993
Change-Id: I80b226f2f5ea0ebbfe8922c90d9da9f4132e8cce
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
---
src/plugins/platforms/xcb/qxcbwindow.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 0c2f0d7..b5cde14 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2201,8 +2201,11 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in
const bool isWheel = detail >= 4 && detail <= 7;
if (!isWheel && window() != QGuiApplication::focusWindow()) {
QWindow *w = static_cast<QWindowPrivate *>(QObjectPrivate::get(window()))->eventReceiver();
- if (!(w->flags() & Qt::WindowDoesNotAcceptFocus))
+ if (!(w->flags() & (Qt::WindowDoesNotAcceptFocus | Qt::BypassWindowManagerHint))
+ && w->type() != Qt::ToolTip
+ && w->type() != Qt::Popup) {
w->requestActivate();
+ }
}
updateNetWmUserTime(timestamp);
--
cgit v1.0-4-g1e03

View File

@ -0,0 +1,42 @@
From 2cf3dee10be1d2163eff0893f51f9ece643c2540 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= <spaz16@wp.pl>
Date: Mon, 12 Sep 2016 15:22:20 +0200
Subject: xcb: Don't send "Qt::WindowNoState" event when hiding minimized
window
This prevents getting "QWidget::showEvent()" when hiding minimized
widget on some WMs like Marco or Xfwm4.
If QWindow is minimized and it gets the new "XCB_WM_STATE_WITHDRAWN"
event from XCB, then don't change the QWindow state.
Task-number: QTBUG-55942
Change-Id: I90cfc2bf55e507864ad8f26c8f569ea562c27314
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
---
src/plugins/platforms/xcb/qxcbwindow.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index da50201..d46228c 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2543,8 +2543,13 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
if (reply && reply->format == 32 && reply->type == atom(QXcbAtom::WM_STATE)) {
const quint32 *data = (const quint32 *)xcb_get_property_value(reply);
- if (reply->length != 0 && XCB_WM_STATE_ICONIC == data[0])
- newState = Qt::WindowMinimized;
+ if (reply->length != 0) {
+ if (data[0] == XCB_WM_STATE_ICONIC
+ || (data[0] == XCB_WM_STATE_WITHDRAWN
+ && m_lastWindowStateEvent == Qt::WindowMinimized)) {
+ newState = Qt::WindowMinimized;
+ }
+ }
}
free(reply);
} else { // _NET_WM_STATE can't change minimized state
--
cgit v1.0-4-g1e03

View File

@ -1,77 +0,0 @@
From 1108291e1a2e7de23440c2b36b2fd31010ae3f51 Mon Sep 17 00:00:00 2001
From: Urs Fleisch <ufleisch@users.sourceforge.net>
Date: Tue, 3 May 2016 20:01:01 +0200
Subject: [PATCH] xcb: Fix drop of text/uri-list and text/html.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
When dropping URLs from Firefox or Chrome, the contents are encoded as
UTF16, but not correctly decoded. Moreover, the special handling of
"text/x-moz-url" drops does not work because this format is converted to
"text/uri-list" before. This fixes the handling for URL list and also
for UTF16 "text/html".
Task-number: QTBUG-47981
Change-Id: I1153f21ede07b2bfe4d104e0fe8bc8487ec5c165
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
---
src/plugins/platforms/xcb/qxcbmime.cpp | 42 +++++++++++++++++++++++++---------
1 file changed, 31 insertions(+), 11 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp
index eeac561..cef2210 100644
--- a/src/plugins/platforms/xcb/qxcbmime.cpp
+++ b/src/plugins/platforms/xcb/qxcbmime.cpp
@@ -182,17 +182,37 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
a == connection->atom(QXcbAtom::TEXT))
return QString::fromLatin1(data);
}
-
- // special case for uri types
- if (format == QLatin1String("text/uri-list")) {
- if (atomName == QLatin1String("text/x-moz-url")) {
- // we expect this as utf16 <url><space><title>
- // the first part is a url that should only contain ascci char
- // so it should be safe to check that the second char is 0
- // to verify that it is utf16
- if (data.size() > 1 && data.at(1) == 0)
- return QString::fromRawData((const QChar *)data.constData(),
- data.size() / 2).split(QLatin1Char('\n')).first().toLatin1();
+ // If data contains UTF16 text, convert it to a string.
+ // Firefox uses UTF16 without BOM for text/x-moz-url, "text/html",
+ // Google Chrome uses UTF16 without BOM for "text/x-moz-url",
+ // UTF16 with BOM for "text/html".
+ if ((format == QLatin1String("text/html") || format == QLatin1String("text/uri-list"))
+ && data.size() > 1) {
+ const quint8 byte0 = data.at(0);
+ const quint8 byte1 = data.at(1);
+ if ((byte0 == 0xff && byte1 == 0xfe) || (byte0 == 0xfe && byte1 == 0xff)
+ || (byte0 != 0 && byte1 == 0) || (byte0 == 0 && byte1 != 0)) {
+ const QString str = QString::fromUtf16(
+ reinterpret_cast<const ushort *>(data.constData()), data.size() / 2);
+ if (!str.isNull()) {
+ if (format == QLatin1String("text/uri-list")) {
+ const QStringList urls = str.split(QLatin1Char('\n'));
+ QList<QVariant> list;
+ foreach (const QString &s, urls) {
+ const QUrl url(s.trimmed());
+ if (url.isValid())
+ list.append(url);
+ }
+ // We expect "text/x-moz-url" as <url><space><title>.
+ // The atomName variable is not used because mimeAtomToString()
+ // converts "text/x-moz-url" to "text/uri-list".
+ if (!list.isEmpty() && connection->atomName(a) == "text/x-moz-url")
+ return list.first();
+ return list;
+ } else {
+ return str;
+ }
+ }
}
}
--
2.7.4

View File

@ -1,57 +0,0 @@
From f162e29acca99aaab173fb323d112aad9ec6c2b5 Mon Sep 17 00:00:00 2001
From: Urs Fleisch <ufleisch@users.sourceforge.net>
Date: Wed, 4 May 2016 19:47:16 +0200
Subject: [PATCH] xcb: Fix dropping URL on Firefox window.
When a URL is dropped on a Firefox window, the "text/x-moz-url" data
takes precedence over the "text/uri-list". The "text/x-moz-url" is
interpreted as UTF16, however, the data from Qt 5 applications is not
in the correct format. The code to create correct UTF16 data exists,
but it is not called for two reasons: The atomName will never be
"text/x-moz-url" because it is changed to "text/uri-list" by
mimeAtomToString() and the InternalMimeData::hasFormatHelper() case is
already handled above and the else part will never be considered.
This patch fixes the check and brings it into the right order.
Task-number: QTBUG-49947
Change-Id: I5ebd31914cc6c1417c513c1ff09e0e858a16915d
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
---
src/plugins/platforms/xcb/qxcbmime.cpp | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp
index cef2210..7fea068 100644
--- a/src/plugins/platforms/xcb/qxcbmime.cpp
+++ b/src/plugins/platforms/xcb/qxcbmime.cpp
@@ -111,17 +111,18 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa
QString atomName = mimeAtomToString(connection, a);
if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) {
*data = QInternalMimeData::renderDataHelper(atomName, mimeData);
- if (atomName == QLatin1String("application/x-color"))
+ // mimeAtomToString() converts "text/x-moz-url" to "text/uri-list",
+ // so QXcbConnection::atomName() has to be used.
+ if (atomName == QLatin1String("text/uri-list")
+ && connection->atomName(a) == "text/x-moz-url") {
+ const QByteArray uri = data->split('\n').first();
+ QString mozUri = QString::fromLatin1(uri, uri.size());
+ mozUri += QLatin1Char('\n');
+ *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()),
+ mozUri.length() * 2);
+ } else if (atomName == QLatin1String("application/x-color"))
*dataFormat = 16;
ret = true;
- } else if (atomName == QLatin1String("text/x-moz-url") &&
- QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) {
- QByteArray uri = QInternalMimeData::renderDataHelper(
- QLatin1String("text/uri-list"), mimeData).split('\n').first();
- QString mozUri = QString::fromLatin1(uri, uri.size());
- mozUri += QLatin1Char('\n');
- *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), mozUri.length() * 2);
- ret = true;
} else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) {
ret = true;
}
--
2.7.4

View File

@ -0,0 +1,149 @@
From 76adb6c29f9284a3d7cceb8fb09c3bb7c4cd5e1b Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Thu, 21 Apr 2016 01:39:27 +0200
Subject: xcb: Use the state of the key event to process it
Instead of the global state
Task-number: QTBUG-48795
Change-Id: Ic2c545718adb68df41730e5a3bf25adb374ffce3
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
---
src/plugins/platforms/xcb/qxcbkeyboard.cpp | 72 ++++++++++++++++++------------
src/plugins/platforms/xcb/qxcbkeyboard.h | 2 +
2 files changed, 46 insertions(+), 28 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 28de86b..e0fcc01 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -742,8 +742,7 @@ void QXcbKeyboard::updateKeymap()
// update xkb state object
xkb_state_unref(xkb_state);
xkb_state = new_state;
- if (!connection()->hasXKB())
- updateXKBMods();
+ updateXKBMods();
checkForLatinLayout();
}
@@ -768,32 +767,37 @@ void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state)
}
#endif
+void QXcbKeyboard::updateXKBStateFromState(struct xkb_state *kb_state, quint16 state)
+{
+ const quint32 modsDepressed = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_DEPRESSED);
+ const quint32 modsLatched = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_LATCHED);
+ const quint32 modsLocked = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_LOCKED);
+ const quint32 xkbMask = xkbModMask(state);
+
+ const quint32 latched = modsLatched & xkbMask;
+ const quint32 locked = modsLocked & xkbMask;
+ quint32 depressed = modsDepressed & xkbMask;
+ // set modifiers in depressed if they don't appear in any of the final masks
+ depressed |= ~(depressed | latched | locked) & xkbMask;
+
+ const xkb_state_component newState
+ = xkb_state_update_mask(kb_state,
+ depressed,
+ latched,
+ locked,
+ 0,
+ 0,
+ (state >> 13) & 3); // bits 13 and 14 report the state keyboard group
+
+ if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) {
+ //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)");
+ }
+}
+
void QXcbKeyboard::updateXKBStateFromCore(quint16 state)
{
if (m_config && !connection()->hasXKB()) {
- const quint32 modsDepressed = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_DEPRESSED);
- const quint32 modsLatched = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED);
- const quint32 modsLocked = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED);
- const quint32 xkbMask = xkbModMask(state);
-
- const quint32 latched = modsLatched & xkbMask;
- const quint32 locked = modsLocked & xkbMask;
- quint32 depressed = modsDepressed & xkbMask;
- // set modifiers in depressed if they don't appear in any of the final masks
- depressed |= ~(depressed | latched | locked) & xkbMask;
-
- const xkb_state_component newState
- = xkb_state_update_mask(xkb_state,
- depressed,
- latched,
- locked,
- 0,
- 0,
- (state >> 13) & 3); // bits 13 and 14 report the state keyboard group
-
- if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) {
- //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)");
- }
+ updateXKBStateFromState(xkb_state, state);
}
}
@@ -1455,7 +1459,16 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type,
if (type == QEvent::KeyPress)
targetWindow->updateNetWmUserTime(time);
- xcb_keysym_t sym = xkb_state_key_get_one_sym(xkb_state, code);
+ // Have a temporary keyboard state filled in from state
+ // this way we allow for synthetic events to have different state
+ // from the current state i.e. you can have Alt+Ctrl pressed
+ // and receive a synthetic key event that has neither Alt nor Ctrl pressed
+ struct xkb_state *kb_state = xkb_state_new(xkb_keymap);
+ if (!kb_state)
+ return;
+ updateXKBStateFromState(kb_state, state);
+
+ xcb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, code);
QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext();
QMetaMethod method;
@@ -1474,11 +1487,13 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type,
Q_ARG(uint, code),
Q_ARG(uint, state),
Q_ARG(bool, type == QEvent::KeyPress));
- if (retval)
+ if (retval) {
+ xkb_state_unref(kb_state);
return;
+ }
}
- QString string = lookupString(xkb_state, code);
+ QString string = lookupString(kb_state, code);
// Ιf control modifier is set we should prefer latin character, this is
// used for standard shortcuts in checks like "key == QKeySequence::Copy",
@@ -1547,6 +1562,7 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type,
QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers,
code, sym, state, string, isAutoRepeat);
}
+ xkb_state_unref(kb_state);
}
QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) const
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h
index 457a27a..dc27511 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
@@ -98,6 +98,8 @@ protected:
void checkForLatinLayout();
private:
+ void updateXKBStateFromState(struct xkb_state *kb_state, quint16 state);
+
bool m_config;
xcb_keycode_t m_autorepeat_code;
--
cgit v1.0-4-g1e03