io/clipboard,app: add WriteOp, ReadOp

Previously, the only way to manipulate the clipboard (read or write) is
using the `app.Window`.

The new `clipboard.ReadOp` and `clipboard.WriteOp`makes possible to
read/write from the widget.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
Inkeliz
2020-12-06 20:17:25 +00:00
committed by Elias Naur
parent 4e2d08c0a6
commit a76f816ae9
6 changed files with 279 additions and 1 deletions
+6
View File
@@ -168,6 +168,12 @@ func (w *Window) processFrame(frameStart time.Time, size image.Point, frame *op.
case router.TextInputClose:
w.driver.ShowTextInput(false)
}
if txt, ok := w.queue.q.WriteClipboard(); ok {
go w.WriteClipboard(txt)
}
if w.queue.q.ReadClipboard() {
go w.ReadClipboard()
}
if w.queue.q.Profiling() {
frameDur := time.Since(frameStart)
frameDur = frameDur.Truncate(100 * time.Microsecond)