diff --git a/.gitignore b/.gitignore index c7ea199b..c920403b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,14 @@ tags deb/ pkgs debian/changelog.* +/PKGBUILD* +/gui-agent/qubes-gui +/gui-common/qubes-gui-runuser +/pkg/ +*.tar.zst +/src/ +/xf86-input-mfndev/compile +/xf86-input-mfndev/config.h.in +/xf86-input-mfndev/depcomp +/xf86-input-mfndev/ltmain.sh +/xf86-qubes-common/libxf86-qubes-common.so diff --git a/gui-agent/vmside.c b/gui-agent/vmside.c index fd76f4db..c21876ff 100644 --- a/gui-agent/vmside.c +++ b/gui-agent/vmside.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -1616,6 +1617,8 @@ static void handle_keypress(Ghandles * g, XID UNUSED(winid)) state.mods &= LockMask; key.state &= LockMask; } + bool is_press = key.type == KeyPress; + bool duplicate = false; if (state.mods != key.state) { XModifierKeymap *modmap; int mod_index; @@ -1636,7 +1639,8 @@ static void handle_keypress(Ghandles * g, XID UNUSED(winid)) // #define Mod4MapIndex 6 // #define Mod5MapIndex 7 for (mod_index = 0; mod_index < 8; mod_index++) { - if (modmap->modifiermap[mod_index*modmap->max_keypermod] == 0x00) { + uint32_t keycode = modmap->modifiermap[mod_index*modmap->max_keypermod]; + if (keycode == 0x00) { if (g->log_level > 1) fprintf(stderr, "ignoring disabled modifier %d\n", mod_index); // no key set for this modifier, ignore @@ -1646,21 +1650,24 @@ static void handle_keypress(Ghandles * g, XID UNUSED(winid)) // special case for caps lock switch by press+release if (mod_index == LockMapIndex) { if ((state.mods & mod_mask) ^ (key.state & mod_mask)) { - feed_xdriver(g, 'K', modmap->modifiermap[mod_index*modmap->max_keypermod], 1); - feed_xdriver(g, 'K', modmap->modifiermap[mod_index*modmap->max_keypermod], 0); + feed_xdriver(g, 'K', keycode, 1); + feed_xdriver(g, 'K', keycode, 0); } } else { - if ((state.mods & mod_mask) && !(key.state & mod_mask)) - feed_xdriver(g, 'K', modmap->modifiermap[mod_index*modmap->max_keypermod], 0); - else if (!(state.mods & mod_mask) && (key.state & mod_mask)) - feed_xdriver(g, 'K', modmap->modifiermap[mod_index*modmap->max_keypermod], 1); + if ((state.mods & mod_mask) && !(key.state & mod_mask)) { + feed_xdriver(g, 'K', keycode, 0); + if (keycode == key.keycode && is_press == 0) duplicate = true; + } + else if (!(state.mods & mod_mask) && (key.state & mod_mask)) { + feed_xdriver(g, 'K', keycode, 1); + if (keycode == key.keycode && is_press == 1) duplicate = true; + } } } XFreeModifiermap(modmap); } } - - feed_xdriver(g, 'K', key.keycode, key.type == KeyPress ? 1 : 0); + if (!duplicate) feed_xdriver(g, 'K', key.keycode, is_press); } static void handle_button(Ghandles * g, XID winid)