From 89f7bf47ce21f3c3d8aaad4ffa9c4f03f17d61a8 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 5 Sep 2023 13:21:59 -0400 Subject: [PATCH] Add ability to create an undecorated window --- backend.go | 9 ++++++++- tomo.go | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/backend.go b/backend.go index e74810f..fd177e5 100644 --- a/backend.go +++ b/backend.go @@ -11,12 +11,19 @@ import "git.tebibyte.media/tomo/tomo/canvas" type Backend interface { // These methods create new objects. The backend must reject any object // that was not made by it. - NewWindow (image.Rectangle) (MainWindow, error) NewBox () Box NewTextBox () TextBox NewCanvasBox () CanvasBox NewContainerBox () ContainerBox + // NewWindow creates a normal MainWindow and returns it. + NewWindow (image.Rectangle) (MainWindow, error) + + // NewPlainWindow creates an undecorated window that does not appear in + // window lists and returns it. This is intended for making things like + // panels, docks, etc. + NewPlainWindow (image.Rectangle) (MainWindow, error) + // NewTexture creates a new texture from an image. The backend must // reject any texture that was not made by it. NewTexture (image.Image) canvas.TextureCloser diff --git a/tomo.go b/tomo.go index cd1b617..2ae7997 100644 --- a/tomo.go +++ b/tomo.go @@ -57,6 +57,14 @@ func NewWindow (bounds image.Rectangle) (MainWindow, error) { return backend.NewWindow(bounds) } +// NewPlainWindow is like NewWindow, but it creates an undecorated window that +// does not appear in window lists. It is intended for creating things like +// docks, panels, etc. +func NewPlainWindow (bounds image.Rectangle) (MainWindow, error) { + assertBackend() + return backend.NewPlainWindow(bounds) +} + // NewBox creates and returns a basic Box. func NewBox () Box { assertBackend()