summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandinputcontext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove redundant calls, textInput()Inho Lee2024-02-061-26/+37
| | | | | | | | | It is used repeatedly. Normally it can be optimized by a compiler but it might be helpful to see what it is by the name, inputInterface. Pick-to: 6.7 6.6 6.5 Change-Id: I7f4988674d7249c84b1321e69146dfd92189f142 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Support TextInput V3 over v4-wipDavid Edmundson2023-12-131-5/+1
| | | | | | | | | | | | | | | | | Support for v4-wip was not added into any desktop linux compositors, nor was it ever enabled into the default Qt client builds for clients or compositor. TextInputV3 has become the most widely deployed. Whilst changes are needed, they do not need to be breaking changes. A second iteration of V3 can add the features we need. This is now in motion upstream. For cases where QtWaylandCompositor is used, the custom Qt text input method is preferred to work with the Qt virtual keyboard. Pick-to: 6.7 Change-Id: I01e2686c67846804c0069f1495952b530547f91c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* client: check nullptr before usageLiang Qi2023-06-281-1/+1
| | | | | | | | | in QWaylandInputContext::textInput() and QWaylandInputMethodContext::textInputMethod() Fixes: QTBUG-114671 Pick-to: 6.6 6.5 6.2 Change-Id: I10e55f6f817a4b4d78a0262f87580d2fa2743f7b Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Don't change process locale while initializing QWaylandInputContextIlya Fedin2023-01-261-3/+1
| | | | | | | | | | This was overriding the locale previously set in QCoreApplicationPrivate::initLocale and can switch the process to non-UTF8 codepage Pick-to: 6.5 6.4 6.2 Change-Id: I5cd6664d1a7c315019d6c798b33b9deb33982a59 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port to new Q_UNREACHABLE_RETURN()Marc Mutz2022-10-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator to convert sequences of Q_UNREACHABLE() + return into Q_UNREACHABLE_RETURN(), newly added to qtbase. const std::string unr = "unr", val = "val", ret = "ret"; auto makeUnreachableReturn = cat("Q_UNREACHABLE_RETURN(", ifBound(val, cat(node(val)), cat("")), ")"); auto ignoringSwitchCases = [](auto stmt) { return anyOf(stmt, switchCase(subStmt(stmt))); }; makeRule(stmt(ignoringSwitchCases(stmt(isExpandedFromMacro("Q_UNREACHABLE")).bind(unr)), nextStmt(returnStmt(optionally(hasReturnValue(expr().bind(val)))).bind(ret))), {changeTo(node(unr), cat(makeUnreachableReturn, ";")), // TODO: why is the ; lost w/o this? changeTo(node(ret), cat(""))}, cat("use ", makeUnreachableReturn)); a.k.a qt-use-unreachable-return. subStmt() and nextStmt() are non-standard matchers. Change-Id: I3855b2dc8523db1ea860f72ad9818738162495c6 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@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: includemocsLiang Qi2022-06-011-0/+2
| | | | | | | Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-103295 Change-Id: Ibac5e794c7d7f35d51d8d48110892c33a0b67c7a Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* wayland: do not rely on transitive includesFabian Kosmale2022-03-111-0/+1
| | | | | Change-Id: I149e04d31ef3e897e25a91450427237069af4c34 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Add client support for the text-input-unstable-v1 protocolDominik Holland2022-02-021-2/+2
| | | | | | | | | | | | | | | | This is used by weston for forwarding virtualkeyboard related event from keyboard applications to a Qt client. Right now Qt only supports text-input-unstable-v2, v4 and the special qt-input-method protocol, while weston only supports text-input-unstable-v1. Without this, a virtual-keyboard application can't be used with a Qt client within weston. Change-Id: I9a34a87100854bb0b0f76762ced56419e70c297e Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Support text-input-unstable-v4-wipInho Lee2021-11-191-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This feature can be enabled by -feature-wayland-text-input-v4-wip. It is disabled by default. TextInputManagerV4 is available in a compositor. zwp_text_input_v4 is available for QT_WAYLAND_TEXT_INPUT_PROTOCOL in a client It supports Hangul(Korean) with a qtvirtualkeyboard patchset (refs/changes/02/357902/3) It includes some workarounds for ibus because each ibus module has its own policy for focus-in/focus-out. enter/leave will synchronize with enable/disable and they will happen whenever focus-in/focus-out happen. Cursor/anchor positions are byte offsets. Surrounding text will be trimmed when it is over 4000 byte. For debugging, uses "qt.waylandcompositor.textinput" in a compositor side uses "qt.qpa.wayland.textinput" in a client side Tested on qtvirtualkeyboard and ibus TODO : * QTBUG-97248 - event:preedit_commit_mode is not implemented yet. Current preedit_commit_mode is 'commit'. * request:set_text_change_cause is not implemented. Task-number: QTBUG-94327 Change-Id: I72644893f40f30c4b03cd6a7d05483d12bde1070 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* add abstract class QWaylandTextInputInterface in client sideInho Lee2021-11-081-348/+10
| | | | | | | | | 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>
* Fix the logic for decoding modifiers map in Wayland text input protocolRodney Dawes2021-10-151-2/+4
| | | | | | | | | | | | | Correctly check for the flags in the modifiers map when we get it from the compositor, instead of modifying the map in the for loop conditional. [ChangeLog][QWaylandInputContext] Fix modifiers map decoding logic when receiving the map from the compositor. Fixes: QTBUG-97094 Pick-to: 6.2 5.15 5.12 Change-Id: Idad19f7b1f4560d40abbb5b31032360cfe915261 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Include locale.h for setlocale/LC_CTYPEAlbert Astals Cid2021-05-121-0/+4
| | | | | | Pick-to: 5.15 Change-Id: Iced32a31a63cec71008549c1e0961d59ffc45a37 Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
* Add missing define guardsSamuli Piippo2021-04-221-0/+2
| | | | | | | | | Ammend cca1b94190a094b5d1d7ce492b6533e2d330c5e8 to use m_composeState only if xcbcommon is available. Pick-to: 5.15 Change-Id: I48332b15def3282c5bda3e1c7c393ea7e9849cbe Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
* client: Allow QWaylandInputContext to accept composed key combinationsAleix Pol2021-04-131-1/+94
| | | | | | | | | | | | | | | | | | | | | | At the moment, we are forcing user to choose to either compose or use the text-input channel. This patch brings some of the QComposeInputContext functionality in order to let applications understand dead key combinations like they are supposed to. Having it in QWaylandInputContext rather than in QWaylandInputDevice should solve the problems 3aedd01271dc4f4a13103d632df224971ab2b6df had with 57c4af2b18c0fb1d266b245a107fa6cb876b9d9e, because we are doing it in the input context rather than before. This way, if the user is overriding the input method (e.g. by setting QT_IM_MODULE), all the key strokes will still be properly forwarded to the module to use. This in turn allows us to solve https://bugs.kde.org/show_bug.cgi?id=411729 and https://bugs.kde.org/show_bug.cgi?id=405388 since we don't need to choose anymore between physical and virual keyboards anymore. Pick-to: 5.15 Change-Id: I8601f5d7ae21edf4b3a1191fa75877286e505588 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Fix compilation after removing QEvent copy ctorEskil Abrahamsen Blomfeldt2020-11-191-4/+6
| | | | | | | | | In 19f9b0d5f54379151eb71e98555b203ad6756276 in qtbase, the copy constructors for QEvents were removed, so code using this has to be updated. Change-Id: I5798b240d79f78c47374d60947b1bc66598ff3b5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Johan Klokkhammer Helsing2019-09-161-3/+6
|\ | | | | | | | | | | | | | | | | | | | | | | 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: Adjust for window border when setting text-input cursor rectJohan Klokkhammer Helsing2019-09-031-3/+6
| | | | | | | | | | | | | | | | | | set_cursor_rectangle takes wl_surface coordinates, but we sent window coordinates. Fixes: QTBUG-77987 Change-Id: Ia0bf98f9749723128bec27c3c607d1ccde2d5fd3 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | Eradicate Q_FOREACH loops [1/2]: trivial casesMarc Mutz2019-05-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this patch, we port Q_FOREACH loops to C++11 ranged-for loops. All cases are trivial in the sense that either the argument is already const or is trivially marked as const, either by qAsConst(), or, in the case of rvalues, by storing to a const auto temporary first. In addition, all loop bodies are clear enough to confirm that the container we iterate over is not changed under iteration. This does not exclude cases where a loop is prematurely exited just after calling a modifier on the container, as that is safe, if not especially elegant. Change-Id: I87a63f07797437d421567d60e52305391a3c4f21 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devJohan Klokkhammer Helsing2019-05-071-5/+10
|\| | | | | | | | | | | | | | | Conflicts: src/client/qwaylanddisplay_p.h src/client/qwaylandwindow.cpp Change-Id: I50eb5c83a8b81e4bdb032b68d41f429b17d0a74d
| * drop qwaylandxkb and share the logic with X11Gatis Paeglis2019-04-251-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | QtWayland can benefit from sharing code with X11. This will fix issues that have been reported and fixed on XCB a long time ago. Task-number: QTBUG-65503 Fixes: QTBUG-71301 Fixes: QTBUG-66497 Change-Id: I09cbf8e1c9cf29e8d7f46b97bc2f11d6e91b61a5 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* | Client: Make QWaylandWindow's wl_surface inheritance privateJohan Klokkhammer Helsing2019-03-141-4/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | QWaylandWindow inheriting wl_surface is a leftover from the old days, and today it is sometimes causing great problems. Especially on xdg_shell and other shells where the wl_surface needs to recreated with a different role if the QWindow::type changes. This is currently worked around by calling reset() on the surface, which will destroy the wl_surface, and emit some necessary events and signals. However, much of the rest of the code still assumes that a QWaylandWindow maps directly to a single wl_surface which won't change over the lifetime of the QWaylandWindow. Today, it would make sense to implement this with composition rather than inheritance. This is a major undertaking and so this is the first small step; hide the inheritance in QWaylandWindow's public API. This makes it much more visible when and where the rest of the QPA plugin is using it, so we can eventually move it into its own class later. Task-number: QTBUG-74373 Change-Id: I257729e33c3a5368cef4bb1e16148ba392e65bd2 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Client: Don't assume windows have surfaces in QWaylandInputContext::updateJohan Klokkhammer Helsing2019-01-031-7/+16
| | | | | | Fixes: QTBUG-72751 Change-Id: I6018a34d4a4cfcbdef5d6cd05d2d4ef12846efea Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Init variables where they are declared when possible (clang-tidy)Johan Klokkhammer Helsing2018-02-271-12/+1
| | | | | | | | | | | | | | | | | | | | clang-tidy -p compile_commands.json $file \ -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' \ -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' \ -header-filter='qtwayland' \ -fix Afterwards I ran search and replace on the diff to clean up some whitespace errors: - Replaced '(\n\+[^:\n]*)(:\s+\+\s+)' with '$1: ' - Replaced '(\n\+[^,\n]*)(,\s+\+\s+)' with '$1, ' - Replaced '\n\+\s*\n' with '\n' I also had to do some manual edits, because for some reason, this particular clang-tidy check doesn't trigger for some files. Change-Id: I3b3909bac4bf20108bbe8ad1e01bcc54236dae1b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use nullptr instead of 0 or NULLJohan Klokkhammer Helsing2018-02-201-1/+1
| | | | | | | | Applied automatic fixes using clang-tidy's modernize-use-nullptr, and some manual cleanup to prevent QFlag macros to be affected. Change-Id: I88f94390185bc6e6f23693b68723cd5710815ae6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Check surface exists when setting textinput focusDavid Edmundson2017-08-091-2/+4
| | | | | | | | | | QWaylandWindow resets the surface on various events. Handling focus comes in a posted event, so this can be after we've hidden a window and lost a surface. Task-number: QTBUG-61704 Change-Id: I535ff78c6bc2b86816696a08f8eebc47186d1225 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Add xdg_shell_v6 support for Qt clientsGiulio Camuffo2016-12-021-1/+2
| | | | | | | Task-number: QTBUG-56174 Change-Id: I6610905d0c9f29be29e812bcac193ea2a7e4f107 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Fix the key code of key events when control is pressedGiulio Camuffo2016-07-041-2/+3
| | | | | | Change-Id: I51a57a32d8263e663a48dac15881d685359bc91d Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@hawaiios.org>
* Rename private headers to _p.hPaul Olav Tvete2016-05-191-2/+2
| | | | | | Change-Id: I0f0d1bd8efabc39325eec7dba4166ae0bccbf6ff Reviewed-by: Johan Helsing <johan.helsing@qt.io> Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* Use function to convert indices for text protocolJan Arne Petersen2016-04-191-1/+1
| | | | | | | | | | | | | Use a proper function instead of left/midRef(index).toUtf8().size(). Makes it more clear what is happening and makes it easier when wayland text protocol switches from byte-based to unicode character-based indices. Also rename parameters of existing indexFromWayland() function to be the same as in the new function. Change-Id: Ie90abdcb264b74a024e96e041d5daf651920e9e4 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* Fix clicking on preedit textJan Arne Petersen2016-04-181-0/+14
| | | | | | | | Ignore clicks inside of preedit text for now instead of resulting in an unexpected reset. Change-Id: I9962f3a2a868a9a1afa7b0082fba97ec6cc6c500 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* Fix text-input support for new APIJan Arne Petersen2016-04-181-125/+381
| | | | | | | | | | | | | | | | Update text input support to upstream text-input protocol v2 from wayland-protocols. Remove support for input-method protocol for now. Map text-input protocol on compositor side to the Qt input method API, this allows to use any qt platform input method on compositor side (especially qtvirtualkeyboard). Add support for qtvirtualkeyboard to pure-qml example. Implement all missing functions of the text-input protocol. Change-Id: I597451ff65454a63dff86026b6a8d1ffbe07ce02 Done-with: Zeno Endemann <zeno.endemann@kdab.com> Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* Updated license headersAntti Kokko2016-01-201-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: I76ae5d3e64f096eb3163d6163a38d68c7c1ca756 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge remote-tracking branch 'qt/5.6' into wip-compositor-apiPaul Olav Tvete2015-12-021-0/+1
|\ | | | | | | Change-Id: Ie70fdd03e1259a8cb75bbdbf1324e3e4a2b51807
| * Fix compiler warnings.Friedemann Kleint2015-11-051-0/+1
| | | | | | | | | | | | | | | | qwaylandinputcontext.cpp:57:16: warning: unused parameter 'sym' [-Wunused-parameter] qwaylanddatadevice.cpp:173:135: warning: 'dragData' may be used uninitialized in this function [-Wmaybe-uninitialized] Change-Id: Id654360fd9b7fdb572565ad39b664af3355b5e79 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
* | Fix some wrong licenses in QtWaylandClientJørgen Lind2015-07-241-27/+21
|/ | | | Change-Id: I8d5e88e9b296276c6d9d570b3e5e704f32298d83
* Update copyright headersJani Heikkinen2015-02-171-3/+3
| | | | | | | | | 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. Change-Id: I5a74d32515c3f1fe7aa1916f4241c92832510f8c Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* Namespace the platform pluginsGiulio Camuffo2015-01-291-0/+4
| | | | | | | | | | | | There currently is a QWaylandInputDevice class both in the wayland QPA plugin and in the QtCompositor API. This causes the qwindow-compositor example to crash when running nested in a wayland session due to a mismatch between the two classes. By namespacing all the plugin code we make sure that name clashes will not happen anymore. Change-Id: I17497cff697599200bea68bf01dfde474526390f Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Set the composing string of the wayland input methodGiulio Camuffo2015-01-131-0/+16
| | | | | | Task-number: QTBUG-43346 Change-Id: I9bc6d804ddca59a7a0173b8f0d3ec2f268fe9a59 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Make classes in client privateJorgen Lind2013-12-271-4/+4
| | | | | Change-Id: Ibf400b32f78a6a0fcf0991914d2d9ad684483979 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* Fix compiler warningsJorgen Lind2013-12-271-0/+5
| | | | | Change-Id: I499c50c901bff1c496b05b628f8155376b5af267 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* Move wayland into a client directory not under the plugins src folderJorgen Lind2013-12-271-0/+260
And make wayland common files into a library, exporting all classes. Now there is no need to do bulild hacks to make your own version of the wayland plugin. Change-Id: Ib4872863dfb5ab3f2bc0f4a94ae16fc1e7b63b88 Reviewed-by: Andy Nichols <andy.nichols@digia.com>