Skip to content

fix(linux): Ignore keys with IBUS_MOD4_MASK set#10668

Merged
ermshiperete merged 1 commit intomasterfrom
fix/linux/10476_switch-kbd
Feb 8, 2024
Merged

fix(linux): Ignore keys with IBUS_MOD4_MASK set#10668
ermshiperete merged 1 commit intomasterfrom
fix/linux/10476_switch-kbd

Conversation

@ermshiperete
Copy link
Copy Markdown
Contributor

@ermshiperete ermshiperete commented Feb 7, 2024

If we process keys that have the (Super/Meta/Windows) IBUS_MOD4_MASK modifier set we ignore the key. Core doesn't handle the Meta modifier state and so would treat it as regular key. This fixes switching keyboards in Ubuntu 23.10/24.04 on Wayland.

Fixes #10476.

User Testing

This should be tested on Ubuntu 23.10 or 24.04 with Wayland with at least one Keyman keyboard installed.

TEST_SWITCH_KBD:

  • Open a terminal window.
  • Press SuperSpace to switch to the Keyman keyboard.
  • Press SuperSpace again to switch back to the first keyboard
  • Verify that the keyboard switch actually happens.

If we process keys that have the (Super/Meta/Windows) IBUS_MOD4_MASK
modifier set we ignore the key. Core doesn't handle the Meta modifier
state and so would treat it as regular key. This fixes switching keyboards
in Ubuntu 23.10/24.04 on Wayland.

Fixes #10476.
@keymanapp-test-bot keymanapp-test-bot bot added has-user-test user-test-required User tests have not been completed labels Feb 7, 2024
@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot bot commented Feb 7, 2024

User Test Results

Test specification and instructions

  • TEST_SWITCH_KBD (PASSED): Tested with the attached PR build (ver 17.0.262-alpha-local (package version 17.0.262-1~PR-10668-2282.1+mantic1) on Ubuntu 23.10 Mantic Minotaur Linux OS (VM) and here is my observation: 1. Installed some Keyman Keyboards. 2. Verified that the default system keyboard (en) appears on the task bar. 3. Pressed <Windows key + Spacebar> to switch to Keyman (eg., khmer_angkor) keyboard and verified the keyboard was changed to Khmer Angkor. 4. Again, pressed <Windows key + Spacebar> to switch back to the previous keyboard. (ie., en) and verified that the keyboard was changed to the system keyboard (English). Seems to be working fine.

Test Artifacts

@ermshiperete
Copy link
Copy Markdown
Contributor Author

@mcdurdin I'm not sure if it would be better to ignore the Meta modifier in Keyman Core? Then the engines don't need to know what Core supports.

@mcdurdin
Copy link
Copy Markdown
Member

mcdurdin commented Feb 7, 2024

I'm not sure if it would be better to ignore the Meta modifier in Keyman Core?

(edit: My bad, I looked at the wrong bitmap)

We don't currently have a Meta modifier in the modifier bitmap. It's there as a reserved value, but commented out.

Given we don't have any plans to support Meta as a modifier for keyboards, Core doesn't need to support it. Keyman Engine for Windows ignores Windows, Keyman Engine for macOS ignores Command, so Keyman Engine for Linux should ignore the Meta key.

Comment on lines +823 to +828
// REVIEW: Do we need to do something about IBUS_MOD2_MASK (NumLock)? I guess
// if a keyboard would have rules for the numeric keypad we might need
// it. At the moment however we let Core process the keypress and since
// it doesn't have rules for the numeric keypad keys we eventually
// forward the key to ibus (in process_emit_keystroke_action) and let
// Gnome deal with it.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have a flag for numlock - but it is currently commented out. In theory Keyman .kmn keyboards support rules with NUMLOCK modifiers, but this is not recommended and has never really been tested.

@bharanidharanj
Copy link
Copy Markdown

bharanidharanj commented Feb 8, 2024

Test Results

  • TEST_SWITCH_KBD (PASSED): Tested with the attached PR build (ver 17.0.262-alpha-local (package version 17.0.262-1~PR-10668-2282.1+mantic1) on Ubuntu 23.10 Mantic Minotaur Linux OS (VM) and here is my observation: 1. Installed some Keyman Keyboards. 2. Verified that the default system keyboard (en) appears on the task bar. 3. Pressed <Windows key + Spacebar> to switch to Keyman (eg., khmer_angkor) keyboard and verified the keyboard was changed to Khmer Angkor. 4. Again, pressed <Windows key + Spacebar> to switch back to the previous keyboard. (ie., en) and verified that the keyboard was changed to the system keyboard (English). Seems to be working fine.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Feb 8, 2024
@ermshiperete ermshiperete merged commit 3737c2f into master Feb 8, 2024
@ermshiperete ermshiperete deleted the fix/linux/10476_switch-kbd branch February 8, 2024 08:41
@keyman-server
Copy link
Copy Markdown
Collaborator

Changes in this pull request will be available for download in Keyman version 17.0.263-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(linux): Switching keyboards doesn't work with Keyman keyboard on Ubuntu 23.10 Mantic in Wayland mode

4 participants