handle iso shift level 3 form of AltR

This commit is contained in:
glasseyes 2018-12-03 13:56:19 +07:00
parent a6d3b36b72
commit 2fdee08891

View file

@ -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,