I forgor about shift and ctrl
This commit is contained in:
parent
aa46cada1f
commit
fc8a34ab07
36
keyboard.go
36
keyboard.go
@ -55,6 +55,8 @@ type Modifiers struct {
|
|||||||
NumLock bool
|
NumLock bool
|
||||||
ModeSwitch bool
|
ModeSwitch bool
|
||||||
|
|
||||||
|
Shift bool
|
||||||
|
Control bool
|
||||||
Alt bool
|
Alt bool
|
||||||
Meta bool
|
Meta bool
|
||||||
Super bool
|
Super bool
|
||||||
@ -69,14 +71,16 @@ func (modifiers Modifiers) String () (out string) {
|
|||||||
}
|
}
|
||||||
out += name
|
out += name
|
||||||
}
|
}
|
||||||
if modifiers.Hyper { add("Hyper") }
|
|
||||||
if modifiers.Super { add("Super") }
|
|
||||||
if modifiers.Meta { add("Meta") }
|
|
||||||
if modifiers.Alt { add("Alt") }
|
|
||||||
if modifiers.ModeSwitch { add("ModeSwitch") }
|
|
||||||
if modifiers.NumLock { add("NumLock") }
|
|
||||||
if modifiers.ShiftLock { add("ShiftLock") }
|
|
||||||
if modifiers.CapsLock { add("CapsLock") }
|
if modifiers.CapsLock { add("CapsLock") }
|
||||||
|
if modifiers.ShiftLock { add("ShiftLock") }
|
||||||
|
if modifiers.NumLock { add("NumLock") }
|
||||||
|
if modifiers.ModeSwitch { add("ModeSwitch") }
|
||||||
|
if modifiers.Shift { add("Shift") }
|
||||||
|
if modifiers.Control { add("Control") }
|
||||||
|
if modifiers.Alt { add("Alt") }
|
||||||
|
if modifiers.Meta { add("Meta") }
|
||||||
|
if modifiers.Super { add("Super") }
|
||||||
|
if modifiers.Hyper { add("Hyper") }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,14 +88,16 @@ func (modifiers Modifiers) String () (out string) {
|
|||||||
// to a Modifiers struct.
|
// to a Modifiers struct.
|
||||||
func StateToModifiers (state uint16) Modifiers {
|
func StateToModifiers (state uint16) Modifiers {
|
||||||
return Modifiers {
|
return Modifiers {
|
||||||
CapsLock: 0 < state & modifierMasks.capsLock,
|
CapsLock: (state & modifierMasks.capsLock) > 0,
|
||||||
ShiftLock: 0 < state & modifierMasks.shiftLock,
|
ShiftLock: (state & modifierMasks.shiftLock) > 0,
|
||||||
NumLock: 0 < state & modifierMasks.numLock,
|
NumLock: (state & modifierMasks.numLock) > 0,
|
||||||
ModeSwitch: 0 < state & modifierMasks.modeSwitch,
|
ModeSwitch: (state & modifierMasks.modeSwitch) > 0,
|
||||||
Alt: 0 < state & modifierMasks.alt,
|
Shift: (state & xproto.ModMaskShift) > 0,
|
||||||
Meta: 0 < state & modifierMasks.meta,
|
Control: (state & xproto.ModMaskControl) > 0,
|
||||||
Super: 0 < state & modifierMasks.super,
|
Alt: (state & modifierMasks.alt) > 0,
|
||||||
Hyper: 0 < state & modifierMasks.hyper,
|
Meta: (state & modifierMasks.meta) > 0,
|
||||||
|
Super: (state & modifierMasks.super) > 0,
|
||||||
|
Hyper: (state & modifierMasks.hyper) > 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user