summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandinputdevice_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Client: Fix the mouse being stuck in pressed state after ↵Ilya Fedin2024-03-201-0/+1
| | | | | | | | | startSystem{Move,Resize} Fixes: QTBUG-97037 Pick-to: 6.7 Change-Id: I812c25b98909f9ff05ffca122e7201665023172e Reviewed-by: David Edmundson <davidedmundson@kde.org>
* client: use current modifiers in repeat keysLiang Qi2024-03-101-2/+0
| | | | | | | | | This amends 35880c7e1021a379e3cdd4005edd53472b63856c . Fixes: QTBUG-123007 Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I3b4e5d4a8304fd57558eec3897562895c294aadd Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Don't use Qt keywords in headersKai Uwe Broulik2023-12-181-2/+2
| | | | | | | | | | | | | Unfortunately for many Wayland features applications need to access Qt private headers which will fail if the project is built with QT_NO_KEYWORDS. Ideally, the examples and tests were ported, too, and QT_NO_KEYWORDS enabled in .cmakec.conf. Pick-to: 6.7 Change-Id: I9f988d304bcc8dba4dd84761c41ba3da2473515d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* client: Provide seatname for multi-seatLu YaNing2023-10-181-0/+3
| | | | | | | | In a multi-seat configuration the seat name can be used by clients to help identify which physical devices the seat represents. Change-Id: Id704ad289fe861c2170380f1575d298e8db03964 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* client: Implement QWheelEvent::invertedDavid Edmundson2023-09-291-1/+6
| | | | | | | | | | | | | | | "Natural scrolling" is a setting that makes trackpads act in the inverse; moving up moves content down to mimic behavior of touchscreens. However not all scroll events are used for scrolling, so it can be useful to know the real direction. This was exposed in QWheelEvent it just needs plumbing. Change-Id: I050b8b3e55796beff33badb7c073c0b93589294e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
* Revert "Client: Send release button event on pointer leave"Liang Qi2023-09-061-1/+0
| | | | | | | | | | | | | This reverts commit 8235fa65fe033a94e7a44322d3502f25940092ec. It makes tests/manual/examples/widgets/draganddrop/puzzle not work, which does drag and drop in same app. Pick-to: 6.6 6.5 6.2 5.15 Fixes: QTBUG-115757 Task-number: QTBUG-97037 Change-Id: I738769fde96f7da91f5bc4dc7a70ed49596dcd61 Reviewed-by: Liang Qi <liang.qi@qt.io>
* client: Drop unused member variablesDavid Edmundson2023-08-311-4/+0
| | | | | | Change-Id: Id7cca9d5cb620dadb356e9cfcc68ca1203a0db98 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: David Redondo <qt@david-redondo.de>
* Client: Fix keyboard focus when closing a popupVlad Zahorodnii2023-08-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 325a2338976c3cca6278436af03e7bd4e4378d7c changed the order in which the shell surface and the QWaylandWindow::wlSurfaceDestroyed signal are ordered. Unfortunately, it broke popups with some compositors. When the wlSurfaceDestroyed signal is emitted, QWaylandInputDevice::Keyboard is going to reset its focused surface and call QWaylandDisplay::handleKeyboardFocusChanged(). QWaylandDisplay::handleKeyboardFocusChanged() is going to call QWaylandDisplay::handleWindowDeactivated(), it will make an async roundtrip to determine the current focused window. This is to batch leave and enter events. Since the wlSurfaceDestroyed signal is emitted before destroying the shell surface and the wl_surface, the compositor has no reason to change keyboard focus, so qtwayland will think that the app lost focus for good and close all popups. This change restores the old behavior by making QWaylandInputDevice::Keyboard connect to QWaylandSurface::destroyed signal, which is emitted after the window's wl_surface is gone. It also makes QWaylandInputDevice::Keyboard consistent with QWaylandInputDevice::Pointer. Pick-to: 6.5 6.6 Fixes: QTBUG-116051 Change-Id: If866f94a0cec1659c27ffeb2d263a2480ca8fdf1 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* client: initialize key repeat informationDavid Edmundson2023-06-081-5/+5
| | | | | | | | | | | | | | We can end up checking mRepeatKey.code before getting a key press is recorded when the values are uninitialized. This can happen if we get a key up for a previously held key or if key repeats are disabled. It's relatively harmless as it just stops a timer, but it can show up in valgrind logs. Change-Id: Ib7fe58b1976e9c89550c5a6252a34d66f83e2481 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Client: Send release button event on pointer leaveIlya Fedin2023-06-051-0/+1
| | | | | | | Fixes: QTBUG-97037 Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I151239b276ab5aefe166f5615baf43dab428ce0c Reviewed-by: David Edmundson <davidedmundson@kde.org>
* client: Implement cursor_shape_v1David Edmundson2023-06-011-0/+2
| | | | | | | | | | | | | | A new wayland protocol allows clients to specify the cursor being used rather than load themes and attach buffers. Short term this has better behavior for scaling. Long term when this has universal compositor support we can drop the theme loading code. Change-Id: I119e1ca44d351e7b13b8ec56f2218d94b7da0705 Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Client: Update last input device on tablet tool tapVlad Zahorodnii2023-02-281-0/+1
| | | | | | | | | | | | When user uses tablet exclusively to navigate in an app, the last tracked input device will be null. As the result, any popup that requires a popup grab will be backed by an xdg-toplevel rather than an xdg-popup. Fixes: QTBUG-111130 Change-Id: Ib87e732603bbe111c584361357727171825f8c68 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Client: Port to QPlatformTheme::{MouseCursorTheme,MouseCursorSize}Vlad Zahorodnii2023-01-031-2/+0
| | | | | | | | | | It allows the platform theme to specify the preferred cursor theme and cursor size without resorting to hacks such as setting XCURSOR_THEME and XCURSOR_SIZE environment variables. Pick-to: 6.5 Change-Id: I9e44f9c6dddbb5d730f8ac092f2c11fdbccf8d27 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Client: Add support for high-resolution scrollingVlad Zahorodnii2022-10-261-1/+2
| | | | | | | | | | | | | | | With wl_pointer version 8, the axis_discrete event is replaced with the axis_value120 event. The main difference between axis_discrete and axis_value120 is that the latter carries scroll deltas that can be fractions of 120, e.g. 30, etc. See also https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/72 Change-Id: I4f724ead7ba146dde6d8975fa4edfcfca761769d Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-101-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I106d3a5d1a7b96250380b6f51a48f3b19d10e4d9 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtWaylandClient: use the CMake exports.h supportThiago Macieira2022-04-281-4/+4
| | | | | | | | | | | | The one in qtwaylandglobal.h was wrong. It just happened to work on Linux because the lack of import wasn't an error... until GCC 12 with -mno-direct-extern-access. Pick-to: 6.3 Change-Id: If05aeeb7176e4f13af9afffd16e8535b469f9158 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Fix build with -no-feature-tableteventLiang Qi2022-01-251-0/+6
| | | | | | | | Pick-to: 6.2 6.3 5.15 Fixes: QTBUG-99965 Change-Id: Ib7fcf92973b4e559713ae27ad0c7f843f9122daf Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* add abstract class QWaylandTextInputInterface in client sideInho Lee2021-11-081-4/+4
| | | | | | | | | There are several protocols for text-input and it will be an abstract class for them. It is not related with qt_text_input_method_v1. It will help to implement zwp_text_input_* protocols. Change-Id: I2207887d84d416469217cff7d011648402a53664 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Avoid memory leaks in QWaylandInputDeviceUlf Hermann2021-08-181-5/+5
| | | | | | | | | | Use QScopedPointer and QObject-parenting to get rid of the allocated objects. Change-Id: I8a0ce2d1bae6a69b458a01731489813ef2aa8044 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Use QEventPoint::State instead of Qt::TouchPointStateJiDe Zhang2021-06-251-1/+1
| | | | | | | | | Also fix compile warnings about -Wenum-compare. Pick-to: 6.2 6.1 6.0 5.15 Change-Id: I5e94fc028c727b155d5db4c7def35d518c497c5c Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Implement support for pointer gestures v1Povilas Kanapickas2021-05-281-0/+71
| | | | | Change-Id: Ie9ee615de123e6deab5b7a5081ca9bcf53399df7 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Client: Allow inheritance of key translationJaeyoon Jung2021-04-131-0/+6
| | | | | | | | Use a virtual method keysymToQtKey for Qt key code translation, so that it can be customized by a descendant class if needed. Change-Id: I3b48346a63e2c6f134230fe15279faa95abe11a0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Client: Generate method to expose used version of a given proxyDavid Edmundson2021-02-241-1/+0
| | | | | | | | | | Relying on the compositor version only works for the core protocols. Using the version of our relevant object is more extensible and relies on less caching. Pick-to: 6.1 Change-Id: I1044e43a1e24a25359db95988c9956f4f1b5d35f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Support platform specific implementationElvis Lee2021-02-171-1/+1
| | | | | | | | | QtWaylandClient can be inherited to support platform specific implementaton. Change-Id: Ie0f4aa28dbb2dcd6b1245cb14e23f3b45e687400 Reviewed-by: Elvis Lee <kwangwoong.lee@lge.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* New input method protocol for use with Qt clientsEskil Abrahamsen Blomfeldt2020-08-261-0/+5
| | | | | | | | | | | | | | | | | We introduce an alternative input-method protocol, which is a one-to-one mapping to Qt's input method API. Input methods such as the virtual keyboard's hunspell integration is quite sensitive to the inner workings of the input method handling, both in terms of when state is updated and which updates are delivered when. With a one-to-one mapping we are able to match these expectations and keep a well-synchronized state. Task-number: QTBUG-85135 Task-number: QTBUG-85134 Change-Id: Id69c22a7b0885ea59f39fdcc8d663749af56c7ce Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Adapt to recent qtbase changes and update dependenciesFriedemann Kleint2020-07-291-1/+1
| | | | | | | | | - moving linuxaccessibility/xkbcommon/eglsupport/glxsupport to QtGui - event refactoring Task-number: QTBUG-83255 Change-Id: Ic82ee6ef5652413781468edb58c601ee7dce2e3b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Adapt to new QPointingDevice APIShawn Rutledge2020-06-261-1/+1
| | | | | | | | | | | | | | QTouchDevice has been replaced with a more general QPointingDevice. All input devices need detailed information and need to be registered via QWindowSystemInterface::registerInputDevice(). This patch is not doing that yet; it's just enough to get qtwayland to compile again. Done-With: Liang Qi <liang.qi@qt.io> Change-Id: Id3a2e475ed07294a1977004fc72b11e466acc216 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Client: Add basic support for tablet-unstable-v2Johan Klokkhammer Helsing2020-01-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QPA plugin] Added support for drawing tablets through the tablet-unstable-v2 protocol. Adds support for the basic one tablet, one tool, no pads scenario. Besides the auto tests, I tested with a Huion Kamvas Pro 16 with a simple pressure sensitive pen with two buttons. As far as I can tell, it works the same way as on xcb on Sway and Gnome Shell. Also tested on a Wacom PTZ-630 with a mouse, art pen, airbrush and a stylus. Mapped the distance event to QTabletEvent::Z and slider to QTabletEvent::tangentialPressure. For now we send QTabletEvents even when there's a mouse or finger on the tablet. Those should ideally be sent as QMouseEvents/QTouchEvents, but that's out of scope for this patch, but at least we will send synthesized mouse events if the tablet events are not accepted. Change-Id: I93291ffa5f00fa2bb8533eddd8d873b84a3386b8 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Client: Don't use deprecated handleMouseEvent versionJohan Klokkhammer Helsing2020-01-031-14/+7
| | | | | | | | | | | | The new version requires the button that caused the event, as well as the event type. Instead of adding a conversion functions to and from QWaylandInputDevice::Type to QEvent::Type, just use QEvent::Type directly, as there is one-to-one mappings for all the event types we need. Fixes: QTBUG-80044 Change-Id: I0f6e0e8e7f2e026a1d601f86e819affe0570a1b2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Drive cursor animation with a timerJan Alexander Steffens (heftig)2019-12-171-0/+5
| | | | | | | | | | | | | | | | | | | Using only wl_surface_frame callbacks to update the cursor does so much more often than needed. In addition, at least GNOME and Weston fire the callback for the cursor surface immediately, which ends up updating the cursor at over 3000 Hz here. Use wl_cursor_frame_and_duration to drive a single shot timer. This function is also guaranteed to return 0 for single frame cursors, so we can avoid starting the timer at all. We wait for both the surface frame callback and the timer to fire before updating the cursor for the next frame of animation. This reduces our update rate to the frame rate of the cursor or the rate requested by the compositor, whichever is lower. Change-Id: I10277460ebe9b547ebaf7f73424b9ef17614107f Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Johan Klokkhammer Helsing2019-09-161-3/+2
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/client/qwaylanddatadevice.cpp src/client/qwaylandinputcontext.cpp src/client/qwaylandinputdevice.cpp src/client/qwaylandwindow.cpp src/compositor/compositor_api/compositor_api.pri src/compositor/compositor_api/qwaylandquickitem.cpp Change-Id: Ice0d8c7d869c9c46113d6ee6ba3adf895a71d58f
| * Client: Fix touch rounding errorsJohan Klokkhammer Helsing2019-09-091-1/+1
| | | | | | | | | | | | | | | | | | Touch now accounts for fractional input in the same way as for pointer input. Task-number: QTBUG-77457 Change-Id: I18e633bf7c7033187a641f757b8b24f52479971a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-09-081-2/+1
| |\ | | | | | | | | | Change-Id: I5d587b79b96d2b44f1975419a658c259c63fa30d
| | * Client: Refactor touch handling and fix various bugsJohan Klokkhammer Helsing2019-08-291-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename mTouchPoints to mPendingTouchPoints, to clarify that they're the accumulated state so far, which will be applied with the wl_touch.frame event. QWaylandInputDevice::Touch::mPrevTouchPoints is no longer needed and has been removed. Fixes the following issues with the old approach: - touchPointsReleased() only checked mTouchPoints, which was cleared on touch_frame and populated again on touch_motion and touch_down, which meant that it could return true even though there were still touch points left. Leading to the workaround for missing wl_touch.frame events on Weston being triggered to often. - Touch focus was cleared on any wl_touch.up event, not just the last one. - The order of the touch events was not stable and relied on the order of the events (QTBUG-77014). Fixes: QTBUG-77014 Change-Id: Ic3ecdc87e77b0e0276afefd127ad2b965142cbd4 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Client: Fix crash on wl_pointer.up after destroying a windowJohan Klokkhammer Helsing2019-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When wl_pointer version 5 was implemented, we added a raw QWaylandWindow pointer in QWaylandPointerEvent. This is a problem, because the events are stored, and the window may be deleted in the meantime. This manifested itself as flakiness in tst_xdgshell::popup() which is now fixed. Fixes: QTBUG-77976 Change-Id: If34eee0286d5a63734535d67503378516d5768c3 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | Client: Expose default input device through integrationPier Luigi Fiorini2019-08-231-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expose the whole default input device to clients. [ChangeLog][QPA plugin] Expose default input device to clients through the QPA API. Change-Id: I2608178f8b0ac09f766434588a280bcc2b30627d Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* | | Client: Implement primary-selection-unstable-v1Johan Klokkhammer Helsing2019-05-101-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QPA plugin] Added support for middle mouse pasting through the primary-selection-unstable-v1 protocol. Fixes: QTBUG-66008 Change-Id: I7c8fb9aa2c856f5b6794aeab1ee75d80cad05dcd Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devJohan Klokkhammer Helsing2019-05-071-28/+28
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/client/qwaylanddisplay_p.h src/client/qwaylandwindow.cpp Change-Id: I50eb5c83a8b81e4bdb032b68d41f429b17d0a74d
| * | client: reimplement QPlatformIntegration::possibleKeys()Gatis Paeglis2019-05-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is required to trigger more complex shortcut sequences. For example, with 'us' keyboard layout to enter '%' or '+' you have to press 'Shift' button. Previosly the following shortcuts could not be triggered: 'Shift' + '5' '%' 'Ctrl' + '+' 'Ctrl' + 'Shift' + '=' The same function also ensures that these shortcuts work with non-latin keyboard layouts. Change-Id: Id50c7bb28cf76b9f7a861ced7894b2cacae6ed65 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
| * | rework key handlingGatis Paeglis2019-04-171-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Document the magical 8 keycode offset in QKeyEvent::nativeScanCode() - Check if we are working with the expected keymap format. - Rename sendKey() to handleKey() as that is typical naming convention for events that are passed to QWindowSystemInterface. - WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP is in the bundled xml so use it in send_keymap() - Rename toWaylandXkbV1Key() to toWaylandKey() as previous name was incorrect. - Remove "Generic fallback" in keyboard_key() as it was non-functional, you can't expect any useful output when mapping scan code directly to Qt::Key. It was not working in 5.9 (did not check beyond that) and no one has complained. It is safe to assume that the fallback code path is dead and can be dropped. To use HW keyboard with wayland, you need to build with libxkbcommon. We require this on XCB since Qt 5.1.0, so it is not an unreasonable requirement for Wayland. - Cleanup auto-repeat key handling. - Cleanup "#if QT_CONFIG(xkbcommon)" checks. Change-Id: Ie9fcc628621487fb58bc55dd595bf0d51eedfc92 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
| * | client: rework xkb context/keymap/state handlingGatis Paeglis2019-04-151-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Use smart pointers from xkbcommon_support-private. - Remove needless strdup() calls. - Don't recreate context. And move it into qwaylanddisplay so it can be shared in future between several keyboards. It contains things like a logging level and include paths. Change-Id: I5d1f667e710046e6b62aa2caf82fdb2decc24520 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
| * | client: rework input method handlingGatis Paeglis2019-04-151-11/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing solution was parsing compose tables on startup, it is better to lazy initialize the compose table/state on a first key press, instead of doing it on an application startup. This logic is inside of the compose input plugin. The existing code did not utilize correctly how Qt handles complex text input. It used libxkbcommon-compose APIs to compose user input and then passed the same input again to QPlatformInputContext (from QWaylandInputDevice::Keyboard::sendKey), which was erroneous. This also means that code was forcing "xkb compose", and did not respect QT_IM_MODULE at client-side. From commit that added compose key handling (57c4af2b18c0fb1d266b245a107fa6cb876b9d9e): "We should expand on it in the future to handle things like resetting the compose state on text field switching". This is now handled by properly utilizing Qt IM framework. Converted QWaylandInputDevice::Keyboard::sendKey into a class member function to avoid adding one more arg (mXkbContext) to the already long argument list. That whole function should be simplified, but that is out-of-scope for this patch. The reworked code uses qxkbcommon support library to reduce code duplication between platforms and to unify behavior. Some users might mistakenly think that this patch introduces a regression with Qt on KDE, but it is actually a KWin/Wayland compositor bug: https://bugs.kde.org/show_bug.cgi?id=405388 The work around on KDE is to use QT_IM_MODULE at client-side to select input method, as KWin compositor over the wire supports only the qtvirtualkeyboard module. Setting this envvar is not someting out of the ordinary for users on Linux. Input method handling at compositor-side is new feature and clearly not very well supported yet. Task-number: QTBUG-65503 Change-Id: Ie511d950396fa2fb6cbe6672996cee9791f3ab11 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* | | Client: Use a QWaylandSurface for pointer focusJohan Klokkhammer Helsing2019-05-021-1/+2
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-74373 Change-Id: Idfd94442ff542b81956d4852e07eb3b5dff80712 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | Client: Add support for animated cursorsJohan Klokkhammer Helsing2019-05-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QPA plugin] Added support for animated cursors. Previously we would just show the first frame of the animation. Fixes: QTBUG-48181 Change-Id: Ie06bff8950678b5ff7b7e2e50915c85905a1200b Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | Merge remote-tracking branch 'qt/5.13' into devPaul Olav Tvete2019-03-211-17/+43
|\| | | | | | | | | | | Change-Id: I3dc204fcaa71c01a80b0c622443012eb07964431
| * | Client: Don't send illegal wl_pointer.set_cursor requestsJohan Klokkhammer Helsing2019-02-271-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | When the cursor focus' wl_surface is destroyed, or the pointer leaves a surface, we have to reset the enter serial to avoid sending illegal set_cursor requests. Change-Id: I0c886e4123acb4aebd325b07bf15b9d3fa8589da Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
| * | Client: Don't leak wl_data_offersJohan Klokkhammer Helsing2019-02-201-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QPA plugin] Fixed a leak of wl_data_offers. Data offers would previously leak when a surface with keyboard focus was destroyed... or if it was hidden... or if it changed type, and so on. Make keyboard focus follow a wl_surface instead of a QWaylandWindow. This also fixes a couple of other minor issues, such as the mRepeatTimer not stopping when a wl_surface was destroyed. Ideally, we would have a QWaylandSurface class separate from the QWaylandWindow, but that's out of scope for this fix. Fixes: QTBUG-73825 Change-Id: I56e502512c3959e3fcdb63744adc4a7698e3d53d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
| * | Client: Refactor cursors and fix various bugsJohan Klokkhammer Helsing2019-02-151-13/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is mostly a cleanup to prepare for implementations of xcursor-configuration, but also fixes a couple of issues. Most of the logic has now been moved out of QWaylandDisplay and QWaylandCursor and into QWaylandInputDevice and QWaylandInputDevice::Pointer. QWaylandDisplay now only contains mechanisms for avoiding loading the same theme multiple times. There is now only one setCursor method on QWaylandInputDevice, accepting a QCursor and storing its values so changing scale factor doesn't require calling setCursor again. QWaylandInputDevice::Pointer::updateCursor() is called instead. Cursor buffer scale is now set according to enter/leave events of the cursor surface itself instead of the current window, this fixes incorrect buffer scales for cursors on windows that span multiple outputs. The window buffer scale can still be passed into the seat as a fallback until the first enter event is received. This also fixes a bug where the QWaylandBuffer of a bitmap cursor could be deleted while it was being used as a cursor. [ChangeLog][QPA plugin] Fixed a bug where the DPI of bitmap cursors were not sent to the compositor, leading to the compositor incorrectly scaling the cursor up or down. [ChangeLog][QPA plugin] Fixed a bug where bitmap cursor hotspots were off when the screen scale factor was different from the bitmap cursor device pixel ratio. Task-number: QTBUG-68571 Change-Id: I747a47ffff01b7b5f6a0ede3552ab37884c4fa60 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | Client: Implement wl_pointer version 5Robin Burchell2019-03-141-16/+64
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Version 5 adds frame events, which groups multiple pointer events together, enabling diagonal scrolling, leave and enter without an intermediate state, and together with the new axis_source, axis_discrete and axis_stop also adds what needed to differentiate between wheel events and touchpad scrolling. This patch adds scroll phases and pixel deltas to QWaylandInputDevice, and makes sure handleWheelEvent is called accordingly. [ChangeLog][QPA plugin] Pixel delta is now set for mouse scrolling events if originating from an appropriate device such as a touch pad (requires compositor support for wl_seat version 5 or later). Fixes: QTBUG-69876 Fixes: QTBUG-63720 Change-Id: I094a1ef0365893bee135cae7e6df89fafdafa2f2 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* | Client decorations: Show menu on right clickJohan Klokkhammer Helsing2019-01-141-0/+2
| | | | | | | | | | | | | | | | | | [ChangeLog][QPA plugin] A window menu is now shown when the window decorations are right-clicked (if supported by the compositor). Change-Id: I13bf0c8cd91a6e5a3b44e47114dfdc2ff0e97f3a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>