diff --git a/elements/window.go b/elements/window.go index 7b432c3..83b2f79 100644 --- a/elements/window.go +++ b/elements/window.go @@ -1,13 +1,13 @@ package elements +import "io" import "image" +import "git.tebibyte.media/sashakoshka/tomo/data" // Window represents a top-level container generated by the currently running // backend. It can contain a single element. It is hidden by default, and must // be explicitly shown with the Show() method. type Window interface { - Parent - // Adopt sets the root element of the window. There can only be one of // these at one time. Adopt (Element) @@ -27,6 +27,15 @@ type Window interface { // NewModal creates a new modal dialog window. NewModal (width, height int) (window Window, err error) + + // Copy puts data into the clipboard. + Copy (data.Data) + + // Paste requests the data currently in the clipboard. When the data is + // available, it is sent on the returned channel. If there is no data on + // the clipboard matching the requested mime type, the channel will be + // sent nil. + Paste (accept data.Mime) <- chan io.Reader // Show shows the window. The window starts off hidden, so this must be // called after initial setup to make sure it is visible. diff --git a/tomo.go b/tomo.go index eb36c8e..33780cb 100644 --- a/tomo.go +++ b/tomo.go @@ -4,7 +4,6 @@ import "os" import "io" import "path/filepath" import "git.tebibyte.media/sashakoshka/tomo/dirs" -import "git.tebibyte.media/sashakoshka/tomo/data" import "git.tebibyte.media/sashakoshka/tomo/theme" import "git.tebibyte.media/sashakoshka/tomo/config" import "git.tebibyte.media/sashakoshka/tomo/elements" @@ -47,19 +46,6 @@ func NewWindow (width, height int) (window elements.MainWindow, err error) { return backend.NewWindow(width, height) } -// Copy puts data into the clipboard. -func Copy (data data.Data) { - assertBackend() - backend.Copy(data) -} - -// Paste returns the data currently in the clipboard. This method may -// return nil. -func Paste (accept []data.Mime) (data.Data) { - assertBackend() - return backend.Paste(accept) -} - // SetTheme sets the theme of all open windows. func SetTheme (theme theme.Theme) { backend.SetTheme(theme)