mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
ui/app,apps/gophers,apps/hello: replace CreateWindow with NewWindow
Gio doesn't support multiple windows anyway, so get rid of the app.Windows channel and use NewWindow call for the mobile platforms as well. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+5
-3
@@ -22,10 +22,10 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"gioui.org/ui"
|
||||
"gioui.org/ui/f32"
|
||||
"gioui.org/ui/key"
|
||||
"gioui.org/ui/pointer"
|
||||
"gioui.org/ui"
|
||||
)
|
||||
|
||||
type window struct {
|
||||
@@ -42,6 +42,8 @@ var layerFactory func() uintptr
|
||||
|
||||
var views = make(map[C.CFTypeRef]*window)
|
||||
|
||||
var windows = make(chan *Window)
|
||||
|
||||
func init() {
|
||||
// Darwin requires UI operations happen on the main thread only.
|
||||
runtime.LockOSThread()
|
||||
@@ -233,8 +235,8 @@ func (w *window) setTextInput(s key.TextInputState) {
|
||||
}
|
||||
}
|
||||
|
||||
func createWindow(opts WindowOptions) error {
|
||||
panic("unsupported")
|
||||
func createWindow(opts WindowOptions) (*Window, error) {
|
||||
return <-windows, nil
|
||||
}
|
||||
|
||||
func Main() {
|
||||
|
||||
Reference in New Issue
Block a user