Accepting request 297744 from KDE:Qt5

- Added patches from upstream:
  0001-Speed-up-compose-file-parsing-in-the-X11-composition.patch
  0002-Speed-up-application-startup-on-X11.patch and
  Fix-regression-in-compose-table-parsing.patch

- Add cleaning of QMAKE_PRL_BUILD_DIR from prl files in
  %qmake5_install macro

OBS-URL: https://build.opensuse.org/request/show/297744
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=39
This commit is contained in:
Dominique Leuenberger 2015-04-21 23:12:14 +00:00 committed by Git OBS Bridge
parent 48a849b9f3
commit 5d3b55ecde
6 changed files with 192 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 4e3b27ffc2f2d4d528abbbe58ee43acce0700fb2 Mon Sep 17 00:00:00 2001
From: Simon Hausmann <simon.hausmann@theqtcompany.com>
Date: Fri, 10 Apr 2015 08:46:37 +0200
Subject: [PATCH 1/2] Speed up compose file parsing in the X11 composition
input method plugin
There's no need to decode the string until the end of the line, it's
sufficient to stop at the end of the quotes.
Change-Id: Ie617d2538511e91d0e0146f98b7e5ea3213b8db2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
(cherry picked from commit 1aab68648d3aa38811be38b5bbd3a0704e17ccf8)
---
src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
index 4e90f618765e7a9a0509af7282500c133f11d3e3..622c71e5b01219cd39d594557a9d3ca63eea8748 100644
--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
@@ -399,7 +399,7 @@ void TableGenerator::parseKeySequence(char *line)
// handle direct text encoded in the locale
if (*composeValue == '\\')
++composeValue;
- elem.value = QString::fromLocal8Bit(composeValue).at(0).unicode();
+ elem.value = QString::fromLocal8Bit(composeValue, composeValueEnd - composeValue).at(0).unicode();
++composeValue;
}
--
2.3.5

View File

@ -0,0 +1,98 @@
From bf425e52923e84c93b74ec4644045014a2d5a9a1 Mon Sep 17 00:00:00 2001
From: Simon Hausmann <simon.hausmann@theqtcompany.com>
Date: Fri, 10 Apr 2015 09:01:47 +0200
Subject: [PATCH 2/2] Speed up application startup on X11
Avoid parsing the composition tables on application startup. Instead let's
do that on-demand the first time a composition key is pressed.
Change-Id: I52feb36246a091b9a84d46e479ba2ad1f5cd1556
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
(cherry picked from commit d11665b27ce3357fb30bff6ffc1379a4756ec8d1)
---
.../compose/qcomposeplatforminputcontext.cpp | 32 ++++++++++++----------
.../compose/qcomposeplatforminputcontext.h | 1 +
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
index b0e34e3edc73b27d181bff6589877ed301dadfdc..c34978c720c226b298350362957b2eb149d58470 100644
--- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
@@ -80,37 +80,32 @@ static const int composingKeys[] = {
};
QComposeInputContext::QComposeInputContext()
+ : m_tableState(TableGenerator::EmptyTable)
+ , m_compositionTableInitialized(false)
{
- TableGenerator reader;
- m_tableState = reader.tableState();
-
- if ((m_tableState & TableGenerator::NoErrors) == TableGenerator::NoErrors) {
- m_composeTable = reader.composeTable();
- clearComposeBuffer();
- }
+ clearComposeBuffer();
}
bool QComposeInputContext::filterEvent(const QEvent *event)
{
- // if there were errors when generating the compose table input
- // context should not try to filter anything, simply return false
- if ((m_tableState & TableGenerator::NoErrors) != TableGenerator::NoErrors)
- return false;
-
QKeyEvent *keyEvent = (QKeyEvent *)event;
// should pass only the key presses
if (keyEvent->type() != QEvent::KeyPress) {
return false;
}
+ // if there were errors when generating the compose table input
+ // context should not try to filter anything, simply return false
+ if (m_compositionTableInitialized && (m_tableState & TableGenerator::NoErrors) != TableGenerator::NoErrors)
+ return false;
+
int keyval = keyEvent->key();
int keysym = 0;
if (ignoreKey(keyval))
return false;
- QString text = keyEvent->text();
- if (!composeKey(keyval) && text.isEmpty())
+ if (!composeKey(keyval) && keyEvent->text().isEmpty())
return false;
keysym = keyEvent->nativeVirtualKey();
@@ -163,6 +158,15 @@ static bool isDuplicate(const QComposeTableElement &lhs, const QComposeTableElem
bool QComposeInputContext::checkComposeTable()
{
+ if (!m_compositionTableInitialized) {
+ TableGenerator reader;
+ m_tableState = reader.tableState();
+
+ if ((m_tableState & TableGenerator::NoErrors) == TableGenerator::NoErrors)
+ m_composeTable = reader.composeTable();
+
+ m_compositionTableInitialized = true;
+ }
QVector<QComposeTableElement>::const_iterator it =
std::lower_bound(m_composeTable.constBegin(), m_composeTable.constEnd(), m_composeBuffer, Compare());
diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h
index 897b164b3be22be99d8bdeaf45bcffc0a141009a..52654b458d0265d778926df22ad00094a4f6847c 100644
--- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h
@@ -70,6 +70,7 @@ private:
QVector<QComposeTableElement> m_composeTable;
uint m_composeBuffer[QT_KEYSEQUENCE_MAX_LEN + 1];
TableGenerator::TableState m_tableState;
+ bool m_compositionTableInitialized;
};
QT_END_NAMESPACE
--
2.3.5

View File

@ -0,0 +1,35 @@
From 365c63e7b177701c0bf80a7cb138b7559b92f350 Mon Sep 17 00:00:00 2001
From: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
Date: Tue, 14 Apr 2015 14:00:05 +0200
Subject: Fix regression in compose table parsing
Performance optimization from 1aab68648 revealed
that "composeValueEnd" needs adjustment for compose
sequences that result in a quotation mark, for example:
<dead_diaeresis> <space> : "\"" quotedbl # REVERSE SOLIDUS
Change-Id: I66bf83fbe62727f1ee245aae90f8d0eb53dea6d4
Task-number: QTBUG-45538
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
---
.../platforminputcontexts/compose/generator/qtablegenerator.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
index 120b228..65020eb 100644
--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
@@ -385,6 +385,10 @@ void TableGenerator::parseKeySequence(char *line)
if (!composeValueEnd)
return;
+ // if composed value is a quotation mark adjust the end pointer
+ if (composeValueEnd[1] == '"')
+ ++composeValueEnd;
+
if (*composeValue == '\\' && composeValue[1] >= '0' && composeValue[1] <= '9') {
// handle octal and hex code values
char detectBase = composeValue[2];
--
cgit v0.11.0

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Wed Apr 15 12:53:21 UTC 2015 - hrvoje.senjan@gmail.com
- Added patches from upstream:
0001-Speed-up-compose-file-parsing-in-the-X11-composition.patch
0002-Speed-up-application-startup-on-X11.patch and
Fix-regression-in-compose-table-parsing.patch
-------------------------------------------------------------------
Thu Apr 9 17:29:15 UTC 2015 - hrvoje.senjan@gmail.com
- Add cleaning of QMAKE_PRL_BUILD_DIR from prl files in
%qmake5_install macro
-------------------------------------------------------------------
Fri Feb 27 17:19:10 UTC 2015 - hrvoje.senjan@gmail.com

View File

@ -71,6 +71,12 @@ Patch2004: Handle-SelectionWindowDestroy-in-QXcbClipboard.patch
Patch2005: Call-ofono-nm-Registered-delayed-in-constructor-othe.patch
# PATCH-FIX-UPSTREAM fix-a-division-by-zero-when-processing-malformed-BMP-files.patch
Patch2006: fix-a-division-by-zero-when-processing-malformed-BMP-files.patch
# PATCH-FIX-UPSTREAM 0001-Speed-up-compose-file-parsing-in-the-X11-composition.patch
Patch2007: 0001-Speed-up-compose-file-parsing-in-the-X11-composition.patch
# PATCH-FIX-UPSTREAM 0002-Speed-up-application-startup-on-X11.patch
Patch2008: 0002-Speed-up-application-startup-on-X11.patch
# PATCH-FIX-UPSTREAM Fix-regression-in-compose-table-parsing.patch
Patch2009: Fix-regression-in-compose-table-parsing.patch
BuildRequires: alsa-devel
BuildRequires: cups-devel
BuildRequires: gcc-c++
@ -162,6 +168,9 @@ handling.
%patch2004 -p1
%patch2005 -p1
%patch2006 -p1
%patch2007 -p1
%patch2008 -p1
%patch2009 -p1
# be sure not to use them
rm -r src/3rdparty/{libjpeg,freetype,libpng,zlib}

View File

@ -24,4 +24,7 @@
%{__make} %{?_smp_mflags} VERBOSE=1
%qmake5_install \
make INSTALL_ROOT=%{buildroot} install
make INSTALL_ROOT=%{buildroot} install ; \
if [ "`ls %{buildroot}%{_libqt5_libdir}/*prl 2>/dev/null | wc -l`" != "0" ]; then \
sed -i -e "/^QMAKE_PRL_BUILD_DIR/d" %{buildroot}%{_libqt5_libdir}/*prl \
fi \