maliit / keyboard

Maliit Keyboard, a free software virtual keyboard for Linux
GNU General Public License v3.0
149 stars 35 forks source link

Add a debugging/first-steps guide #35

Open samueldr opened 3 years ago

samueldr commented 3 years ago

(The title is an actionable task, my personal issue is: maliit process runs, but no virtual keyboard is shown and I don't know what I'm doing!)


Hi,

I'm packaging maliit keyboard for NixOS, and am hitting an issue where I don't know how to test whether maliit works or not. I'm assuming it might not and there are packaging issues from the distro still.

Under X11, an awesome session without an actual desktop environment.

Running maliit-keyboard produces logging output, which ends with:

wordengine.cpp plugin "/nix/store/hxi7val5227lyyvigi0qw2i5dhcd70s6-maliit-keyboard-2.0.0/lib/maliit/keyboard2/languages/en/libenplugin.so" loaded
inputmethod_p.h registerActiveLanguage(): activeLanguage is: "en"
in inputMethod.cpp setActiveLanguage() activeLanguage is: "en"
inputMethod::reset()
in clear preedit.. clearing word engine
[...]
[... repeated similar warnings: ...]
file:///nix/store/hxi7val5227lyyvigi0qw2i5dhcd70s6-maliit-keyboard-2.0.0/lib/maliit/keyboard2/qml/[...]: QML Connections: Implicitly defined onFoo pr
operties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
[...]
keyboard is reporting <x y w h>: < 0 -8 0 8 > to the app manager.
keyboard is reporting <x y w h>: < 0 1432 0 8 > to the app manager.
keyboard is reporting <x y w h>: < 0 870 0 570 > to the app manager.
keyboard is reporting <x y w h>: < 0 309 0 1131 > to the app manager.
keyboard is reporting <x y w h>: < 0 871 0 569 > to the app manager.
keyboard is reporting <x y w h>: < 0 871 2560 569 > to the app manager.

I don't believe the program is frozen in a bad way. I think it's waiting for whatever it would be waiting, as running under a wayland plasma mobile session its output is similar, but it seems to be notified when trying to get it shown by touching input fields (when no keyboard is connected on a tablet).

I say it seems to be notified since it reports those:

Apr 03 22:25:30 nixos ..maliit-keyboa[1424]: in clear preedit.. clearing word engine
Apr 03 22:25:30 nixos ..maliit-keyboa[1424]: maliit.connection.wayland: virtual void Maliit::Wayland::InputMethodContext::zwp_input_method_context_v1_commit_state(uint32_t)
Apr 03 22:25:30 nixos ..maliit-keyboa[1424]: maliit.connection.wayland: virtual void Maliit::Wayland::InputMethodContext::zwp_input_method_context_v1_commit_state(uint32_t)
Apr 03 22:25:30 nixos ..maliit-keyboa[1424]: maliit.connection.wayland: virtual void Maliit::Wayland::InputMethodContext::zwp_input_method_context_v1_surrounding_text(const QString&, uint32_t, uint32_t)
Apr 03 22:25:30 nixos ..maliit-keyboa[1424]: maliit.connection.wayland: virtual void Maliit::Wayland::InputMethodContext::zwp_input_method_context_v1_commit_state(uint32_t)
Apr 03 22:25:30 nixos ..maliit-keyboa[1424]: keyboard is reporting <x y w h>: < 0 592 0 8 > to the app manager.
Apr 03 22:25:30 nixos ..maliit-keyboa[1424]: keyboard is reporting <x y w h>: < 0 358 0 242 > to the app manager.

Questions

These should help figuring out whether I'm trying things that shouldn't work at all:

Additionally, what is the development workflow like for a developer that wants to test changes on maliit-keyboard on their computer? (That workflow might help someone who's packaging too.)


Thanks!

jpetersen commented 3 years ago

Is maliit-keyboard expected to be able to work with X11

Yes if the mallit framework was compiled with enable-qt5-inputcontext (which is on by default). There should be a DBus-based maliit input context available.

Setting the environment variable to QT_IM_MODULE=maliit for a client application to test the keyboard should make it pop up as soon as a textfield is activated.

This can also be enabled instead of the wayland protocol version by setting MALIIT_FORCE_DBUS_CONNECTION environment variable when running it under wayland.

Does running the maliit-keyboard binary on a computer with a keyboard attached, and no toolkit involvement expected to show up in any form?

It works for me with hardware keyboard but there is some code (MaliitKeyboardPlugin::supportedStates() in src/plugin/plugin.cpp and in the framework the code in src/mimpluginmanager.cpp updateInputSource() https://github.com/maliit/framework/blob/ee7d872c5b51d4b63002af7f00057c90010d1e53/src/mimpluginmanager.cpp#L1268) which might not make it shown up with a hardware keyboard so I am not sure.

samueldr commented 3 years ago

Thanks!

Though an issue from your post:

Setting the environment variable to QT_IM_MODULE=maliit

Isn't it supposed to be Maliit with a capital M? Or does both work? (To be fair I haven't tested with a lowercase m.)

I want to confirm that when packaged properly, using maliit-exampleapp-plainqt from the framework package should work on X11, assuming the environment is configured properly. E.g. QT_IM_MODULE=qtvirtualkeyboard does not use Maliit, obviously, but is another value to check that QT_IM_MODULE works.

I'll also add that yes, running on X11 makes Maliit show up in dbus, but AFAICT it only announces a socket, which I guess is how you communicate with Maliit when not using Wayland. Not sure what can be done through dbus otherwise.

And I can now confirm that within Plasma Mobile, the virtual keyboard will only show up if there is no physical keyboard present. So with QEMU it is highly likely there is a virtual keyboard attached, and even when packaged properly, it will be hard to confirm whether it works or not. (Though this is not a Maliit issue I guess.)

Probably helping no one really, the problem I was having was with packaging (obviously, as I had assumed). The plugin wasn't being installed to the path for the distro I'm packaging for, no issue with Maliit.

But maybe a clue for other people having packaging issues: the framework package has the Qt plugin for input context. Make sure it'll be found where Qt will look for plugins.