Added x clipboard stub
It doesn't do anything yet but boy is it going to
This commit is contained in:
parent
14adaa4552
commit
21c19363dd
@ -21,7 +21,7 @@ type Backend interface {
|
|||||||
// interface.
|
// interface.
|
||||||
NewWindow (width, height int) (window Window, err error)
|
NewWindow (width, height int) (window Window, err error)
|
||||||
|
|
||||||
// Copy puts data in the clipboard.
|
// Copy puts data into the clipboard.
|
||||||
Copy (data Data)
|
Copy (data Data)
|
||||||
|
|
||||||
// Paste returns the data currently in the clipboard. This method may
|
// Paste returns the data currently in the clipboard. This method may
|
||||||
|
@ -79,6 +79,21 @@ func (backend *Backend) Do (callback func ()) {
|
|||||||
backend.doChannel <- callback
|
backend.doChannel <- callback
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy puts data into the clipboard. This method is not yet implemented and
|
||||||
|
// will do nothing!
|
||||||
|
func (backend *Backend) Copy (data tomo.Data) {
|
||||||
|
backend.assert()
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paste returns the data currently in the clipboard. This method may
|
||||||
|
// return nil. This method is not yet implemented and will do nothing!
|
||||||
|
func (backend *Backend) Paste () (data tomo.Data) {
|
||||||
|
backend.assert()
|
||||||
|
// TODO
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (backend *Backend) assert () {
|
func (backend *Backend) assert () {
|
||||||
if backend == nil { panic("nil backend") }
|
if backend == nil { panic("nil backend") }
|
||||||
}
|
}
|
||||||
|
17
tomo.go
17
tomo.go
@ -24,6 +24,7 @@ func Stop () {
|
|||||||
// Do executes the specified callback within the main thread as soon as
|
// Do executes the specified callback within the main thread as soon as
|
||||||
// possible. This function can be safely called from other threads.
|
// possible. This function can be safely called from other threads.
|
||||||
func Do (callback func ()) {
|
func Do (callback func ()) {
|
||||||
|
if backend == nil { panic("no backend is running") }
|
||||||
backend.Do(callback)
|
backend.Do(callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,6 +37,18 @@ func NewWindow (width, height int) (window Window, err error) {
|
|||||||
err = errors.New("no backend is running.")
|
err = errors.New("no backend is running.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
window, err = backend.NewWindow(width, height)
|
return backend.NewWindow(width, height)
|
||||||
return
|
}
|
||||||
|
|
||||||
|
// Copy puts data into the clipboard.
|
||||||
|
func Copy (data Data) {
|
||||||
|
if backend == nil { panic("no backend is running") }
|
||||||
|
backend.Copy(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paste returns the data currently in the clipboard. This method may
|
||||||
|
// return nil.
|
||||||
|
func Paste () (data Data) {
|
||||||
|
if backend == nil { panic("no backend is running") }
|
||||||
|
return backend.Paste()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user