Larry Clapp
602d54dc5e
app,app/internal/window: [macOS] add app.Window.Close for closing a window
...
Recently support was added for multiple top-level windows. Add support
for closing those windows.
macOS only; all others stubbed out.
Signed-off-by: Larry Clapp <larry@theclapp.org >
2020-06-18 14:46:58 +02:00
Elias Naur
596e321610
all: make unit.Converter concrete and rename to Metric
...
An interface for scaling dp and sp is overkill, at least for all
current uses. Make it a concrete struct type, and rename it to the
shorter and more precise Metric.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-17 11:47:14 +02:00
Jason
a3f7eaae08
app/internal/window: set WM_CLASS to binary name
...
WM_CLASS is used by Linux desktops to provide hints for window
grouping, icons to show and startup notifications.
https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html
This patch set the WM_CLASS to the binary name.
Signed-off-by: Jason <sourcehut@sweatyballs.es >
2020-06-16 16:15:36 +02:00
Elias Naur
04e605c1b2
app/internal/window: [Android] implement scroll factor fallback for < API 26
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-15 13:40:13 +02:00
Elias Naur
feacd1e2df
app/internal/window: [Android] implement mouse scrolling
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-13 18:52:29 +02:00
Elias Naur
8688ed95c2
app/internal/window: [Android] replace RegisterFragment with Do
...
Do is a function for accessing the underlying Android View in a safe
context, the main thread. Do is
- more general than RegisterFragment and may be expanded to other platforms
- simpler to implement (from the Gio side)
and as a bonus, the Do implementation avoids a race condition where
a call to RegisterFragment during an Activity re-create would be ignored.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-13 17:47:58 +02:00
Elias Naur
f36674ddb3
app/internal/window: [Android] make runOnThread independent of a valid GioView
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-13 17:47:58 +02:00
Elias Naur
2f521899c9
app/internal/window: [Android] use app context for clipboard access
...
The Activity context may not be available, so it's safer and simpler
to use the always available app context.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-13 16:41:28 +02:00
Elias Naur
65d9a9d1f1
app/internal/window: [Android] skip redraw for destroyed views
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-13 16:41:28 +02:00
Elias Naur
6d5fbcba3f
app/internal/window: [Android] unregister focus listener on destroy
...
Updates github.com/tailscale/tailscale/issues/431
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-11 15:39:33 +02:00
Elias Naur
6380baacb6
all: move Now from system.Config to system.FrameEvent
...
Then, make layout.Context.Now a field, copied from FrameEvent.Now.
API change:
gofmt -r 'gtx.Now() -> gtx.Now'
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-09 23:23:08 +02:00
Elias Naur
6f15275e22
app/internal/window: [macOS] retain NSWindow instance
...
Updates (maybe fixes) #130
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-08 17:54:44 +02:00
Elias Naur
98a603aed6
app/internal/window: [macOS] don't set callbacks before window is ready
...
Updates gio#130
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-08 16:34:10 +02:00
Elias Naur
64a516d7c9
app/internal/window: [Windows] avoid race between Main and window closes
...
While here, replace the window hwnd-to-window map with a sync.Map.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2020-06-08 11:39:40 +02:00
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