From cc0344012565dfb92a17ff30a727192910048273 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 3 May 2023 01:34:48 -0400 Subject: [PATCH] Clipboard example works --- examples/clipboard/main.go | 21 +++++++++++++-------- examples/document/main.go | 1 - examples/fileBrowser/main.go | 1 - examples/icons/main.go | 1 - examples/image/image.go | 1 - examples/label/main.go | 1 - examples/list/main.go | 1 - examples/panels/main.go | 1 - examples/popups/main.go | 1 - examples/progress/main.go | 1 - examples/spacer/main.go | 1 - plugins/x/x/x.go | 4 +++- 12 files changed, 16 insertions(+), 19 deletions(-) diff --git a/examples/clipboard/main.go b/examples/clipboard/main.go index 4102686..10cabec 100644 --- a/examples/clipboard/main.go +++ b/examples/clipboard/main.go @@ -7,13 +7,9 @@ import _ "image/gif" import _ "image/jpeg" import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/data" +import "git.tebibyte.media/sashakoshka/tomo/nasin" import "git.tebibyte.media/sashakoshka/tomo/popups" import "git.tebibyte.media/sashakoshka/tomo/elements" -import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" - -func main () { - tomo.Run(run) -} var validImageTypes = []data.Mime { data.M("image", "png"), @@ -21,8 +17,16 @@ var validImageTypes = []data.Mime { data.M("image", "jpeg"), } -func run () { - window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 256, 0)) + +func main () { + nasin.Run(Application { }) +} + +type Application struct { } + +func (Application) Init () error { + window, err:= nasin.NewWindow(tomo.Bounds(0, 0, 256, 0)) + if err != nil { return err } window.SetTitle("Clipboard") container := elements.NewVBox(elements.SpaceBoth) @@ -114,8 +118,9 @@ func run () { container.Adopt(controlRow) window.Adopt(container) - window.OnClose(tomo.Stop) + window.OnClose(nasin.Stop) window.Show() + return nil } func imageWindow (parent tomo.Window, image image.Image) { diff --git a/examples/document/main.go b/examples/document/main.go index 146137b..7d41b0c 100644 --- a/examples/document/main.go +++ b/examples/document/main.go @@ -5,7 +5,6 @@ import "image" import _ "image/png" import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" -import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { tomo.Run(run) diff --git a/examples/fileBrowser/main.go b/examples/fileBrowser/main.go index 842df94..924ee62 100644 --- a/examples/fileBrowser/main.go +++ b/examples/fileBrowser/main.go @@ -4,7 +4,6 @@ import "os" import "path/filepath" import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" -import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { tomo.Run(run) diff --git a/examples/icons/main.go b/examples/icons/main.go index 01ed2f5..88bfb8e 100644 --- a/examples/icons/main.go +++ b/examples/icons/main.go @@ -2,7 +2,6 @@ package main import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" -import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { tomo.Run(run) diff --git a/examples/image/image.go b/examples/image/image.go index 0dc2100..c662492 100644 --- a/examples/image/image.go +++ b/examples/image/image.go @@ -8,7 +8,6 @@ import "github.com/jezek/xgbutil/gopher" import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/popups" import "git.tebibyte.media/sashakoshka/tomo/elements" -import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { tomo.Run(run) diff --git a/examples/label/main.go b/examples/label/main.go index 96dc6a8..475a084 100644 --- a/examples/label/main.go +++ b/examples/label/main.go @@ -2,7 +2,6 @@ package main import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" -import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { tomo.Run(run) diff --git a/examples/list/main.go b/examples/list/main.go index eb09fef..19cf79e 100644 --- a/examples/list/main.go +++ b/examples/list/main.go @@ -4,7 +4,6 @@ import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/popups" import "git.tebibyte.media/sashakoshka/tomo/elements" import "git.tebibyte.media/sashakoshka/tomo/elements/testing" -import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { tomo.Run(run) diff --git a/examples/panels/main.go b/examples/panels/main.go index b28b204..e6a5643 100644 --- a/examples/panels/main.go +++ b/examples/panels/main.go @@ -4,7 +4,6 @@ import "fmt" import "image" import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" -import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { tomo.Run(run) diff --git a/examples/popups/main.go b/examples/popups/main.go index 4b2c83a..423ff21 100644 --- a/examples/popups/main.go +++ b/examples/popups/main.go @@ -3,7 +3,6 @@ package main import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/popups" import "git.tebibyte.media/sashakoshka/tomo/elements" -import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { tomo.Run(run) diff --git a/examples/progress/main.go b/examples/progress/main.go index 0fad66b..56cd5a9 100644 --- a/examples/progress/main.go +++ b/examples/progress/main.go @@ -4,7 +4,6 @@ import "time" import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/popups" import "git.tebibyte.media/sashakoshka/tomo/elements" -import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { tomo.Run(run) diff --git a/examples/spacer/main.go b/examples/spacer/main.go index a537a37..f40ab69 100644 --- a/examples/spacer/main.go +++ b/examples/spacer/main.go @@ -2,7 +2,6 @@ package main import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" -import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { tomo.Run(run) diff --git a/plugins/x/x/x.go b/plugins/x/x/x.go index 82a88be..c76be69 100644 --- a/plugins/x/x/x.go +++ b/plugins/x/x/x.go @@ -42,6 +42,9 @@ func NewBackend () (output tomo.Backend, err error) { doChannel: make(chan func (), 32), open: true, } + + backend.SetTheme(nil) + backend.SetConfig(nil) // connect to X backend.connection, err = xgbutil.NewConn() @@ -115,7 +118,6 @@ func (backend *backend) SetConfig (config tomo.Config) { } else { backend.config = config } - backend.config = config for _, window := range backend.windows { window.handleConfigChange() }