1
0
forked from pool/libqt5-qtbase
libqt5-qtbase/0002-Speed-up-application-startup-on-X11.patch
Dominique Leuenberger 5d3b55ecde 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
2015-04-21 23:12:14 +00:00

99 lines
3.9 KiB
Diff

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