From 3aedd01271dc4f4a13103d632df224971ab2b6df Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 13 Dec 2018 12:14:59 +0100 Subject: client: rework input method handling 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 --- examples/wayland/pure-qml/qml/main.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml index 69be7cf10..483de7514 100644 --- a/examples/wayland/pure-qml/qml/main.qml +++ b/examples/wayland/pure-qml/qml/main.qml @@ -72,6 +72,6 @@ WaylandCompositor { onWlShellSurfaceCreated: screen.handleShellSurface(shellSurface) } - // Extension for Virtual keyboard support + // Extension for Input Method (QT_IM_MODULE) support at compositor-side TextInputManager {} } -- cgit v1.2.3