Implement Wayland input-method unstable v2#2695
Closed
Implement Wayland input-method unstable v2#2695
Conversation
…stable-v1.xml Back up the private Wayland protocol files from the wlroots repository. https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/protocol/input-method-unstable-v2.xml https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/protocol/virtual-keyboard-unstable-v1.xml BUG=ibus#2182
% wayland-scanner client-header ./input-method-unstable-v2.xml \ input-method-unstable-v2-client-protocol.h % wayland-scanner code ./input-method-unstable-v2.xml \ input-method-unstable-v2-protocol.c % wayland-scanner client-header ./virtual-keyboard-unstable-v1.xml \ virtual-keyboard-unstable-v1-client-protocol.h % wayland-scanner code ./virtual-keyboard-unstable-v1.xml \ virtual-keyboard-unstable-v1-protocol.c BUG=ibus#2182
This was referenced Nov 1, 2024
Shugyousha
reviewed
Nov 9, 2024
Shugyousha
left a comment
There was a problem hiding this comment.
Mostly some questions from my side! I will still have to test the functionality at one point
e9ce6ab to
841b66b
Compare
…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
841b66b to
7352aa9
Compare
alebastr
reviewed
Nov 22, 2024
ee8deec to
e64afc3
Compare
- Delete IBusWaylandSource in IBusWaylandIM class Seems IBusWaylandSource causes not to call GlobalShortcutKeyResponded D-Bus signal for the shortcut key release events and UpdateLookupTable D-Bus method to show the lookup table with XIM and GTK2 applications likes xterm. - Add "ibus-focus-in" and "ibus-focus-out" signals in IBusWaylandIM class The signals are used to check if the Wayland protocl calls the activation or deactivation because if the client does not support the Wayland input-method protocol, likes xterm and GTK2 applications, and the Wayland compositor does not draw the input context with wl_surface, the overlay panel surface does not work. BUG=ibus#2562 BUG=ibus#2617
GTK popup window takes the focus in Wayland if the active application does not support the Wayland input-method protocl and this API can forward the key events on the popup to the active engine to handle the preedit and lookup table. BUG=ibus#2562
Building your own marshaller list is most of the way there to get better signal performance, but you can go a bit further by having it generate va_marshallers and set those too. Not only do va_marshallers allow you to avoid the GValue boxing, it allows you to also get better profiling data at runtime. Fixes: ibus@c13c54e BUG=ibus#2683
IBus CandidatePanel has focus if the client application does not support the Wayland input-method protocol likes setting XMODIFIERS or GTK_IM_MODULE enviroment variable in Wayland. So if the focus-out is sent to the activated IBus engine, the engine may clear the preedit and try to hide the CandidatePanel. Also implements bus_input_context_is_extension_lookup_table() not to send unnecessary D-Bus methods to IBus Emojier. BUG=ibus#2562 BUG=ibus#2617
e64afc3 to
c64bfba
Compare
There were three issues. The first issue was D-Bus signals weren't sent to the IBus panel for the key release events of the shortcut key of the IME Switcher popup and updating preedit and lookup table when XIM or GTK2 applications are used, which don't support Wayland. Seems the problem is caused by adding IBusWaylandSource in ibus/client/wayland to use the duplicated event handling against glib2 and it's fixed to delete it. The second issue was how to implement Wayland with XIM and GTK2. I tried to handle the Wayland input-method activation/deactivation with creating another Wayland compositor and text-input protocols. But seems it needs to implement a custom wl_surface with the drawing input contexts and it's complicated for me at the moment while GNOME/mutter handles it with WL_SURFACE_ID environment but I cannot find ways for other Wayland desktop environments. Now XMODIFIERS=@im=ibus is used for X11 applications and GTK_IM_MODULE=ibus is for GTK2 applications and handles the key events in the IBus CandidatePanel UI and implements ibus_panel_service_forward_process_key_event(). The third issue was when non-supported Wayland applications likes XIM and GTK2 are used, the IBus CandidatePanel popup takes the focus as the normal application window in Wayland since the Wayland panel protocol requires the Wayland input-method activation. And if the popup is shown, it takes the focus and the active applications loose the input focus and the preedit text is cleared and it causes to close the CandidatePanel popup. I.e. the focus continues to be swapped between the application and the popup. Now ibus-daemon handles not to send focus-out events for the non-supported Wayland applications and IBus panel checks ibus-focus-out signal from ibus/client/wayland module if the current application supports the Wayland protocol and IBus engines handle a virtual input context to continue to update the preedit. BUG=ibus#2562 BUG=ibus#2617
Add candidatepanel:m_prev_cursor to work with a space key repeat. Delete panel:m_switcher_waiting_release thread workaround since the key release issue is fixed for Switcher and not to hide Switcher with a timeout. check if the monitor is null before the switcher is shown. BUG=ibus#2610
zwp_input_method_keyboard_grab_v2_listener.repeat_info() is available in the Wayland input-method protocol V2. wl_keyboard_listener.repeat_info() is also available in the Wayland input-method protocol V1 with the wl_keyboard version 4 but seems Plasma Wayland does not support the API yet so ibus-wayland sets the default delay = 600 milliseconds and rate = 25 milliseconds. ibus-wayland uses GTimeoutSource to implement the key repeat instead of the custom idling function. BUG=ibus#2610
Send keyval and state of the active shortcut key of the IME switcher with the GlobalShortcutKeyResponded D-Bus signal in IBusImple and "global-shortcut-key-responded" GObject signal in IBusBus so that the focused IME switcher can handle the shortcut key in Wayland. Make a common const variable IBUS_MODIFIER_FILTER in ibustypes.h to get the user modifier key. BUG=ibus#2562
fujiwarat
added a commit
to fujiwarat/ibus
that referenced
this pull request
Jan 10, 2025
Get a request to make all protocol files with make command but @wayland_scanner_rules@ has a too wide pattern match and now it's deleted and each protocl files are described in Makefile. BUG=ibus#2695 (comment)
fujiwarat
added a commit
to fujiwarat/ibus
that referenced
this pull request
Jan 10, 2025
Some privileged clients like WayVNC are even able to create a temporary wl_seat via ext-transient-seat protocol to represent remote input devices. Also call zwp_input_method_keyboard_grab_v2_release() in the input-method deactivation. Also sets "" to XKB options to fix SEGV in xkb_keymap_new_from_names() BUG=ibus#2695 (comment)
fujiwarat
added a commit
to fujiwarat/ibus
that referenced
this pull request
Jan 10, 2025
Get a request to make all protocol files with make command but @wayland_scanner_rules@ has a too wide pattern match and now it's deleted and each protocl files are described in Makefile. BUG=ibus#2695 (comment)
fujiwarat
added a commit
to fujiwarat/ibus
that referenced
this pull request
Jan 10, 2025
Some privileged clients like WayVNC are even able to create a temporary wl_seat via ext-transient-seat protocol to represent remote input devices. Also call zwp_input_method_keyboard_grab_v2_release() in the input-method deactivation. Also sets "" to XKB options to fix SEGV in xkb_keymap_new_from_names() BUG=ibus#2695 (comment)
fujiwarat
added a commit
to fujiwarat/ibus
that referenced
this pull request
Jan 10, 2025
Some privileged clients like WayVNC are even able to create a temporary wl_seat via ext-transient-seat protocol to represent remote input devices. Also call zwp_input_method_keyboard_grab_v2_release() in the input-method deactivation. Also sets "" to XKB options to fix SEGV in xkb_keymap_new_from_names() BUG=ibus#2695 (comment)
fujiwarat
added a commit
to fujiwarat/ibus
that referenced
this pull request
Jan 10, 2025
Get a request to make all protocol files with make command but @wayland_scanner_rules@ has a too wide pattern match and now it's deleted and each protocl files are described in Makefile. BUG=ibus#2695 (comment)
fujiwarat
added a commit
to fujiwarat/ibus
that referenced
this pull request
Jan 10, 2025
Some privileged clients like WayVNC are even able to create a temporary wl_seat via ext-transient-seat protocol to represent remote input devices. Also call zwp_input_method_keyboard_grab_v2_release() in the input-method deactivation. Also sets "" to XKB options to fix SEGV in xkb_keymap_new_from_names() BUG=ibus#2695 (comment)
Fix the third issue in 38ba099 for IME switcher to take the focus with XIM or GTK2 applications in Wayland. Send keyval and state in bus.global_shortcut_key_responded signal so that the focused IME switcher can get the release key of the modifier key. Use IBus.MODIFIER_FILTER instead of KeybindingManager.MODIFIER_FILTER Fixes: ibus@38ba099 BUG=ibus#2562
When a non-Wayland application likes xterm is invoked with CLI in a Wayland application likes gnome-terminal, the release key of Return key could be sent to the non-Wayland application and the press key could be be a key repeat. Check priv->ibuscontext to fix the issue.
Get a request to make all protocol files with make command but @wayland_scanner_rules@ has a too wide pattern match and now it's deleted and each protocl files are described in Makefile. BUG=ibus#2695 (comment)
Some privileged clients like WayVNC are even able to create a temporary wl_seat via ext-transient-seat protocol to represent remote input devices. Also call zwp_input_method_keyboard_grab_v2_release() in the input-method deactivation. Also sets "" to XKB options to fix SEGV in xkb_keymap_new_from_names() BUG=ibus#2695 (comment)
35431a1 to
0df6a4c
Compare
Add wayland-protocols package in Fedora and Ubuntu
The option can run IBus with the Wayland input-method protocol version 2.
fujiwarat
added a commit
that referenced
this pull request
Jan 12, 2025
Get a request to make all protocol files with make command but @wayland_scanner_rules@ has a too wide pattern match and now it's deleted and each protocl files are described in Makefile. BUG=#2695 (comment)
fujiwarat
added a commit
that referenced
this pull request
Jan 12, 2025
Some privileged clients like WayVNC are even able to create a temporary wl_seat via ext-transient-seat protocol to represent remote input devices. Also call zwp_input_method_keyboard_grab_v2_release() in the input-method deactivation. Also sets "" to XKB options to fix SEGV in xkb_keymap_new_from_names() BUG=#2695 (comment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.