-
Notifications
You must be signed in to change notification settings - Fork 197
Start input-method v2 implementation (WIP) #2256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
My understand is your patch still does not work. |
|
Takao Fujiwara <notifications@github.com> wrote:
> the input-method and the text-input protocols we end up with an
> endless loop when I run the text-input example from wlroots.
My understand is your patch still does not work.
Yes, this is correct. And I have not yet figured out why that is.
The issue is also that there is no useful test client that implements
the Wayland text-input protocol so I could test this implementation
more easily. The text-input example present in `wlroots` seems to just go
through a few test states and then stops doing anything (this currently
doesn't work properly either with this input-method implementation. Using
this implementation we end up with an endless loop which is probably
due to me implementing the protocol the wrong way).
Unfortunately Fedora does not provide v2 and I don't evaluate it yet.
It would probably be best to find a client that implements the Wayland
text-input (v3) protocol properly (like a text editor perhaps?). Then
we could use the sway windows manager (which implements support for both
input-method v2 and text-input v3) to start debugging this implementation
that way.
|
|
I think weston-editor can be a test application of Wayland protocol but not sure if text-input v3 can be used. |
|
Takao Fujiwara <notifications@github.com> wrote:
I think weston-editor can be a test application of Wayland protocol
but not sure if text-input v3 can be used.
Unfortunately the weston-editor example client only supports v1:
https://cgit.freedesktop.org/wayland/weston/tree/clients/editor.c#n45
You may be better to find applications in Sway desktop which desktop
may support it?
Sway is more of a Window manager than a desktop environment and doesn't
contain any applications itself. There is a suite of programs that
are being used more often with it but I am not sure there is one that
supports text-input v3. I will have to check.
Another potential place to check for a suitable testing application is
the purism phone ecosystem:
https://source.puri.sm/Librem5
A quick look didn't turn up any good candidates though...
|
|
Not sure if that could help, but there's a small example of input-method-v2 impl https://github.com/emersion/wlhangul. |
|
v3 is old enough.... Check https://github.com/swaywm/wlroots/blob/master/include/wlr/types/wlr_text_input_v3.h |
|
Kirill Chibisov <notifications@github.com> wrote:
Not sure if that could help, but there's a small example of
input-method-v2 impl https://github.com/emersion/wlhangul.
That is a good suggestion, thanks! I will take a mental note to take a
closer look at that code
As for text-input-v3 `gedit` handles it quite fine, at least it sets
surrounding text, ime window position, etc.
I thought GTK used their own dbus protocol and not the Wayland one. I
could very well be wrong about this though.
Thanks for the input!
|
You can clearly see that in |
This fixes some compilation issues.
Currently the activation-deactivation doesn't work properly for some reason.
This seems to get things responsive again at least.
This seems to fix the surrounding text not being sent after each key press!
|
I have adjusted the approach closer to how wlhangul is implementing these protocols. To do that I also had to implement handling of the The current state is that regular keyboard input is just being passed unchanged through the ibus-wayland client and the protocol seems to be implemented the correct way (meaning I at least don't get any endless loop that continually increases the serial anymore). The two remaining major issues are:
Any info on how I can get ibus to handle the key presses that I send to it (see the |
|
Hello @Shugyousha, I've also encountered this shortcoming of ibus and would like to contribute to a solution. I tried applying this pull request as a patch to the current master branch, but it seems like the files
are missing. I take it they are automatically generated from the XML-based protocol definitions. Shouldn't they, like the other code, also be included in the pull request? Regards |
|
Hi!
nilekurt ***@***.***> wrote:
I've also encountered this shortcoming of ibus and would like to
contribute to a solution. I tried applying this pull request as a
patch to the current master branch, but it seems like the files
- virtual-keyboard-unstable-v1-protocol.h
- virtual-keyboard-unstable-v1-protocol.c
are missing. I take it they are automatically generated from the
XML-based protocol definitions. Shouldn't they, like the other code,
also be included in the pull request?
Yes, I seem to haven't checked-in those protocol files. I will have to
have another look (probably this coming weekend) at how this works and
then try to include the right files ...
Thanks for checking out this PR!
|
|
I think I have now included all the files needed to build this. Let me know if you run into any other issues! |
|
Is there something that continues to hold this into draft status? Also, this should be rebased so it switches from Travis CI to GitHub Actions. |
|
Hi Neal
Neal Gompa (ニール・ゴンパ) ***@***.***> wrote:
Is there something that continues to hold this into draft status? Also,
this should be rebased so it switches from Travis CI to GitHub Actions.
Yeah, unfortunately I didn't manage to make any more progress and stuff
is still not working. See my comment below.
#2256 (comment)
Help with figuring this out is very welcome of course!
|
|
I appreciate any contributors to work and test on the patches in the actual desktop likes wlroot desktop. |
|
Working on #2695 and closing this issue. Do you know how to make a panel applet for IBus in the Sway session? |
|
It would be nice if the GTK one could be ported to use StatusNotifier (for the panel applet) and layer shell for the candidate choices overlay but I don't know how feasible that is: I currently use ibus in KDE Plasma which works remarkably well but the GTK applet and candidate choices overlay is all going over XWayland still. I really like ibus over fcitx but its Wayland support is definitely in need of some polish. |
|
input-method-v2 doesn't use layer-shell, it has its own popup surfaces |
Many thanks for your work on this!
According to https://man.archlinux.org/man/swaybar-protocol.7, swaybar doesn't support images (or interaction?). It would be possible to show the current state of ibus in text form though, I assume. An alternative would be Waybar that also allows for images to be shown. Not sure an applet is desirable for a tiling WM like Sway. If there is demand for it, I would assume that somebody will come up with a Waybar module or something else for ibus :P |
SNI tray icon is not acceptable for some reason? |
|
Thank you for the comments. V1 works with I guess Sway does not work with the embedded GTK tray icon yet. I'm evaluating swaybar, waybar, nwg-panel, wlclock and gtk4-layer-shell.
@aidanharris Thank you. Maybe using gtk4-layer-shell is a good option, which is packaged in Fedora.
@eternal-sorrow Thank you. I see sni-qt is packaged in Fedora. |
The existing appindicator tray icon code works pretty well with Waybar. Just needed to convince the UI that it's running under KDE:
|
|
The existing indicator uses Xembed, it's not the best but it does still work. If there's any chance at all that it could be ported to StatusNotifier that would be great but I'm not the one doing the work. Swaybar should support StatusNotifier too as far as I know and it's pretty common for most desktops that use a tray to support this too. |
@alebastr Thank you very much. I understand ibus-wayland calls wl_surface_destroy() and fix the issue.
Thank you. I missed the detection and I fixed it for sway at the moment. |
|
I confirmed swaybar can show the IBus panel icon but swaybar does not show the panel menu, waybar can show the panel menu. @aidanharris I understand you mean swaybar does not support the StatusNotifier yet. Seems the task area is blue in waybar by default and I'd like to customize the color since IBus panel strings are also blue. |
…yland - Share codes between the Wayland input-method protocol version 1 and 2 as much as possible. - zwp_input_method_v2.commit() needs to be called when a string is committed or a preedit and surrounding text is updated [1]. - zwp_input_popup_surface_v2 should be destroyed and cleared the pointer before wl_surface.destroy() is called due to `WAYLAND_DEBUG=1`. - zwp_input_method_keyboard_grab_v2_listener.key() can be called even if zwp_input_method_v2 is not activated and zwp_input_method_v2.commit_string() should not be used in such cases likes when non-supported applications(xterm, cosmic-term) are activated but zwp_virtual_keyboard_v1.key() just can be used instead. [1] https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/protocol/input-method-unstable-v2.xml?ref_type=heads#L283 BUG=ibus#2182 BUG=ibus#2256
- Call 'realize-surface' signal with null before CandidatePanel and Switcher are hidden to destroy input_popup_surface in Wayland input-method V2. - Indicator.service_get_property() returns Error if IconPixmap is null. - Replace is_kde() with is_indicator() to support the general Wayland input-method version 2 desktop environments. The order of init_settings(), set_version(), check_wayland() and is_indicator() is important to set m_settings_general, inited_engines_order, m_is_indicator, init_indicator(). BUG=ibus#2182 BUG=ibus#2256
|
I added some patches in https://github.com/fujiwarat/ibus/commits/wayland-v2 to work with XIM and GTK2 applications in Wayland. Since implementing wl_surface is complicated for me, I use the raw GTK popup window without the GDK custom surface. Now IBus panel manages two popup dialogs for the lookup window, one is implements the Wayland panel protocol and another is a raw popup and I confirmed the memory usage is not changed. |
|
I cannot find /usr/share/vala-0.56/vapi/wayland-client.vapi in valac-0.56-vapi package in Ubuntu Jammy. Do you have any ideas? |
…yland - Share codes between the Wayland input-method protocol version 1 and 2 as much as possible. - zwp_input_method_v2.commit() needs to be called when a string is committed or a preedit and surrounding text is updated [1]. - zwp_input_popup_surface_v2 should be destroyed and cleared the pointer before wl_surface.destroy() is called due to `WAYLAND_DEBUG=1`. - zwp_input_method_keyboard_grab_v2_listener.key() can be called even if zwp_input_method_v2 is not activated and zwp_input_method_v2.commit_string() should not be used in such cases likes when non-supported applications(xterm, cosmic-term) are activated but zwp_virtual_keyboard_v1.key() just can be used instead. [1] https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/protocol/input-method-unstable-v2.xml?ref_type=heads#L283 BUG=#2182 BUG=#2256
- Call 'realize-surface' signal with null before CandidatePanel and Switcher are hidden to destroy input_popup_surface in Wayland input-method V2. - Indicator.service_get_property() returns Error if IconPixmap is null. - Replace is_kde() with is_indicator() to support the general Wayland input-method version 2 desktop environments. The order of init_settings(), set_version(), check_wayland() and is_indicator() is important to set m_settings_general, inited_engines_order, m_is_indicator, init_indicator(). BUG=#2182 BUG=#2256
This is the current state of my attempt to add wayland input-method-v2 protocol support to ibus. The idea is to support both v1 and v2 of the protocol version at the same time.
It compiles but due to my lack of understanding of the protocol interactions between the input-method and the text-input protocols we end up with an endless loop when I run the
text-inputexample from wlroots.I'm not sure how the communication between the Wayland client code and the ibus engine works either which makes the implementation even more difficult...
Since I am not sure how much time I will be able to invest into this at the moment, I thought I could at least post what I have here. That way we can either find someone to properly finish the implementation or get some discussion about the next steps that are required going.