summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbkeyboard.h
Commit message (Collapse)AuthorAgeFilesLines
* platforminputcontexts: use libxkbcommon compose key APIGatis Paeglis2019-03-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* platformsupport/input: add xkbcommon utilities libGatis Paeglis2019-03-011-28/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | xcb/eglfs/wayland - all use XKB keyboard configs and APIs. There is a lot of duplicated and naturally a diverging code. This patch adds a helper library to avoid all the mentioned problems and unify feature set between these platforms. qlibinputkeyboard: Added a fixup for 2803cdf758dbae1006a0c50300af12dac9f71531. From spec: "keysyms, when bound to modifiers, affect the rules [..]", meaning we can't look at keys in isolation, but have to check if bounding exists in the keymap. This is done by using xkb_state_mod_name_is_active() API, but that API has its limitations - https://github.com/xkbcommon/libxkbcommon/issues/88 I will fix this separately in the LTS (5.12) branch. We need to read the modifier state before the key action. This patch fixes a regression introduced by aforementioned patch, which caused modifiers being reported wrongly in QKeyEvent::modifiers(). qtwayland: Moved toKeysym(QKeyEvent) from qtwayland repository into this library. For this and other key mapping functionality wayland was duplicating the key table. All of that will be removed from qtwayland, and calls will be replaced to use this lib. Adjusted toKeysym() to fix QTBUG-71301. Qt keys don't map to ASCII codes, so first we need search in our key table, instead of mapping from unicode. lookupStringNoKeysymTransformations(): fixed off-by-one error, where we were including terminating NUL in QString. Fixes: QTBUG-71301 Task-number: QTBUG-65503 Change-Id: Idfddea5b34ad620235dc08c0b9e5a0669111821a Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* xcb: qxcbconnection_basicGatis Paeglis2018-10-171-0/+7
| | | | | | | | | | | | A basic base class that creates a connection and initializes extensions. The goal was to reduce the size of qxcbconnection.h/cpp. Made QXcbAtom into a class that handles atom initialization and exposes the relevant APIs. Before this patch, all of that logic was inside of qxcbconnection.h/cpp. Change-Id: Ia893c3b31e2343dfbe62fe2aa6bfd0017abf46ea Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: rewrite auto-repeat key detection logicGatis Paeglis2018-08-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | It's unclear what the original code was doing. It relied on 'm_release' which could never be 'false' (ref. QTBUG-69679). It was subtracting event times and comparing with arbitrary '10'. On X11 auto-repeat keys can be detected by checking time and keycode of the current release event and the next event in the queue. If an event is an auto-repeat, then next event in the queue will be a key press with matching time and keycode. Verified that auto-repeat was unreliable in Qt 4 as well. With this patch auto-repeat works as expected. Added support for Xlib's XPeekEvent in our XCB implementation QXcbConnection::checkEvent(): "The XPeekEvent() function returns the first event from the event queue, but it does not remove the event from the queue." Sneaking in one variable renaming: "string" -> "text", to match the QKeyEvent::text(). Task-number: QTBUG-57335 Task-number: QTBUG-69679 Change-Id: I0a23f138287f57eaaecf1a009bd939e7e0e23269 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: Use XCB instead of Xlib for XInputAlexander Volkov2018-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | - Replace xinput2 feature by xcb-xinput, which doesn't depend on xcb-xlib - Remove xi2PrepareXIGenericDeviceEvent() that was used to fix incompatibilty between XCB and libXi structs - Drop XCB_USE_XINPUT21 and XCB_USE_XINPUT22 defines that were needed with libXi Although xcb-xinput was released in version 1.13 of libxcb, it was quite stable in version 1.12, and the parts that we use did not change between versions, so require system xcb-xinput 1.12. [ChangeLog][X11] The xcb plugin was ported to use libxcb-xinput instead of libXi for XInput2 support. The -xinput2 configure option was replaced by -xcb-xinput. Task-number: QTBUG-39624 Change-Id: I37475b09b2bd7057763345c3f33d8c7751a4e831 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: simplify handling of keymap updatesGatis Paeglis2018-02-251-5/+5
| | | | | | | The old code was somewhat too scattered. Change-Id: Ib0445c66653f757ccac28778f34f4bcb5df49a70 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: cleanup TODOs for KeyboardLayoutChangeGatis Paeglis2018-02-251-0/+1
| | | | | Change-Id: I5d2207fdb21cbabb04460faf73c35275bc76b7b0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* xcb: have a proper detection of key events originating from SendEventGatis Paeglis2018-02-251-4/+3
| | | | | | | | | | | This is a more correct fix for QTBUG-48795. The original fix was unnecessarily using non-XKB code path for updating state for all incoming key events. This would result in losing some valuable bits from xkb state. Task-number: QTBUG-48795 Change-Id: Ic4fb28b2d834272f1db2cbf5888cafb209707847 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* xcb: refactor QXcbKeyboard::keysymToQtKey() and fix bugGatis Paeglis2018-02-241-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now also digits from other alphabets e.g ۲ (arabic two) are mapped to Qt::Key_* digit keys. Re-factored logic: - All known dead keys have direct mappings since 1d86e5f84abac6db0b7b1503a6f52c72b272a897. Don't special treat them in "unicode mapping" code path. - Removed the ISO8859-1 legacy logic, which is leftover from Qt4 where keysym to Qt decoding was done from raw data. In Qt5 we always get a utf8 string from xkb_state_key_get_utf8(). Furthermore, ISO8859-1 and utf8 encode ASCII exactly the same way. - Set Qt::KeypadModifier from key input handler methods. This logic does not belong in keysymToQtKey(). Note: KeyTbl[] and keysymToQtKey() have been duplicated in several places in Qt. That stuff will be cleaned up as part of QTBUG-65503. This change will make those cleanups easier. Task-number: QTBUG-58865 Task-number: QTBUG-65503 Change-Id: Iaf10205a26804f7fc03eb8a16a0879f1bd7bf332 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: re-factor QXcbKeyboard::updateKeymap() to remove various fallbacksGatis Paeglis2018-02-241-9/+12
| | | | | | | | | | | | | | | | | | | | | 3edcd9420e3ad661cad89420e18dbb70e7ad450b added more robust support for keyboard input on XKeyboard-less X servers. The various fallbacks that we had did not work that well in practice. We can remove them now. The xkb_keymap_new_from_names() function relies on reading XKB config files from a file system. Since we don't use this function anymore, we can also simplify xkb context creation (see XKB_CONTEXT_NO_DEFAULT_INCLUDES), as we don't care about DFLT_XKB_CONFIG_ROOT (which we previously set via -xkb-config-root for the bundled libxkbcommon). This patch also changes the code to use smart pointers for managing the global xkb context, keymap and state. [ChangeLog][X11] The -xkb-config-root command line switch has been removed as it it no longer needed when configuring with -qt-xkbcommon-x11. Change-Id: I80eecf83adae90af5cd20df434c1fba0358a12fd Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: remove xlib dependency from core keymap assemblingGatis Paeglis2018-02-241-2/+1
| | | | | | | | | | | | | | | Remove the Xlib dependency by extracting XConvertCase from libxkbcommon sources (xkbcommon/src/keysym.c). libxkbcommon >= 0.8.0 exposes case conversion APIs, but we should prefer using the slightly adjusted version (see the patch for more details). This change also is necessary for follow-up cleanups. Change-Id: Icf1716e0ad26f46a7aefb23722cfc57957754d5e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* xcb: remove fragile and unnecessary missing-latin-keymap workaroundGatis Paeglis2018-02-221-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... which was trying to fix a rarely occurring situation where system settings from a desktop environment does not set any latin keymap on X. This is a DE bug and it has a simple workaround (details in the patch). Ubuntu has fixed this issue sometime between 12.10 -> 14.04. Gnome 3 always appends 'us' layout, even if you have only e.g. 'gr' listed in keyboard layouts (can be checked via setxkbmap -query). In KDE, the global system shorcuts seem to stop working as soon as latin keymap is not the first in the list, which means that KDE users won't be affected as they will likely always have a latin keymap present in the list. This patch removes parts of 2b666d9576210aa98700e219dba6b1bd4f93d793, the parts that in the commit message I was referring to by this quote: "lookupLatinKeysym() also handles the cases that did not work in Qt4 with XLookupString". Since finding a latin key is not working by XLookupString() in this rare case, then it would not work pretty much across the whole desktop. And users would be more interested at finding a solution that works across the desktop. We should not workaround this issue. Desktops that are doing it wrong should learn about this and not repeat the same mistakes on Wayland systems, where XKB keymap is assembled by compositor and passed to clients. Clients should work with the provided keymap as is. The missing-latin-keymap workaround is considered fragile for several reasons - it might not work with legacy or enterprise X server key codes and it relies on global _XKB_RULES_NAMES (there might be several connected keyboards). And theoretical limitation: client might be running in a restricted environment where we don't have access to keymaps on the file system. Change-Id: Ib445b2ea46174248cfa0e5da0eb642cd2a5cf2f6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Support legacy X11 keymapsFrank Richter2018-01-041-0/+4
| | | | | | | | | | | | | | | | | Not all X server vendors support the XKB protocol. Furthermore, while X.org seems to use keycodes that match the usual keyboard scancodes, other vendors may not do so. This means that using an XKB keymap suitable for an X.org server results in garbled input with servers for other vendors. Both of these issues are addressed by using the core keycode information as a fallback. [ChangeLog][X11] Fall back to X11 core keycode information if an XKB keymap could not be determined through the connection. Task-number: QTBUG-44938 Change-Id: I64568aa31113d5a3fd90f70c63320a497db21477 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Refactor QXcbKeyboard::updateModifiers()Frank Richter2017-12-191-0/+2
| | | | | | | | | | | The current implementation is poorly documented and hides the mapping between keysyms and modifier bits. This changeset adds documentation about the inner workings and makes the keysym/modifier bit mapping reusable. (The latter will be needed for xkb keymap synthesis if the XKEYBOARD extension is unavailable.) Change-Id: I70c6d204b2357365db4dafeda680132ab6823ca3 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: use XInput2 for mouse starting from 2.0 not 2.2Gatis Paeglis2017-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 53d289ec4c0f512a3475da4bbf1f940cd6838ac fixed the issue of not getting touch events when grabbing via the plain xcb functions. And due to wanting to support a setup where mouse events are delivered via core events it was chosen to use mouse via XI2 only when really necessary. Thus starting only from 2.2, the version from which the mouse+touch grabbing becomes the issue (XI2 introduced touch support from 2.2). The same patch states that using QT_XCB_NO_XI2_MOUSE restores to the old behavior (grabbing via core) with broken touch grabbing. Broken only with 2.2+, not 2.0 and 2.1 since those versions of protocol do not know about touch. All of this implies the following: 1) The user code that already depends on QT_XCB_NO_XI2_MOUSE, won't see any behavioural difference if we will use XInput starting from 2.0 for mouse. Mouse grabbing will continue to be done via core (xcb_grab_pointer) as mentioned above and thus touch grabbing will continue to be broken with 2.2+. 2) The code that has never cared how we get the native events (core vs xinput2), won't see any behavioural difference. In this case grabbing will always be done via XI2 (XIGrabDevice) grab when XI2.0+ is available. Since there is no difference in the outcome, we migth as well use XI2 for mouse from 2.0, not 2.2. Extension events are always better choice than core. Besides the broken touch grabbing issue with QT_XCB_NO_XI2_MOUSE, there are other issues with that code path, for details see internal documentation of xi2SelectDeviceEventsCompatibility(), where the conclusion is: *** If your code relies on QT_XCB_NO_XI2_MOUSE, then your code needs fixing. *** This patch also cleans up how we select XInput2 events, by separating the QT_XCB_NO_XI2_MOUSE code path. This has two benefits - improved code readability and will make the deprecation of QT_XCB_NO_XI2_MOUSE easier. The patch removes some sparse comments as the behavior is now documented in one place, see xi2SelectDeviceEventsCompatibility(). [ChangeLog][Platform Specific Changes][Linux] The QT_XCB_NO_XI2_MOUSE environment variable is deprecated and will be removed in Qt 6. If your application relies on behavior set by QT_XCB_NO_XI2_MOUSE, it should be updated accordingly. [ChangeLog][Platform Specific Changes][Linux] Pointer event delivery on X11 is now done starting from XInput version 2.0 (when available) instead of 2.2. XInput support can be disabled by setting QT_XCB_NO_XI2=1 environment variable. Note that using QT_XCB_NO_XI2 would also disable tablet and touch support. Change-Id: I661b36d6710b9f6ec71fecc8287ba479432bff4c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* XCB: Use member initializationFriedemann Kleint2017-01-271-7/+7
| | | | | | | Shorten or remove constructors accordingly. Change-Id: I9c8bcf512c922c3c72be8a965d9557589bc9874f Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-09-221-0/+2
|\ | | | | | | | | | | | | Conflicts: src/plugins/platforms/ios/qiosviewcontroller.mm Change-Id: I2dda31867cbc79ea7fe965f52afb518aefa4ad20
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-211-0/+2
| |\ | | | | | | | | | Change-Id: I9cfefaf22b010fca937be77979f5fb50574bb71e
| | * xcb: Use the state of the key event to process itAlbert Astals Cid2016-09-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Rework privateFeatureLars Knoll2016-08-191-3/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | privateFeature would add QT_NO_FEATURE to the DEFINES in the private .pri file, which was somewhat inelegant. Additionally, it would add the feature to the _public_ QT_CONFIG variable, which was plain wrong. Replace the implementation with the one just introduced for publicFeature, with the difference that the features are written to the private files instead. As this entirely disposes of the old system, all usages in the project files need to be replaced atomically as well. Change-Id: I506b5d41054410659ea503bc6901736cd5edec6e Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-111-0/+2
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qfilesystemwatcher_win.cpp src/corelib/plugin/plugin.pri src/plugins/platforms/cocoa/qcocoaaccessibility.mm tests/auto/corelib/tools/qlocale/tst_qlocale.cpp Change-Id: Id6824631252609a75eff8b68792e4d10095c8fc1
| * xcb: XInput2 fixes, enter/leave event fixesBłażej Szczygieł2016-02-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Added enter/leave event handling in XInput2 to avoid problems with those events when the mouse is grabbed. This commit amends: 53d289ec4c0f512a3475da4bbf1f940cd6838ace This commit amends: ed2e15780385f7cf0a0d3aedc9cb2059d470bd58 Task-number: QTBUG-50340 Change-Id: I7a120b46daa4f8fa4c218346273ae90b6abfa156 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@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>
* xcb: Use XIGrabDevice instead of xcb_grab_pointer with XI 2.2Laszlo Agocs2015-06-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch to using the pointer events from XI2 when touch is available (i.e. version is >= 2.2). This allows us to select and grab the button and motion events together with the touch ones. This prevents the issue of not getting touch events when grabbing via the plain xcb functions. To prevent touch sequences from being replayed after ungrabbing (for example after dismissing a popup that caused a grab), we try to accept touches via XIAllowTouchEvents. Unfortunately this leads to a deadlock and therefore we can only do it when we know we have a new enough libXi. This is a configure time check which is not ideal since the system on which apps run can have a newer libXi than the machine that did the Qt build, but seems like the best we can do. The environment variable QT_XCB_NO_XI2_MOUSE can be set to 1 in order to prevent processing mouse events through XInput. This restores the old behavior with broken grabbing. [ChangeLog][QtGui] Pointer event delivery on X11 is now done via XInput 2.2+ when available. Done-with: Michal Klocek <michal.klocek@theqtcompany.com> Done-with: Alexander Volkov <a.volkov@rusbitech.ru> Task-number: QTBUG-43525 Task-number: QTBUG-45054 Task-number: QTBUG-30417 Change-Id: I7cb2002b31bef4cd527aa427549dcf2d5467968e Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.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>
* 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>
* Fix shortcut handling with non-latin layoutsGatis Paeglis2014-10-271-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shortcut handling with non-latin keyboard layouts were broken for checks like: QKeyEvent key = ...; key == QKeySequence::SelectAll In Qt4 this was handled transparently when getting keysym from XLookupString. When ctrl modifier was set, XLookupString performed "keysym transformation" to obtain a latin keysym. Still this did not solve the non-latin shortcut issues for all cases due to some of Xlib assumptions which could not be controled by user. This patch implements XLookupString-like behavior in lookupLatinKeysym(). It is not a 1-to-1 copy of how XLookupString perfoms latin keysym lookup, but it serves our needs just fine. lookupLatinKeysym() also handles the cases that did not work in Qt4 with XLookupString, thanks to libxkbcommon keymap query API. And lookupLatinKeysym() replaces the fragile implementation of "fallback latin key" code path in possibleKeys(). Done-with: Ruslan Nigmatullin Task-number: QTBUG-33182 Task-number: QTBUG-32274 Change-Id: I56a5b624487ca6c2c3768220301a37dac39b439a Reviewed-by: Ruslan Nigmatullin <euroelessar@yandex.ru> Reviewed-by: Shawn Rutledge <shawn.rutledge@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>
* xcb: use keyboard event source window to determine auto-repeat valueDyami Caliri2014-08-201-3/+3
| | | | | | | | | | The xcb auto-repeat checking code checks for queued events on the target (focused) window. This breaks down if you have a native child widget, and QKeyEvent::autoRepeat is never true. Task-number: QTBUG-21500 Change-Id: Ia979edfa8a3afce07a3e1cbaa778541ffb9ce5dc Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
* Consistently hide the parts that require xcb-xkbThiago Macieira2014-04-051-1/+3
| | | | | | | | It was inconsistent. This also solves a warning from Clang 3.4: error: private field 'vmod_masks' is not used [-Werror,-Wunused-private-field] Change-Id: I6be9f7ef56dffe6df2be3beb984c2d82d3808403 Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
* Fix regression in key handling.Gatis Paeglis2014-04-031-1/+1
| | | | | | | | | | | | | | | | | libxkbcommon 0.4.1 added two new functions, xkb_state_key_get_utf{8,32}(). They combine the operations of xkb_state_key_get_syms() and xkb_keysym_to_utf{8,32}(). The xkb_state_key_get_utf{8,32}() functions now apply Control transformation: when the Control modifier is active, the string is converted to an appropriate control character. This matches the behavior of libX11's XLookupString(3), and is required by the XKB specification: http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Interpreting_the_Control_Modifier Task-number: QTBUG-36281 Change-Id: Ib45f45d801291c171640600384107a35d7d56b9b Reviewed-by: Ran Benita <ran234@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update bundled libxkbcommon version to 0.4.1Gatis Paeglis2014-04-031-3/+0
| | | | | | | | | | | | | | This is the latest version, released on Mar 27 2014. It includes: https://bugs.freedesktop.org/show_bug.cgi?id=75798 https://bugs.freedesktop.org/show_bug.cgi?id=75892 Required for fixing input when running Qt application on Mac OS X with XQuartz and for fixing QTBUG-36281. Change-Id: Idc4d3c99a4008a10b91ab51c8910b36909974703 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [xcb] Fix build failureGatis Paeglis2014-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | Build failure was introduced by 9bb634a6176c639bd6b52d58151e9927c30919d0. When linking with systems provided libxkbcommon, then DFLT_XKB_CONFIG_ROOT can't be accessed directly. The reason that this slip through CI is that on CI machines Qt is build with bundled version of libxkbcommon. In addition this patch improves keymap error message, by making it more explicit for users what could be the reasons for "keymap compilation" failures and what should be done to make input work. As it turns out this is a common issue on old systems, servers and some VNC clients. Task-number: QTBUG-37971 Change-Id: I77667a404150ee7ab8465a065e23ca5eea63c33b Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Improve keymap error handlingGatis Paeglis2014-03-271-0/+1
| | | | | | | | | | | - add QT_XKB_CONFIG_ROOT envvar, this can be used to provide an alternative XKB configuration search paths (default XKB configuration root is detected when building Qt library). At runtime these paths might change - when dropping Qt application binary into a system with different setup. Change-Id: Ia21a3e7f0339c95793c1f543d1a95b1591e5d8df Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add better support for keymap update handlingGatis Paeglis2014-03-271-19/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use the new X11 support API xkb_x11_* released in libxkbcommon version 0.4.0. From the commit message where this API was introduced: "These are function to create an xkb_keymap directly from XKB requests to the X server. This opens up the possibility for X clients to use xcb + xcb-xkb + xkbcommon as a proper replacement for Xlib + xkbfile for keyboard support. Why not just use the RMLVO that the server puts in the _XKB_RULES_NAMES property? This does not account for custom keymaps, on-the-fly keymap modifications, remote clients, etc., so is not a proper solution in practice. Also, some servers don't even set it. Now, the client just needs to recreate the keymap in response to a change in the server's keymap (as Xlib clients do with XRefreshKeyboardMapping() and friends)." This patch moves XKEYBOARD presence decision from compile time to runtime for a proper remote X client support. Task-number: QTBUG-31527 Task-number: QTBUG-32760 Change-Id: I4d402668cda2126ef180b27022154f96b1874b1d Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix handling of non-latin1 shortcutsGatis Paeglis2013-07-311-1/+3
| | | | | | | | | This patch enables non-latin1 shortcut handling on Qt5/X11. Task-number: QTBUG-32274 Change-Id: Ia084258b956128ffade8eddfbcb18af334d79a59 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Resolve modifier mask conflicts on X11Gatis Paeglis2013-07-071-0/+3
| | | | | | | | | | | On X11 key codes and modifiers can have many-to-many relationship, i.e. a key can activate several modifiers, and a modifier may be activated by several keys. This patch handles these cases, the logic is borrowed from Qt4. Task-number: QTBUG-31572 Change-Id: Ide4eb890ec723c68afafe0576d8285440a47d7b0 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use X11 core protocol when xkb not availableGatis Paeglis2013-05-071-6/+38
| | | | | | | | | | | | | | | | | | | | To have a properly working key input in the xcb plugin in the case when xcb-xkb library is not available we can update the xkb_state struct with the keyboard state information available in the X11 core events. The current modifier state is reported to clients in a number of core protocol events and can be determined using the QueryPointer request. This is how it is done in Weston, Wayland's reference implementation. Note: In case the X server doesn't have a xkb support on it (which is very unlikely), then xkbcommon will only pick up the user's primary layout. The X server with the xkb support stuffs unused bits (13 and 14) of 'state' in the core events with the effective keyboard group, which we can use to determine layout changes. Change-Id: I9f1ef635109870e7412ef1157ca592f3c8f9271c Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Added possibleKeys(QKeyEvent *) to QXcbIntegrationGatis Paeglis2013-05-071-0/+1
| | | | | | | | | | | | | | This is required for a modifier+key shortcut support. Also fixes old Qt bug when keymap group changes were not handled properly for shortcut functionality. Task-number: QTBUG-26902 Task-number: QTBUG-4845 Change-Id: I04d2c2ad7049df7420999816154605848fa670e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Utilize libxkbcommon API for the keyboard backend on X11Gatis Paeglis2013-05-071-22/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | libxkbcommon is a keymap compiler [1] which utilizes xkb keyboard configuration database [2]. xkbcommon simplifies keyboard state handling by providing xkb_state object which holds the current state of all modifiers, groups, LEDs, etc, relating to the provided keymap. Detecting modifier mapping should become simpler once it gets supported in libxkbcommon. Also with xinput2 we could get rid of the XkbStateNotify events, because xinput2 key press/release already include all the mod/group info. [1] http://xkbcommon.org/ [2] http://www.freedesktop.org/wiki/Software/XKeyboardConfig This patch: - Removes a dependency to -lxcb-keysyms - Removes a dependency to XLib call - XLookupString - Enables required functionality to fix QTBUG-27681 Task-number: QTBUG-27680 Change-Id: I10e10f873821ee02f6df72238e215a541150f38f Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Add QXcbWindowEventListenerJørgen Lind2013-04-261-2/+2
| | | | | | | | This makes it possible to listen for events on xcb_window_t which are not platformwindows inside the xcb plugin Change-Id: Ic9ec17ed757a7f9a5302ef2759c119a72bac573c Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Detect autoreapeat in xcb plugin.Samuel Rødal2012-01-071-0/+1
| | | | | | | Until now QKeyEvent::isAutoRepeat() would always return false. Change-Id: I7771bc7a7ec848ef280f99bada0a26eda188604e Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Make qtbase build with Qt-in-namespace againKent Hansen2011-09-281-0/+4
| | | | | | | Change-Id: I5faa8690a05d6ec352fc69c0b69848539f2ed216 Reviewed-on: http://codereview.qt-project.org/5460 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove leftover xkb member variable in QXcbKeyboard.Laszlo Agocs2011-06-171-3/+0
|
* Use XLookupString for translating key events.Laszlo Agocs2011-06-091-0/+3
| | | | | | | | | There seems to be no easy equivalent in the XCB world and the fallback we currently have is really incomplete. Hence we will call XLookupString with a fake XKeyEvent if XCB_USE_XLIB is enabled. Reviewed-by: Samuel Rødal