Skip to content

Commit 57ea2c0

Browse files
authored
Fix and improve var names (#57)
1 parent 1fbabd1 commit 57ea2c0

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

keyboard.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type Device struct {
3838
combosPressed map[uint32]struct{}
3939
combosReleased []uint32
4040
combosKey uint32
41-
founds []Keycode
41+
combosFounds []Keycode
4242
}
4343

4444
type KBer interface {
@@ -82,7 +82,7 @@ func New() *Device {
8282
combosPressed: map[uint32]struct{}{},
8383
combosReleased: make([]uint32, 0, 10),
8484
combosKey: 0xFFFFFFFF,
85-
founds: make([]Keycode, 10),
85+
combosFounds: make([]Keycode, 10),
8686
}
8787

8888
SetDevice(d)
@@ -210,7 +210,7 @@ func (d *Device) Tick() error {
210210
}
211211

212212
// read from key matrix
213-
noneToPresse := []uint32{}
213+
noneToPress := []uint32{}
214214
for kbidx, k := range d.kb {
215215
state := k.Get()
216216
for i := range state {
@@ -226,7 +226,7 @@ func (d *Device) Tick() error {
226226
}
227227
}
228228
if !found {
229-
noneToPresse = append(noneToPresse, x)
229+
noneToPress = append(noneToPress, x)
230230
d.pressed = append(d.pressed, x)
231231
}
232232

@@ -244,22 +244,22 @@ func (d *Device) Tick() error {
244244
}
245245
}
246246

247-
d.founds = d.founds[:0]
247+
d.combosFounds = d.combosFounds[:0]
248248
if d.combosKey == 0xFFFFFFFF {
249-
for _, xx := range noneToPresse {
249+
for _, xx := range noneToPress {
250250
kbidx, layer, index := decKey(xx)
251251
x := d.kb[kbidx].Key(layer, index)
252252
for _, combo := range d.Combos {
253253
for _, ckey := range combo[:4] {
254254
if keycodeViaToTGK(ckey) == x {
255255
uniq := true
256-
for _, f := range d.founds {
256+
for _, f := range d.combosFounds {
257257
if f == ckey {
258258
uniq = false
259259
}
260260
}
261261
if uniq {
262-
d.founds = append(d.founds, ckey)
262+
d.combosFounds = append(d.combosFounds, ckey)
263263
}
264264
if d.combosTimer.IsZero() {
265265
d.combosTimer = time.Now().Add(48 * time.Millisecond)
@@ -269,14 +269,14 @@ func (d *Device) Tick() error {
269269
}
270270
}
271271
}
272-
if len(d.founds) == len(noneToPresse) {
272+
if len(d.combosFounds) == len(noneToPress) {
273273
// Remove the keys pressed before the Combos are completed.
274-
noneToPresse = noneToPresse[:0]
274+
noneToPress = noneToPress[:0]
275275
} else {
276276
// Cancel the Combos waiting state if a key unrelated to Combos is pressed.
277277
d.combosTimer = time.Time{}
278278
for xx := range d.combosPressed {
279-
noneToPresse = append(noneToPresse, xx)
279+
noneToPress = append(noneToPress, xx)
280280
delete(d.combosPressed, xx)
281281
}
282282
pressToRelease = append(d.combosReleased, pressToRelease...)
@@ -321,12 +321,12 @@ func (d *Device) Tick() error {
321321
}
322322

323323
if matched {
324-
noneToPresse = append(noneToPresse, d.combosKey)
324+
noneToPress = append(noneToPress, d.combosKey)
325325

326326
d.combosReleased = d.combosReleased[:0]
327327
} else {
328328
for k := range d.combosPressed {
329-
noneToPresse = append(noneToPresse, k)
329+
noneToPress = append(noneToPress, k)
330330
delete(d.combosPressed, k)
331331
}
332332
for _, k := range d.combosReleased {
@@ -338,7 +338,7 @@ func (d *Device) Tick() error {
338338
}
339339
}
340340

341-
for _, xx := range noneToPresse {
341+
for _, xx := range noneToPress {
342342
kbidx, layer, index := decKey(xx)
343343
var x Keycode
344344
if kbidx < len(d.kb) {

0 commit comments

Comments
 (0)