Further fixes to CKI, reduce number of casts

pull/3/head
Minizbot2012 4 years ago
parent 1d316a11d1
commit d842bfde49
No known key found for this signature in database
GPG Key ID: 977C8ADE12361917

@ -19,9 +19,9 @@ func SaveIntoKeymap(mapped *PKM, file fyne.FileWriteCloser) {
buf := make([]byte, 2)
for i := 0; i < 26; i++ {
if i < 20 {
binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(byte(mapped.MIP[i])))))
binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(mapped.MIP[i]))))
} else {
binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(byte(mapped.SIP[i-20])))))
binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(mapped.SIP[i-20]))))
}
file.Write(buf)
}

@ -74,7 +74,7 @@ func CKIFyneKeyMap(e fyne.KeyName) int {
case desktop.KeyShiftRight:
return CommonToASCII["KEY_RIGHTSHIFT"]
default:
return int(e[0])
return CommonToASCII["KEY_"+string(e)]
}
}

@ -61,7 +61,7 @@ func (bp *Page) createGrid() *fyne.Container {
//Create the binding page popup
func (bp *Page) Create(bid string) fyne.CanvasObject {
bp.dev = make(map[string]fyne.CanvasObject)
bp.dev["BL"] = widget.NewLabel(keys.CKIName(bp.Bind.Bound))
bp.dev["BL"] = widget.NewLabel(keys.ASCIIToCommon(bp.Bind.Bound))
pop := widget.NewVBox(bp.dev["BL"], bp.createGrid())
bp.window.Canvas().SetOnTypedKey(bp.TypeKey)
return pop

Loading…
Cancel
Save