From 2fdee088910c1bb3b958a2dbd3c28591eca97eee Mon Sep 17 00:00:00 2001 From: glasseyes Date: Mon, 3 Dec 2018 13:56:19 +0700 Subject: [PATCH] handle iso shift level 3 form of AltR --- linux/ibus-keyman/src/engine.c | 47 +++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/linux/ibus-keyman/src/engine.c b/linux/ibus-keyman/src/engine.c index d20caa54a8..cb5f66fa9a 100644 --- a/linux/ibus-keyman/src/engine.c +++ b/linux/ibus-keyman/src/engine.c @@ -473,6 +473,20 @@ ibus_keyman_engine_process_key_event (IBusEngine *engine, { km_mod_state |= KM_KBP_MODIFIER_SHIFT; } + if (state & IBUS_MOD5_MASK) + { + km_mod_state |= KM_KBP_MODIFIER_RALT; + g_message("modstate KM_KBP_MODIFIER_RALT from IBUS_MOD5_MASK"); + } + if (state & IBUS_MOD1_MASK) + { + km_mod_state |= KM_KBP_MODIFIER_ALT; + g_message("modstate KM_KBP_MODIFIER_ALT"); + } + if (state & IBUS_CONTROL_MASK) { + km_mod_state |= KM_KBP_MODIFIER_CTRL; + g_message("modstate KM_KBP_MODIFIER_CTRL"); + } g_message("DAR: ibus_keyman_engine_process_key_event - keyval=%02i, keycode=%02i, state=%02x", keyval, keycode, state); @@ -488,24 +502,19 @@ ibus_keyman_engine_process_key_event (IBusEngine *engine, // If a modifier key is pressed, check to see if it is a right modifier key // This is rather expensive so only do it if a shift state is active - if (state & (IBUS_SHIFT_MASK | IBUS_CONTROL_MASK | IBUS_MOD1_MASK)) { + if (state & (/*IBUS_SHIFT_MASK |*/ IBUS_CONTROL_MASK | IBUS_MOD1_MASK)) { Display * m_display = XOpenDisplay(NULL);; char key_vec[32]; XQueryKeymap(m_display, key_vec); - if (state & IBUS_MOD1_MASK) { - km_mod_state |= KM_KBP_MODIFIER_ALT; - } - if (state & IBUS_CONTROL_MASK) { - km_mod_state |= KM_KBP_MODIFIER_CTRL; - } - if ((state & IBUS_MOD1_MASK) && is_key_pressed(m_display, key_vec, IBUS_Alt_R)) { km_mod_state |= KM_KBP_MODIFIER_RALT; + g_message("modstate KM_KBP_MODIFIER_RALT from IBUS_Alt_R"); } if ((state & IBUS_CONTROL_MASK) && is_key_pressed(m_display, key_vec, IBUS_Control_R)) { km_mod_state |= KM_KBP_MODIFIER_RCTRL; + g_message("modstate KM_KBP_MODIFIER_RCTRL"); } // ignoring right shift // if ((state & IBUS_SHIFT_MASK) && is_key_pressed(m_display, key_vec, IBUS_Shift_R)) { @@ -513,16 +522,18 @@ ibus_keyman_engine_process_key_event (IBusEngine *engine, // } XCloseDisplay(m_display); - if ((km_mod_state & KM_KBP_MODIFIER_ALT) && !(km_mod_state & KM_KBP_MODIFIER_RALT)) - { - // Left alt so do not pass to keyman - return FALSE; - } - if ((km_mod_state & KM_KBP_MODIFIER_CTRL) && !(km_mod_state & KM_KBP_MODIFIER_RCTRL)) - { - // Left ctrl so do not pass to keyman - return FALSE; - } + // if ((km_mod_state & KM_KBP_MODIFIER_ALT) && !(km_mod_state & KM_KBP_MODIFIER_RALT)) + // { + // // Left alt so do not pass to keyman + // g_message("Left alt so do not pass to keyman until it allows us to use it"); + // return FALSE; + // } + // if ((km_mod_state & KM_KBP_MODIFIER_CTRL) && !(km_mod_state & KM_KBP_MODIFIER_RCTRL)) + // { + // // Left ctrl so do not pass to keyman + // g_message("Left ctrl so do not pass to keyman until it allows us to use it"); + // return FALSE; + // } } g_message("DAR: ibus_keyman_engine_process_key_event - km_mod_state=%x", km_mod_state); km_kbp_status event_status = km_kbp_process_event(keyman->state,