Elias Naur
d86f96503f
app/internal/window: [macOS] fix window sizes for unit.Px values
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-07 17:49:59 +02:00
Elias Naur
c2c31a4d00
app/internal/window: [Windows] support multiple windows
...
Updates gio#19
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-07 16:27:43 +02:00
Elias Naur
65078cdece
app/internal/window: [macOS] simplify NewWindow
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-07 14:48:54 +02:00
Elias Naur
483084f4be
app/internal/window: [macOS] delay window creation until ready
...
Fixes #128
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-07 08:42:36 +02:00
Elias Naur
144a5a9cf5
app/internal/window: [macOS] introduce serious cascading
...
This time without arbitrary offsets and with support for multiple
windows.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-06 19:27:25 +02:00
Elias Naur
4408c2a695
app/internal/window: [macOS] support more than one window
...
Updates #19
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-06 19:09:02 +02:00
Elias Naur
476bf8d263
app/internal/window: [macOS] only terminate app when last window closes
...
Updates #19
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-05 12:10:23 +02:00
Elias Naur
9efdc3409c
app/internal/window: [macOS] remove window reference from app delegate
...
Updates #19
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-05 12:10:23 +02:00
Elias Naur
7c22a888b1
app/internal/window: [macOS] make GioDelegate window-independent
...
Updates #19
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-05 12:10:23 +02:00
Elias Naur
34c212d152
app/internal/window: [macOS] split out gio_createWindow
...
Updates #19
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-05 12:10:23 +02:00
Elias Naur
2accb88381
app/internal/window: [macOS] fix zero-length clipboard reads
...
Fixes #126
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-05 10:09:17 +02:00
Elias Naur
278e9bc334
app/internal/window: [macOS] remove useless retain/release
...
The window and its view is guaranteed to outlast the display link.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-03 21:20:06 +02:00
Elias Naur
c225daa845
app/internal/window: [macOS] use regular map for view-to-window lookups
...
All accesses to the view map now happens on the main thread, so
there is no need for a sync.Map anymore.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-03 21:20:02 +02:00
Elias Naur
cb5cc02560
app/internal/window: [macOS] remove frivolous cascadeTopLeftFromPoint call
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-03 19:13:06 +02:00
Gordon Klaus
e188d0e6ff
io/pointer,gesture,app/internal/window: add pointer.Scroll event type
...
Signed-off-by: Gordon Klaus <gordon.klaus@gmail.com >
2020-06-03 10:08:22 +02:00
Elias Naur
4cb96ccad9
app/internal/window: [macOS] always draw synchronously
...
Asynchronous draws introduces flickering on resizes.
Fixes #123
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-02 15:07:04 +02:00
Elias Naur
f86e1a6421
app/internal/window: [wayland] move listener registration to Go
...
In turns out that only the listener declarations need to be in C, not
the listener registration calls.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-01 21:56:06 +02:00
Elias Naur
6fbcae07cb
app/internal/window: fix multitouch action on Android
...
Fixes #122
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-01 00:04:44 +02:00
Elias Naur
4bf043eb5b
app/internal/window,app/internal/xkb: silence string(int) conversion warnings
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-05-31 11:57:45 +02:00
Elias Naur
1377bea3cd
app/internal/window: [macOS,iOS] reduce display link starting and stopping
...
Recent changes to the macOS threading exposed a problem where a
window's display link may fail to start after being started and stopped
in rapid succession.
Introduce a displayLink type that waits a while after the last stop
request before stopping its display link. That seems to be the way
other projects are using display links.
As a bonus, the new implementation avoids the potentially expensive
overhead of frequent starting and stopping the underlying OS thread.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-05-30 14:42:00 +02:00
Elias Naur
3817941175
app/internal/window: [iOS] move redraw logic to Go
...
We're about to move the display link to common Go code. To do that,
we need the redraw logic in Go as well.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-05-30 14:16:54 +02:00
Elias Naur
266b01bb5d
app/internal/window: [wasm] report key modifiers for pointer events
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-05-27 17:12:11 +02:00
Elias Naur
9da54eac61
app/internal/window: [X11] report key modifiers for pointer events
...
Fixes #120
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-05-27 16:39:24 +02:00
Elias Naur
f6dff2fd1c
app/internal/window,app/internal/xkb: [Wayland] report modifiers for pointer events
...
Updates #120
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-05-27 16:39:07 +02:00
Elias Naur
33146961f4
app/internal/window: [macOS] avoid racy access to window width, height, scale
...
The macOS redraw callback is not invoked on the main thread, so its
access to window fields must be synchronized.
An alternative would be to schedule the asynchronous redraws on the main
thread, but I believe frame callbacks are performance-sensitive enough
to warrant the extra locking complexity.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-05-27 16:12:57 +02:00
Elias Naur
5c6ff659bf
app/internal/window: [macOS] don't call Cococa from non-main thread
...
Only the synchronous draws from the main thread may involve changing
width, height and scale. Introduce cached window.width and window.height
fields and limits updates to main-thread draws.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-05-27 16:07:40 +02:00
Elias Naur
0614bd29d7
app/internal/window: [X11] handle zero-length clipboard writes correctly
...
Fixes gio#118
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-05-21 10:56:36 +02:00
Elias Naur
22b367cb33
app/internal/window: [Android] don't block in runOnMain
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-05-20 20:22:45 +02:00
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
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
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
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
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