Skip to content

Commit

Permalink
Fix option “☑️ Use US keyboard layout”
Browse files Browse the repository at this point in the history
Resolves: #66

The change to the keyval of the US layout needs to be done **before**
doing the Compose support, i.e.  **before**:

   IBUS_ENGINE_CLASS (parent_class)->process_key_event (engine, keyval, keycode, modifiers)

If the keyval is not yet translated before the Compose support is
done, then the Compose support cannot work as intended.

On top of that, if a non-ASCII keyval is fed into the parent class
(IBusEngineSimple), then IBusEngineSimple usually commits it
immediately. That had the effect that when a Russian layout was used
together with the option

☑️ Use US keyboard layout

all the Cyrillic letters were committed immediately before they could
be translated into the respective key values on the US layout.
  • Loading branch information
mike-fabian committed Oct 27, 2023
1 parent abee2ec commit 5ec2f3e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,12 @@ ibus_m17n_engine_process_key_event (IBusEngine *engine,
break;
}

if (klass->use_us_layout) {
keyval = ibus_keymap_lookup_keysym (m17n->us_keymap,
keycode,
modifiers);
}

/*
Compose support:
Expand Down Expand Up @@ -789,12 +795,6 @@ ibus_m17n_engine_process_key_event (IBusEngine *engine,
if (modifiers & IBUS_RELEASE_MASK)
return FALSE;

if (klass->use_us_layout) {
keyval = ibus_keymap_lookup_keysym (m17n->us_keymap,
keycode,
modifiers);
}

MSymbol m17n_key = ibus_m17n_key_event_to_symbol (m17n,
keycode,
keyval,
Expand Down

0 comments on commit 5ec2f3e

Please sign in to comment.