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 "git.tebibyte.media/tomo/xgbkb"
|
||||||
import "github.com/jezek/xgbutil/xevent"
|
import "github.com/jezek/xgbutil/xevent"
|
||||||
import "git.tebibyte.media/tomo/tomo/input"
|
import "git.tebibyte.media/tomo/tomo/input"
|
||||||
|
import "git.tebibyte.media/tomo/tomo/config"
|
||||||
|
|
||||||
type scrollSum struct {
|
type scrollSum struct {
|
||||||
x, y int
|
x, y int
|
||||||
@ -226,7 +227,7 @@ func (window *window) handleKeyPress (
|
|||||||
key, numberPad := keycodeToKey(keyEvent.Detail, keyEvent.State)
|
key, numberPad := keycodeToKey(keyEvent.Detail, keyEvent.State)
|
||||||
window.updateModifiers(keyEvent.State)
|
window.updateModifiers(keyEvent.State)
|
||||||
|
|
||||||
if key == input.KeyEscape && window.shy {
|
if config.KeyChordClose.Pressed(key, window.Modifiers()) && window.shy {
|
||||||
window.Close()
|
window.Close()
|
||||||
} else {
|
} else {
|
||||||
window.hierarchy.HandleKeyDown(key, numberPad)
|
window.hierarchy.HandleKeyDown(key, numberPad)
|
||||||
@ -433,14 +434,15 @@ func (window *window) compressMotionNotify (
|
|||||||
|
|
||||||
func (window *window) updateModifiers (state uint16) {
|
func (window *window) updateModifiers (state uint16) {
|
||||||
xModifiers := xgbkb.StateToModifiers(state)
|
xModifiers := xgbkb.StateToModifiers(state)
|
||||||
window.hierarchy.HandleModifiers(input.Modifiers {
|
var modifiers input.Modifiers
|
||||||
Shift: xModifiers.Shift || xModifiers.ShiftLock,
|
if xModifiers.Shift { modifiers |= input.ModShift }
|
||||||
Control: xModifiers.Control,
|
if xModifiers.ShiftLock { modifiers |= input.ModShift }
|
||||||
Alt: xModifiers.Alt,
|
if xModifiers.Control { modifiers |= input.ModControl }
|
||||||
Meta: xModifiers.Meta,
|
if xModifiers.Alt { modifiers |= input.ModAlt }
|
||||||
Super: xModifiers.Super,
|
if xModifiers.Meta { modifiers |= input.ModMeta }
|
||||||
Hyper: xModifiers.Hyper,
|
if xModifiers.Super { modifiers |= input.ModSuper }
|
||||||
})
|
if xModifiers.Hyper { modifiers |= input.ModHyper }
|
||||||
|
window.hierarchy.HandleModifiers(modifiers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (window *window) updateMousePosition (x, y int16) {
|
func (window *window) updateMousePosition (x, y int16) {
|
||||||
|
Loading…
Reference in New Issue
Block a user