@@ -38,7 +38,7 @@ type Device struct {
38
38
combosPressed map [uint32 ]struct {}
39
39
combosReleased []uint32
40
40
combosKey uint32
41
- founds []Keycode
41
+ combosFounds []Keycode
42
42
}
43
43
44
44
type KBer interface {
@@ -82,7 +82,7 @@ func New() *Device {
82
82
combosPressed : map [uint32 ]struct {}{},
83
83
combosReleased : make ([]uint32 , 0 , 10 ),
84
84
combosKey : 0xFFFFFFFF ,
85
- founds : make ([]Keycode , 10 ),
85
+ combosFounds : make ([]Keycode , 10 ),
86
86
}
87
87
88
88
SetDevice (d )
@@ -210,7 +210,7 @@ func (d *Device) Tick() error {
210
210
}
211
211
212
212
// read from key matrix
213
- noneToPresse := []uint32 {}
213
+ noneToPress := []uint32 {}
214
214
for kbidx , k := range d .kb {
215
215
state := k .Get ()
216
216
for i := range state {
@@ -226,7 +226,7 @@ func (d *Device) Tick() error {
226
226
}
227
227
}
228
228
if ! found {
229
- noneToPresse = append (noneToPresse , x )
229
+ noneToPress = append (noneToPress , x )
230
230
d .pressed = append (d .pressed , x )
231
231
}
232
232
@@ -244,22 +244,22 @@ func (d *Device) Tick() error {
244
244
}
245
245
}
246
246
247
- d .founds = d .founds [:0 ]
247
+ d .combosFounds = d .combosFounds [:0 ]
248
248
if d .combosKey == 0xFFFFFFFF {
249
- for _ , xx := range noneToPresse {
249
+ for _ , xx := range noneToPress {
250
250
kbidx , layer , index := decKey (xx )
251
251
x := d .kb [kbidx ].Key (layer , index )
252
252
for _ , combo := range d .Combos {
253
253
for _ , ckey := range combo [:4 ] {
254
254
if keycodeViaToTGK (ckey ) == x {
255
255
uniq := true
256
- for _ , f := range d .founds {
256
+ for _ , f := range d .combosFounds {
257
257
if f == ckey {
258
258
uniq = false
259
259
}
260
260
}
261
261
if uniq {
262
- d .founds = append (d .founds , ckey )
262
+ d .combosFounds = append (d .combosFounds , ckey )
263
263
}
264
264
if d .combosTimer .IsZero () {
265
265
d .combosTimer = time .Now ().Add (48 * time .Millisecond )
@@ -269,14 +269,14 @@ func (d *Device) Tick() error {
269
269
}
270
270
}
271
271
}
272
- if len (d .founds ) == len (noneToPresse ) {
272
+ if len (d .combosFounds ) == len (noneToPress ) {
273
273
// Remove the keys pressed before the Combos are completed.
274
- noneToPresse = noneToPresse [:0 ]
274
+ noneToPress = noneToPress [:0 ]
275
275
} else {
276
276
// Cancel the Combos waiting state if a key unrelated to Combos is pressed.
277
277
d .combosTimer = time.Time {}
278
278
for xx := range d .combosPressed {
279
- noneToPresse = append (noneToPresse , xx )
279
+ noneToPress = append (noneToPress , xx )
280
280
delete (d .combosPressed , xx )
281
281
}
282
282
pressToRelease = append (d .combosReleased , pressToRelease ... )
@@ -321,12 +321,12 @@ func (d *Device) Tick() error {
321
321
}
322
322
323
323
if matched {
324
- noneToPresse = append (noneToPresse , d .combosKey )
324
+ noneToPress = append (noneToPress , d .combosKey )
325
325
326
326
d .combosReleased = d .combosReleased [:0 ]
327
327
} else {
328
328
for k := range d .combosPressed {
329
- noneToPresse = append (noneToPresse , k )
329
+ noneToPress = append (noneToPress , k )
330
330
delete (d .combosPressed , k )
331
331
}
332
332
for _ , k := range d .combosReleased {
@@ -338,7 +338,7 @@ func (d *Device) Tick() error {
338
338
}
339
339
}
340
340
341
- for _ , xx := range noneToPresse {
341
+ for _ , xx := range noneToPress {
342
342
kbidx , layer , index := decKey (xx )
343
343
var x Keycode
344
344
if kbidx < len (d .kb ) {
0 commit comments