summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* platforminputcontexts: use libxkbcommon compose key APIGatis Paeglis2019-03-011-658/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our implementation of compose table parser was added on Mar, 2013. libxkbcommon added APIs for the same thing in Oct, 2014 (ver: 0.5.0). After removing RHEL 6.6 from the list of supported platforms we were able to move the minimal required libxkbcommon version to 0.5.0. Now we can use the xkbcommon-compose APIs on all supported platforms. With this patch we can drop nearly 1000 lines of maintenance burden. This patch fixes user reported issues with our implementation. Known issues: - Testing revealed that xkbcommon-compose does not support non-utf8 locales, and that is by design - https://github.com/xkbcommon/libxkbcommon/issues/76 Our implementation did work for those locales too, but it is unclear if anyone actually uses non-utf8 locales. It is a corner case (work-arounds existing) and likely a configuration error on the users' system. - Looking at the release notes for versions above 0.6.1, only one issue that stands out. Compose input does not work on system with tr_TR.UTF-8 locale, fixed in 0.7.1. Compose input works fine when using e.g. en_US.UTF-8 locale with Turkish keyboard layout. Note: With Qt 5.13 we have removed Ubuntu 16.04 and openSUSE 42.3 from CI: Ubuntu 16.04 - 0.5.0 openSUSE 42.3 - 0.6.1 CI for Qt 5.13 has: Ubuntu 18.04 - 0.8.0 RHEL-7.4 - 0.7.1 openSUSE 15.0 - 0.8.1 Currently the minimal required libxkbcommon version in src/gui/configure.json is set to 0.5.0, but we could bump it to 0.7.1 to avoid known issues from above, but that is a decision for a separate patch. [ChangeLog][plugins][platforminputcontexts] Now using libxkbcommon-compose APIs for compose key input, instead of Qt's own implementation. Fixes: QTBUG-42181 Fixes: QTBUG-53663 Fixes: QTBUG-48657 Change-Id: I79aafe2bc601293844066e7e5f5eddd3719c6bba Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* QTableGenerator: Fix handling of illegal characters in fromBase8 againRobert Loehning2017-10-191-1/+1
| | | | | Change-Id: Iaee19f71e5b74b0d43b628739039ca3c2be60cd0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QTableGenerator: Fix handling of illegal characters in fromBase8Robert Loehning2017-08-231-1/+1
| | | | | | | Task-number: QTBUG-60387 Change-Id: I084c2b4a86439857e898e9adc7370c19961d0126 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build without features.temporaryfileTasuku Suzuki2017-01-251-1/+8
| | | | | | Change-Id: I3f26f122a20aa8e59baaf3f33b89cc776865ff8b Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Plugins: use reserve() to optimize memory allocationsAnton Kudryavtsev2016-10-211-0/+1
| | | | | | Change-Id: Id78ce43137e352292a9933222fe2f92d4ff4d69b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTableGenerator: give some TLC to the sorting predicateMarc Mutz2016-10-061-1/+1
| | | | | | | | | | | | | | | | | | - Provide op()(uint[], QComposeTableElement) as well, since the standard (does|did) not specify in which order the two are called. - Use std::lexicographical_compare to do the ... lexicographical comparison. - Share code by calling a new op()(uint[], uint[]) overload from all other overloads. - Mark all op() overloads const noexept. - Rename from 'Compare' to 'ByKeys', as in 'sort(vector, ByKeys()))'. - Replace a hand-rolled loop with std::equal. - Replace a #define with a static constexpr variable. Change-Id: I5ed487199916d0ae44ac38741fc95099bd2f8a22 Reviewed-by: Sune Vuorela <sune@vuorela.dk> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-161-7/+7
|\ | | | | | | | | | | | | Conflicts: src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp Change-Id: I0af32ee55936d523cbd259b6fe82eb9c409f9074
| * QTableGenerator: Fix uninit'ed valuesMarc Mutz2016-09-161-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | It's probably benign, but it causes Corverity to complain, so always init all fields of QComposeCacheFileHeader. Format the code so it can easily be ported to uniform init later on. Coverity-Id: 93043 Change-Id: Ifa1ccc3fa58dc813306917f216772fd24d4930c9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Use QStringLiteral more judiciouslyAnton Kudryavtsev2016-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace it with QL1S in QStringBuilder expressions and in overloaded functions. Replace patterns 'QString::number() + QStringLiteral' and 'QStringLiteral + QString::number()' with QString::asprintf. Saves some text size. Change-Id: Ib39b2332264dfc3df04e77f2c101b47a1030cef4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-021-3/+3
|\| | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test src/plugins/platforms/cocoa/qcocoahelpers.mm src/tools/qlalr/cppgenerator.cpp Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
| * Use QFile::exists(f) instead of QFile(f).exists().Anton Kudryavtsev2016-01-271-3/+3
| | | | | | | | | | | | | | It's faster. Change-Id: Ie57619b4e0c53975aa955c83c833c34e1446e4c8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Check for any existing file in XCOMPOSEFILE.Giuseppe D'Angelo2015-12-091-3/+3
| | | | | | | | | | | | | | | Before this change, it was checked if the path ends with "Compose", which was an invalid assumption as the file can have any name (see [1]) This replaces the check with a check for any existing file (which wasn't checked before). [1] http://www.x.org/releases/X11R7.7/doc/man/man5/Compose.5.xhtml Done-with: Florian Bruhin <git@the-compiler.org> Task-number: QTBUG-41557 Change-Id: If4fb58d4c1ed695f2d611236abfe97964b548678 Reviewed-by: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-04-221-1/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/statemachine/qstatemachine.cpp src/corelib/statemachine/qstatemachine_p.h src/gui/painting/qdrawhelper.cpp src/plugins/platforms/xcb/qxcbnativeinterface.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/plugins/platforms/xcb/qxcbwindow.h src/testlib/qtestblacklist.cpp src/tools/qdoc/node.cpp src/tools/qdoc/node.h tests/auto/gui/painting/qcolor/tst_qcolor.cpp Change-Id: I6c78b7b162001712d5774293f501b06b4ff32684
| * Fix regression in compose table parsingGatis Paeglis2015-04-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Speed up compose file parsing in the X11 composition input method pluginSimon Hausmann2015-04-101-1/+1
| | | | | | | | | | | | | | | | 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>
* | Optimize QApplication startup time by caching the Compose fileUrsache Vladimir2015-04-081-33/+202
|/ | | | | | | Please find the explanation at the top of qtablegenerator.cpp. Change-Id: Ib1a5ee49d382034520ed0871bb524b7931cf330a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Pass params of shareable type by const-ref rather than by valueKonstantin Ritt2015-02-131-1/+1
| | | | | | | | ...where passing them by value was not intentional. Change-Id: Ifd5036d57b41fddeeacfbd3f5890881605b80647 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Simplify QTableGenerator::printComposeTable()Marc Mutz2015-02-121-15/+9
| | | | | | | | | | | | | | | Instead of filling a QString with lots of temporaries in-between, simply stream everything into QDebug directly. Requires the use of #ifndef QT_NO_DEBUG_STREAM because of the explicit mentioning of QDebug. Further simplified it by removing the complicated trailing-comma handling. The struct-like output can tolerate a trailing comma which has been allowed in C/C++ since its inception. Change-Id: I0393a37cd21a50e902c8cb9f8b752ebb946d1669 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* QTableGenerator: replace a call to a member function with direct element accessMarc Mutz2014-10-131-1/+1
| | | | | | | | Saves one copy of a vector. Change-Id: I3a14c46e306c3d44a64c6e0d8cd2f120b2c208d7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Compose key plugin: expand "%L" to full path.Gatis Paeglis2014-06-111-8/+13
| | | | | | | | | | | According to [1] "%L" should expand to a full path for the default (based on system's locale) Compose file. [1] http://www.x.org/archive/current/doc/man/man5/Compose.5.xhtml Task-number: QTBUG-35943 Change-Id: Ie803a89742d9c0aa3b2d759bea28ed403dc68c9c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Be less verbose about invalid keysymsGatis Paeglis2014-04-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Report invalid keysyms only when DEBUG_GENERATOR is defined. It is not unusal that Qt applications are used on old linux distributions where Compose files might be far behind the current development, therefore we should be less verbose when encountering invalid keysyms. On Red Hat 5 compose key plugin reports ~3200 lines of warning messages: "Qt Warning - invalid keysym: U1001D1BC" "Qt Warning - invalid keysym: U1001D16F" "Qt Warning - invalid keysym: U1001D1BA" "Qt Warning - invalid keysym: U1001D165" "Qt Warning - invalid keysym: U1001D16F" ... Task-number: QTBUG-34483 Change-Id: If0c51d300508ef164ad7fc59b0a76a838cd5a3b9 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Update bundled libxkbcommon version to 0.4.0Gatis Paeglis2014-03-191-20/+0
| | | | | | | | | | | | | This release comes with important bug fixes. Also we can now remove the workaround code which was needed for libxkbcommon 0.2.0. Task-number: QTBUG-31712 Task-number: QTBUG-33732 Task-number: QTBUG-34056 Change-Id: I57caf7f803b9a01a15541a5ad82e464de3b8abbb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Append additional compose file search pathsGatis Paeglis2014-03-061-7/+13
| | | | | | | | On FreeBSD Compose files are stored in different place than on Linux distributions, this patch adds new search paths. Change-Id: Ic1e745801a2f9a53d1af058be8a1dfaced5032a7 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-121-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/gui/image/qimage.cpp src/gui/text/qtextengine.cpp src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp src/printsupport/kernel/qprintengine_win.cpp Change-Id: I09ce991a57f39bc7b1ad6978d0e0d858df0cd444
| * Compose: Fix assert for non-UTF8 locales in table generatorGabriel de Dietrich2014-02-071-1/+1
| | | | | | | | | | | | Task-number: QTBUG-35770 Change-Id: I8aaea66e8d70edf7ab401f2c6dfb849d309ff6af Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
* | Use pkg-config to find the prefix for X11 installGabriel de Dietrich2014-01-201-7/+3
| | | | | | | | | | | | | | | | | | | | | | Needed to run the XKB extension where we used to expect X11 to be installed in /usr. In FreeBSD, for instance, X11 is installed in /usr/local like all the other not out-of-the-box packages. Same thing goes for the compose platform input context plugin. Change-Id: Ib7ace3117eaacc6e150394450d1330cba654ba8a Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-01-101-4/+2
|\| | | | | | | Change-Id: I99af0bef7f1c931533a324ebcfb27c40ee871a5e
| * Don't check if a file exists before opening itThiago Macieira2014-01-101-4/+2
| | | | | | | | | | | | | | | | | | If the file doesn't exist, open() will fail. But open() might fail even if the file exists(), which would lead to bad follow-up code. In any case, this saves one unnecessary stat(2). Change-Id: Ic99507c9dc07a4387ee6a4fe9c24830fca54e095 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-11-261-10/+54
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the conflicts in msvc_nmake.cpp the ifdefs are extended since we need to support windows phone in the target branch while it is not there in the current stable branch (as of Qt 5.2). Conflicts: configure qmake/generators/win32/msvc_nmake.cpp src/3rdparty/angle/src/libEGL/Surface.cpp src/angle/src/common/common.pri src/corelib/global/qglobal.h src/corelib/io/qstandardpaths.cpp src/plugins/platforms/qnx/qqnxintegration.cpp src/plugins/platforms/qnx/qqnxscreeneventhandler.h src/plugins/platforms/xcb/qglxintegration.h src/widgets/kernel/win.pri tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp tools/configure/configureapp.cpp Change-Id: I00b579eefebaf61d26ab9b00046d2b5bd5958812
| * Look at locale aliases if initial search in compose.dir failsGatis Paeglis2013-11-211-10/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The file "locale.alias" (located in the same directory as "compose.dir"), contains following text: "This file contains alias name of locale. Each alias name is described within one line. The first word is the alias name (simplified locale name) the second word is full locale name." Therefore, if initial search in the compose.dir fails to find a match we make sure that a 'full locale name' was used in the initial search, if not, we try again. Task-number: QTBUG-32461 Change-Id: Ie7766658f22433524bd6e4bc829e32c6e3a0cbd0 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-10-241-0/+1
|\| | | | | | | Change-Id: Ie56539b2e0be611a363b5f15ae5412a78d6945a2
| * Fix compilation with Clang and libc++ under LinuxMarcel Krems2013-10-161-0/+1
| | | | | | | | | | | | | | | | | | | | src/plugins/platforms/xcb/qxcbsessionmanager.cpp:205:80: error: use of undeclared identifier 'ERANGE' while (getpwuid_r(geteuid(), &entry, buf.data(), buf.size(), &entryPtr) == ERANGE) { src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp:173:28: error: use of undeclared identifier 'LC_CTYPE' char *name = setlocale(LC_CTYPE, (char *)0); Change-Id: Ide6f3072e9158eef412973ce0a72babb41b695f0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix clang build for libc++Donald Carr2013-10-021-0/+1
|/ | | | | | | | | | | | | | Successfully builds Qt 5.2 with: QMAKE_CXXFLAGS_CXX11 += -std=c++11 -stdlib=libc++ QMAKE_LFLAGS_CXX11 += -stdlib=libc++ -lc++abi against: clang version 3.3 (tags/RELEASE_33/final) Change-Id: I778f9410c6563e78bc77ae4c20097fa561503ba1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove deprecated QtAlgorithms calls from the compose inputcontextGiuseppe D'Angelo2013-09-051-1/+3
| | | | | | | | QtAlgorithms is getting deprecated, see http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I75ecfb84befd5dcc44f2ffcbef2cb6f1cc39cfd8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cut away 2/3 of the startup time on LinuxLars Knoll2013-08-151-76/+119
| | | | | | | | | Optimize the parser of the X11 compose tables. Parsing these was responsible for over 90% of the startup time in Qt 5.1. Change-Id: Ifddc3f30828791e51a755f92791c26ffe43a9cd3 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make access to xkbcommon_workaround.h more genericGatis Paeglis2013-05-071-0/+7
| | | | | | | | | | It makes more sense to keep this workaround header together with the other libxkbcommon files for a better access point since it's used by several *.pro files. Change-Id: I63d4eb58f6e7f3852834e41c4b6e058a2c962233 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Fix memory access violationKonstantin Ritt2013-04-231-2/+1
| | | | | | | | The pointer returned by unicode() was deleted right afterwards. Change-Id: I7cef72386d02c7be42e71134f616926506d37ea6 Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Fix typo in qWarning()Sergio Martins2013-04-171-1/+1
| | | | | Change-Id: I17aa0a1985c2da889bc602fd76dc07c890ed6f6b Reviewed-by: David Faure (KDE) <faure@kde.org>
* s/uint32_t/quint32/Tobias Hunger2013-04-121-4/+4
| | | | | | | | | uint32_t is in C++11, which we can not rely on being present. It is also in C99, but some compilers do not support that in C++ mode. Change-Id: I29bada724f5646a0a0562b3ab133cb49cf928d6d Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
* Fix access to invalid memoryKai Koehne2013-04-101-1/+2
| | | | | | | | | QString::toLatin1() creates a temporary QByteArray. Task-number: QTBUG-30578 Change-Id: I17c60bbade1486399f745c7e9878c6467971e6cc Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Remove unused header file.Gatis Paeglis2013-03-301-2/+0
| | | | | | | | As Thomas Senyk found out, the compose input context plugin had a redundant include for the X11 keysym header file. Change-Id: Iad603b545803867d02d915acffe27991bb0b7ee4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Introducing QComposeInputContextGatis Paeglis2013-03-211-0/+402
When switching from Xlib to xcb platform plugin it was agreed that XIM is deprecated. Users should be using QT_IM_MODULE to load input context plugin for a more advance input method framework support. The proposed solution is to parse the compose file directly from Qt. This approach removes the overhead of communication protocols used in Xlib and/or IBUS. TableGenerator class follows [1]. The compose file is searched for in the following order: 1) If the environment variable $XCOMPOSEFILE is set, its value is used as the name of the Compose file. 2) If the user’s home directory has a file named .XCompose, it is used as the Compose file. 3) The system provided compose file is used by mapping the locale to a compose file from the list in /usr/share/X11/locale/compose.dir. Regarding step 3 - TableGenerator searches in hard-coded locations for system-provided compose files. Here I have introcuded a new environment variable QTCOMPOSE which can be used to prepend an extra location to be searched. [1] http://www.x.org/archive/X11R7.7/doc/man/man5/Compose.5.xhtml Task-number: QTBUG-28183 Change-Id: I76dcfd454f3acc23db98192a3673c1ab2af4425f Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>