Support for meta and hyper keys added

Support for the compose key has also been added but it's just the
button code for now, no support for actually composing stuff.
There are plans for that in a fixme.
This commit is contained in:
Sasha Koshka
2022-11-21 23:43:22 -05:00
parent 9a37fbf04a
commit 8c28c57925
4 changed files with 71 additions and 8 deletions

View File

@@ -0,0 +1,41 @@
package main
import "os"
import "image"
import _ "image/png"
import "git.tebibyte.media/sashakoshka/stone"
import _ "git.tebibyte.media/sashakoshka/stone/backends/x"
var application = &stone.Application { }
func main () {
application.SetTitle("press any key")
application.SetSize(8, 1)
iconFile16, err := os.Open("assets/scaffold16.png")
if err != nil { panic(err) }
icon16, _, err := image.Decode(iconFile16)
if err != nil { panic(err) }
iconFile16.Close()
iconFile32, err := os.Open("assets/scaffold32.png")
if err != nil { panic(err) }
icon32, _, err := image.Decode(iconFile32)
if err != nil { panic(err) }
iconFile16.Close()
application.SetIcon([]image.Image { icon16, icon32 })
application.OnPress(onPress)
application.OnRelease(onRelease)
err = application.Run()
if err != nil { panic(err) }
}
func onPress (button stone.Button) {
println("press", button)
}
func onRelease (button stone.Button) {
println("release", button)
}