Fix x/event.go
This commit is contained in:
parent
55215dedc2
commit
ee64650c19
20
x/event.go
20
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user