I forgor about shift and ctrl
This commit is contained in:
parent
aa46cada1f
commit
fc8a34ab07
44
keyboard.go
44
keyboard.go
@ -55,10 +55,12 @@ type Modifiers struct {
|
|||||||
NumLock bool
|
NumLock bool
|
||||||
ModeSwitch bool
|
ModeSwitch bool
|
||||||
|
|
||||||
Alt bool
|
Shift bool
|
||||||
Meta bool
|
Control bool
|
||||||
Super bool
|
Alt bool
|
||||||
Hyper bool
|
Meta bool
|
||||||
|
Super bool
|
||||||
|
Hyper bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns a human-readable comma-separated list of all active modifiers.
|
// String returns a human-readable comma-separated list of all active modifiers.
|
||||||
@ -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