From ee64650c19d2d99933b132356bca44a07a6ef7dd Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Thu, 12 Sep 2024 02:06:16 -0400 Subject: [PATCH] Fix x/event.go --- x/event.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/x/event.go b/x/event.go index ba23dc6..c1a9538 100644 --- a/x/event.go +++ b/x/event.go @@ -7,6 +7,7 @@ import "github.com/jezek/xgb/xproto" import "git.tebibyte.media/tomo/xgbkb" import "github.com/jezek/xgbutil/xevent" import "git.tebibyte.media/tomo/tomo/input" +import "git.tebibyte.media/tomo/tomo/config" type scrollSum struct { x, y int @@ -226,7 +227,7 @@ func (window *window) handleKeyPress ( key, numberPad := keycodeToKey(keyEvent.Detail, keyEvent.State) window.updateModifiers(keyEvent.State) - if key == input.KeyEscape && window.shy { + if config.KeyChordClose.Pressed(key, window.Modifiers()) && window.shy { window.Close() } else { window.hierarchy.HandleKeyDown(key, numberPad) @@ -433,14 +434,15 @@ func (window *window) compressMotionNotify ( func (window *window) updateModifiers (state uint16) { xModifiers := xgbkb.StateToModifiers(state) - window.hierarchy.HandleModifiers(input.Modifiers { - Shift: xModifiers.Shift || xModifiers.ShiftLock, - Control: xModifiers.Control, - Alt: xModifiers.Alt, - Meta: xModifiers.Meta, - Super: xModifiers.Super, - Hyper: xModifiers.Hyper, - }) + var modifiers input.Modifiers + if xModifiers.Shift { modifiers |= input.ModShift } + if xModifiers.ShiftLock { modifiers |= input.ModShift } + if xModifiers.Control { modifiers |= input.ModControl } + if xModifiers.Alt { modifiers |= input.ModAlt } + if xModifiers.Meta { modifiers |= input.ModMeta } + if xModifiers.Super { modifiers |= input.ModSuper } + if xModifiers.Hyper { modifiers |= input.ModHyper } + window.hierarchy.HandleModifiers(modifiers) } func (window *window) updateMousePosition (x, y int16) {