Skip to content
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

Implement support for text-input preedit_shown flag #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ https://github.com/swaywm/sway/pull/5890

Currently hard-coded key bindings:

Ctrl+Henkan_Mode: Enable input method with always-on-popup
Henkan_Mode: Enable input method
Muhenkan: Disable input methbod

Expand Down
15 changes: 2 additions & 13 deletions anthywl.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,19 +510,10 @@ static bool anthywl_seat_composing_handle_key_event(
struct anthywl_seat *seat, xkb_keycode_t keycode)
{
xkb_keysym_t keysym = xkb_state_key_get_one_sym(seat->xkb_state, keycode);
bool ctrl_active = xkb_state_mod_name_is_active(
seat->xkb_state, XKB_MOD_NAME_CTRL, XKB_STATE_EFFECTIVE);

switch (keysym) {
case XKB_KEY_Henkan_Mode:
if (!ctrl_active)
return false;
seat->is_composing_popup_visible = true;
anthywl_seat_composing_update(seat);
return true;
case XKB_KEY_Muhenkan:
seat->is_composing = false;
seat->is_composing_popup_visible = false;
anthywl_buffer_clear(&seat->buffer);
anthywl_seat_composing_update(seat);
return true;
Expand Down Expand Up @@ -792,9 +783,6 @@ static bool anthywl_seat_handle_key(struct anthywl_seat *seat,
return anthywl_seat_composing_handle_key_event(seat, keycode);
if (keysym == XKB_KEY_Henkan_Mode) {
seat->is_composing = true;
seat->is_composing_popup_visible =
xkb_state_mod_name_is_active(
seat->xkb_state, XKB_MOD_NAME_CTRL, XKB_STATE_EFFECTIVE);
return true;
}
return false;
Expand Down Expand Up @@ -1022,9 +1010,10 @@ static void zwp_input_method_v2_done(
seat->content_type_hint = seat->pending_content_type_hint;
seat->content_type_purpose = seat->pending_content_type_purpose;
seat->done_events_received++;
seat->is_composing_popup_visible = !(seat->content_type_hint
& ZWP_TEXT_INPUT_V3_CONTENT_HINT_PREEDIT_SHOWN);
if (!was_active && seat->active) {
seat->is_selecting = false;
seat->is_composing_popup_visible = false;
seat->is_selecting_popup_visible = false;
anthywl_buffer_clear(&seat->buffer);
anthywl_seat_draw_popup(seat);
Expand Down
2 changes: 1 addition & 1 deletion protocol/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ wayland_scanner_bin = find_program(
)

protocols = {
'text-input-v3': wayland_protocols_dir / 'unstable/text-input/text-input-unstable-v3.xml',
'text-input-v3': 'text-input-unstable-v3.xml',
'zwp-input-method-unstable-v2': 'input-method-unstable-v2.xml',
'zwp-virtual-keyboard-unstable-v1': 'virtual-keyboard-unstable-v1.xml',
}
Expand Down
Loading