From e84a2344cf2bdb2707926a8ad748a77cd3b97b92 Mon Sep 17 00:00:00 2001 From: Rajiv Kanchan Date: Mon, 9 Nov 2020 00:21:17 +0530 Subject: [PATCH] app/internal/xkb: fix duplicate edit events for special keys Edit events were being sent twice, once upon key press and again on key release for special keys such as Enter, Arrow keys etc, which resulted in duplicate inputs while pressing these keys. key.EditEvents for special keys now fire once on key press only. Signed-off-by: Rajiv Kanchan --- app/internal/xkb/xkb_unix.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/internal/xkb/xkb_unix.go b/app/internal/xkb/xkb_unix.go index 2f0fefac..680df6b7 100644 --- a/app/internal/xkb/xkb_unix.go +++ b/app/internal/xkb/xkb_unix.go @@ -170,7 +170,9 @@ func (x *Context) DispatchKey(keyCode uint32, state key.State) (events []event.E if sym == C.XKB_KEY_ISO_Left_Tab { cmd.Modifiers |= key.ModShift } - events = append(events, cmd) + if state == key.Press { + events = append(events, cmd) + } } C.xkb_compose_state_feed(x.compState, sym) var str []byte