summaryrefslogtreecommitdiffstats
path: root/src/gui/platform/unix/qxkbcommon.cpp
Commit message (Collapse)AuthorAgeFilesLines
* qxkbcommon: Map Super/Hyper to Meta early enough to have an effectAndrey Butirsky2021-05-251-6/+6
| | | | | | | | | | | | Super/Hyper keys are detected during a direct mapping phase, but the function returned before the translation to Meta could take place. Task-number: QTBUG-62102 Change-Id: I9f7ccfd757fa86dbc648951306deb1b43ccf4167 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Andrey Butirsky <butirsky@gmail.com> (cherry picked from commit b45b9090c3b66d541f57f8d049c22247f8c115ca) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix no mapping for SysReq keyAndrey Butirsky2021-03-251-0/+1
| | | | | | | | | | | | | | | | | | XKB_KEY_Sys_Req keysym is currently unmapped to any Qt::Key. Implication of this it is uncapable to participate in any keyboard shortcuts. This patch adds the missing mapping. Detected by testXkb KWin unit test Fixes: QTBUG-92087 Change-Id: I2440c218e265c5636fc1d2703f14d8bfe033967e Reviewed-by: Andrey Butirsky <butirsky@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org> (cherry picked from commit 40193c2b6919875a714e84f5029ba2bcc1f9e258) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix XCB launch key mappingAllan Sandfeld Jensen2021-01-161-18/+17
| | | | | | | | | | | | | | They have been reported wrong since Qt 4, and not fixed for behavior compatibility, fixing it for Qt 6. [ChangeLog][X11] XF86LaunchXX keys have been remapped, so the Qt names and X11 names match, instead of being 2 off. Fixes: QTBUG-25261 Change-Id: Ie3a8676439ae3e93a78218c9e7f4443565e84356 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> (cherry picked from commit cfd935fe6c26800befc10889afc0aebde311acca) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Un-special-case macOS in handling of QKeyEvent::nativeScanCode()Tor Arne Vestbø2020-10-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | In the porting from Qt 4 to Qt 5 an assumption was made in QKeyMapper that the underlying platform implementation needed the native scan code to be able to resolve the possible keymaps for an event. As a result, the macOS platform plugin started sending key events with a fake native scan code of 1, so that it would still be allowed to map key events. Which in turn led to the documentation of QKeyEvent::nativeScanCode() getting an exception for macOS. Let's clean up this by removing the original assumption, and leave it up to the platforms to decide what information from the key event is needed. QKeyMapperPrivate::possibleKeys() will still call extractKeyFromEvent as a fallback if the platform layer doesn't return any possible keys. Change-Id: I122a45bcec658c45ccc0b2c0671eb264d85d7be6 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Long live QKeyCombination!Giuseppe D'Angelo2020-09-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++20 via P1120 is deprecating arithmetic operations between unrelated enumeration types, and GCC 10 is already complaining. Hence, these operations might become illegal in C++23 or C++26 at the latest. A case of this that affects Qt is in key combinations: a QKeySequence can be constructed by summing / ORing modifiers and a key, for instance: Qt::CTRL + Qt::Key_A Qt::SHIFT | Qt::CTRL | Qt::Key_G (recommended, see below) The problem is that the modifiers and the key belong to different enumerations (and there's 2 enumerations for the modifier, and one for the key). To solve this: add a dedicated class to represent a combination of keys, and operators between those enumerations to build instances of this class. I would've simply defined operator|, but again docs and pre-existing code use operator+ as well, so added both to at least tackle simple cases (modifier + key). Multiple modifiers create a problem: operator+ between them yields int, not the corresponding flags type (because operator+ is not overloaded for this use case): Qt::CTRL + Qt::SHIFT + Qt::Key_A \__________________/ / int / \______________/ int Not only this loses track of the datatypes involved, but it would also then "add" the key (with NO warnings, now its int + enum, so it's not mixing enums!) and yielding int again. I don't want to special-case this; the point of the class is that int is the wrong datatype. Everything works just fine when using operator| instead: Qt::CTRL | Qt::SHIFT | Qt::Key_A \__________________/ / Qt::Modifiers / \______________/ QKeyCombination So I'm defining operator+ so that the simple cases still work, but also deprecating it. Port some code around Qt to the new class. In certain cases, it's a huge win for clarity. In some others, I've just added the necessary casts to make it still compile without warnings, without attempting refactorings. [ChangeLog][QtCore][QKeyCombination] New class to represent a combination of a key and zero or more modifiers, to be used when defining shortcuts or similar. [ChangeLog][Potentially Source-Incompatible Changes] A keyboard modifier (such as Qt::CTRL, Qt::AltModifier, etc.) should be combined with a key (such as Qt::Key_A, Qt::Key_F1, etc.) by using operator|, not operator+. The result is now an object of type QKeyCombination, that stores the key and the modifiers. Change-Id: I657a3a328232f059023fff69c5031ee31cc91dd6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use QList instead of QVector in gui implementationJarek Kobus2020-07-071-1/+1
| | | | | | | Task-number: QTBUG-84469 Change-Id: I366e845249203d80d640355a7780ac2f91a762f1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Move xkbcommon to QtGuiFriedemann Kleint2020-07-041-0/+828
Task-number: QTBUG-83255 Change-Id: Ia1c6a49af6be4aaa6b988537c38db3a2c0a646a5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>