diff options
Diffstat (limited to 'limox.go')
-rw-r--r-- | limox.go | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -4,7 +4,7 @@ import ( "log" "gioui.org/app" - "gioui.org/io/system" + "gioui.org/io/event" "gioui.org/op" "gioui.org/unit" "gioui.org/widget" @@ -35,16 +35,15 @@ type Limox struct { func NewLimox() Limox { l := Limox{ - Window: app.NewWindow( - app.Title("LimoX"), - app.Size(unit.Dp(400), unit.Dp(600)), - ), + Window: new(app.Window), Operations: op.Ops{}, Theme: material.NewTheme(), sessionOut: make(chan any), State: Disconnected, } + l.Window.Option(app.Title("LimoX")) + l.Window.Option(app.Size(unit.Dp(400), unit.Dp(600))) l.JidEditor.SetText(getLastJid()) l.PwdEditor.SetText(getLastPwd()) @@ -52,16 +51,19 @@ func NewLimox() Limox { } func (l *Limox) run() error { + c := make(chan event.Event) + go func() { + for { + c <- l.Window.Event() + } + }() for { select { - case e := <-l.Window.Events(): + case e := <-c: switch e := e.(type) { - case system.DestroyEvent: + case app.DestroyEvent: return e.Err - case system.FrameEvent: - if l.MainButton.Clicked() { - l.buttonCallback() - } + case app.FrameEvent: l.draw(e) } case data := <-l.sessionOut: |