mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-12-22 09:30:19 +00:00
Improved open and close apple handling on macs
This commit is contained in:
parent
0598a8a393
commit
4991feeb6f
@ -164,12 +164,13 @@ var helpMessage = `
|
|||||||
F12: Save screen snapshot
|
F12: Save screen snapshot
|
||||||
Pause: Pause the emulation
|
Pause: Pause the emulation
|
||||||
|
|
||||||
Drop a file on the left or right
|
Left alt or option key: Open-Apple
|
||||||
side of the window to load a disk
|
Right alt or option key: Closed-Apple
|
||||||
|
|
||||||
|
Drop a file on the left or right
|
||||||
|
side of the window to load a disk
|
||||||
|
|
||||||
Run izapple2 -h for more options
|
Run izapple2 -h for more options
|
||||||
|
|
||||||
More info at
|
|
||||||
https://github.com/ivanizag/izapple2
|
https://github.com/ivanizag/izapple2
|
||||||
`
|
`
|
||||||
|
|
||||||
|
16
keyboard.go
16
keyboard.go
@ -1,6 +1,9 @@
|
|||||||
package izapple2
|
package izapple2
|
||||||
|
|
||||||
import "unicode"
|
import (
|
||||||
|
"slices"
|
||||||
|
"unicode"
|
||||||
|
)
|
||||||
|
|
||||||
// KeyboardProvider provides a keyboard implementation
|
// KeyboardProvider provides a keyboard implementation
|
||||||
type KeyboardProvider interface {
|
type KeyboardProvider interface {
|
||||||
@ -29,8 +32,19 @@ func (k *KeyboardChannel) PutText(text string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var macOptionChars = []rune("ı˝•£‰ ⁄‘’≈œæ€®†¥øπå∫∂ƒ™¶§∑©√ßµ„…≤≥çñŒÆ€‡∏fl¯ˇ˘‹›◊˙˚")
|
||||||
|
var macOptionSubs = []rune("!\"·$%&/()=qwertyopasdfghjkxcvbm,.<>cnQWETPGJKLZXVNM")
|
||||||
|
|
||||||
// PutRune sends a rune to the emulator if it is valid printable ASCII
|
// PutRune sends a rune to the emulator if it is valid printable ASCII
|
||||||
func (k *KeyboardChannel) PutRune(ch rune) {
|
func (k *KeyboardChannel) PutRune(ch rune) {
|
||||||
|
|
||||||
|
// Some substitutions useful for Macs that transform chars with the option key
|
||||||
|
pos := slices.Index(macOptionChars, ch)
|
||||||
|
if pos >= 0 {
|
||||||
|
println("Mac option char: ", string(ch), " -> ", string(macOptionSubs[pos]))
|
||||||
|
ch = rune(macOptionSubs[pos])
|
||||||
|
}
|
||||||
|
|
||||||
// We will use computed text only for printable ASCII chars
|
// We will use computed text only for printable ASCII chars
|
||||||
if ch >= ' ' && ch <= '~' {
|
if ch >= ' ' && ch <= '~' {
|
||||||
if k.a.IsForceCaps() && ch >= 'a' && ch <= 'z' {
|
if k.a.IsForceCaps() && ch >= 'a' && ch <= 'z' {
|
||||||
|
Loading…
Reference in New Issue
Block a user