Commit Graph

1294 Commits

Author SHA1 Message Date
Elias Naur 59bc001677 app,io/system: implement clipboard reading and writing
The app.ReadClipboard and app.WriteClipboard can be used to interact
with the system clipboard. The clipboard may be asynchronous, so
system.ClipboardEvent is introduced to deliver the result of a read.

Updates gio#31

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 19:12:45 +02:00
Elias Naur f210651b08 app/internal/window,app/internal/windows: implement Windows clipboard access
Update gio#31

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 19:12:45 +02:00
Elias Naur 20fc81a57a app/internal/window: [wasm] implement clipboard
Update gio#31

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 19:12:45 +02:00
Elias Naur 503534e84e app/internal/window: [Android] move main thread dispatching to Go
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 19:12:45 +02:00
Elias Naur bb4a02babc app/internal/window: [iOS] implement clipboard
Updates gio#31

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 19:12:45 +02:00
Elias Naur 7b5a03e0ec app/internal/window: X11 clipboard support
Updates gio#31

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 19:12:45 +02:00
Elias Naur 2da1d37ce7 app: implement Wayland clipboard support
Updates gio#31

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 19:12:45 +02:00
Elias Naur 9534337a43 app/internal/window: macOS clipboard support
Updates gio#31

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur 1e934673d7 app/internal/window: [Android] implement clipboard
Updates gio#31

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur 268e9e44b8 io/system: add ClipboardEvent for sending clipboard updates
Not wired up yet; each platform needs implementing low-level access
first.

Updates gio#31

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur fc0c046cab app/internal/window: [iOS] move main thread dispatch to Go
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur 77899c79d9 app/internal/window: [iOS] fold header files into Go preambles
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur 0da1b1bdbc app/internal/log: fold header file into Go preamble
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur cfc1991ded app/headless: fold header files into Go preambles
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur 5a0d183202 app/internal/window: [Android] fold os_android.h into os_android.go preamble
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur bfbb95674b app/internal/window: [Wayland] fold os_wayland.h into os_wayland.go preamble
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur 10a81bf217 app/internal/window: [macOS] fold header files into Cgo preambles
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur 85a75ee265 app/internal/window: [macOS] move main thread dispatching to Go
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur 65d79f295f app/internal/app: introduce runOnMain for main thread callbacks
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur a3dc2d6cdc app/internal/window: [macOS] run most callbacks on the main thread
Before this change, we had a viewDo that serialized a function on a view
on a single goroutine. For better or worse, most callbacks in Cocoa
happen on the main thread, so we might as well use that.

The only exception is the frame callback from the CADisplayLink.
We could force that through the main thread as well, but for
efficiency settle with making the view-to-window map synchronized.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur 3569b0f31b app/internal/window: [macOS] assume valid view in synchronous draws
Asynchronous drawing happens only in onFrameCallback, where we have to
check for disappearing views. onDraw however, is synchronous and should
always have a valid view.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur bd8757e51f app/internal/window: [X11] make the notification pipe wakeup only
Before, the wakeup pipe both woke the event loop and implied a redraw.
We're going to use the notication for more, so deduce the need for redraw
from window state instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur 4e3bc8f9aa app/clipboard: delete
The implementation was too optimistic: some platforms require a
window context for accessing the clipboard.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 15:43:12 +02:00
Elias Naur 53e3f0027c app: ignore incoming window events to dead windows
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 12:41:41 +02:00
Elias Naur e093ea28f7 app: ensure waiting window requests are stopped when a window closes
The Android RegisterFragment method would leak a goroutine if called
after the window was destroyed.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 12:41:41 +02:00
Elias Naur b99151c211 app/internal/window: [Wayland] make notifications wakeup-only
Before, notifying the event loop implied a redraw. Derive the need
for redrawing expliticly and use the notification pipe for wakeups
only.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 12:09:18 +02:00
Elias Naur f2fee00bab Revert "gesture: only report TypePress for Click gestures if pointer is grabbed"
This reverts commit 062e2bc54b.

Reason: delays the press too much for the common case of an embedding List.
2020-05-16 12:09:18 +02:00
Elias Naur 9259b8f743 app/internal/window: [Wayland] move window-specific resource checks to window
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur 44aec72d42 app/internal/window: [Wayland] move cursor from display to window
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur 9daf082d22 app/internal/window: defer window and display destructors
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur 728c20ab4a app/internal/window: [Wayland] move event processing to wlDisplay
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur 26641344bc app/internal/window: [Wayland] move notification channel to wlDisplay
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur 55881fc09c app/internal/window: [Wayland] remove redundant event dispatch
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur 28a3de6e32 app/internal/window: [Wayland] delete unused field
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur 0181f22d01 app/internal/window: block Main until all windows are closed
With this change, the Wayland backend now supports multiple windows.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur cf72e684b6 app/internal/window: use a sync.Map for callback references
Multiple Wayland windows are now separate, except for the global callback
reference map. Use a sync.Map to support multiple concurrent windows.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur 0aa7d4ab3f app/internal/window: [Wayland] move outputMap and outputConfig to wlDisplay
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur 1a48b5c33c app/internal/window: [Wayland] use a single callback entry for each object
The callbackMap is used to look up Go references in event callbacks. Instead
of registering one entry for each possible callback type, use a single
handle for each Go reference.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur bf129ca989 app/internal/window: get rid of the global Wayland display
Instead, create a display for each window.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur 3e648715db app/internal/window: rename wlConn to wlDisplay
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur bc645c3ca4 app/internal/window: [Wayland] introduce wlSeat for seat-specific state
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur fd6f6c4485 app: move GPU context validation and retry logic to separate method
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur 56dbaf326a app: move frame waiting code out of Window.run to a separate method
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-16 11:01:19 +02:00
Elias Naur db0af521d0 app/internal/window: move Wayland callback structs into function scope
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-15 12:14:17 +02:00
Elias Naur 31acd5451e op/paint: further clarify PaintOp documentation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-14 13:44:36 +02:00
Elias Naur 29c9b06dab op/paint: document ImageOp gotcha
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-14 13:31:21 +02:00
Elias Naur b7ba809517 op/paint: rename material to brush
The "material" name clashes with the theme of the same name.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-14 13:19:15 +02:00
Elias Naur 81f474f5d7 op/paint,io/system: document ImageOp lifetime
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-14 13:15:05 +02:00
Elias Naur 391b89d11d example/glfw: add package documentation and link to installation
Fixes #114

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-14 11:12:39 +02:00
Elias Naur f16e8fd122 app: update package documentation
Reflect the move of Queue from Window to FrameEvent.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-14 10:11:18 +02:00