From e2a1f07b8497a325115bcd58cd453a5045d8353c Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 12 May 2019 14:59:07 +0200 Subject: [PATCH] ui/app: rename StageVisible and StageInvisible StageRunning and StagePaused better reflect their use. Signed-off-by: Elias Naur --- ui/app/app.go | 12 ++++++------ ui/app/os_android.go | 12 ++++++------ ui/app/os_ios.go | 6 +++--- ui/app/os_js.go | 2 +- ui/app/os_macos.go | 6 +++--- ui/app/os_wayland.go | 6 +++--- ui/app/os_windows.go | 6 +++--- ui/app/window.go | 10 +++++----- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/ui/app/app.go b/ui/app/app.go index 7342976e..5baf2ae9 100644 --- a/ui/app/app.go +++ b/ui/app/app.go @@ -43,8 +43,8 @@ type Input interface { const ( StageDead Stage = iota - StageInvisible - StageVisible + StagePaused + StageRunning ) const ( @@ -101,10 +101,10 @@ func (l Stage) String() string { switch l { case StageDead: return "StageDead" - case StageInvisible: - return "StageInvisible" - case StageVisible: - return "StageVisible" + case StagePaused: + return "StagePaused" + case StageRunning: + return "StageRunning" default: panic("unexpected Stage value") } diff --git a/ui/app/os_android.go b/ui/app/os_android.go index afa883b7..c86bff19 100644 --- a/ui/app/os_android.go +++ b/ui/app/os_android.go @@ -96,7 +96,7 @@ func onCreateView(env *C.JNIEnv, class C.jclass, view C.jobject) C.jlong { views[handle] = w w.loadConfig(env, class) windows <- ow - w.setStage(StageInvisible) + w.setStage(StagePaused) return handle } @@ -113,7 +113,7 @@ func onDestroyView(env *C.JNIEnv, class C.jclass, handle C.jlong) { func onStopView(env *C.JNIEnv, class C.jclass, handle C.jlong) { w := views[handle] w.started = false - w.setStage(StageInvisible) + w.setStage(StagePaused) } //export onStartView @@ -131,7 +131,7 @@ func onSurfaceDestroyed(env *C.JNIEnv, class C.jclass, handle C.jlong) { w.mu.Lock() w.win = nil w.mu.Unlock() - w.setStage(StageInvisible) + w.setStage(StagePaused) } //export onSurfaceChanged @@ -155,7 +155,7 @@ func onLowMemory() { func onConfigurationChanged(env *C.JNIEnv, class C.jclass, view C.jlong) { w := views[view] w.loadConfig(env, class) - if w.stage >= StageVisible { + if w.stage >= StageRunning { w.draw(true) } } @@ -166,7 +166,7 @@ func onFrameCallback(env *C.JNIEnv, class C.jclass, view C.jlong, nanos C.jlong) if !exist { return } - if w.stage < StageVisible { + if w.stage < StageRunning { return } w.mu.Lock() @@ -197,7 +197,7 @@ func (w *window) setVisible() { if width == 0 || height == 0 { return } - w.setStage(StageVisible) + w.setStage(StageRunning) w.draw(true) } diff --git a/ui/app/os_ios.go b/ui/app/os_ios.go index 6a3f40f5..2d5f2401 100644 --- a/ui/app/os_ios.go +++ b/ui/app/os_ios.go @@ -59,7 +59,7 @@ func onCreate(view C.CFTypeRef) { C.gio_addLayerToView(view, w.layer) views[view] = w windows <- ow - w.w.event(ChangeStage{StageInvisible}) + w.w.event(ChangeStage{StagePaused}) } //export onDraw @@ -72,7 +72,7 @@ func onDraw(view C.CFTypeRef, dpi, sdpi, width, height C.CGFloat, sync C.int) { w.visible.Store(true) C.gio_updateView(view, w.layer) if !wasVisible { - w.w.event(ChangeStage{StageVisible}) + w.w.event(ChangeStage{StageRunning}) } isSync := false if sync != 0 { @@ -96,7 +96,7 @@ func onDraw(view C.CFTypeRef, dpi, sdpi, width, height C.CGFloat, sync C.int) { func onStop(view C.CFTypeRef) { w := views[view] w.visible.Store(false) - w.w.event(ChangeStage{StageInvisible}) + w.w.event(ChangeStage{StagePaused}) } //export onDestroy diff --git a/ui/app/os_js.go b/ui/app/os_js.go index fc32dfda..4673ee95 100644 --- a/ui/app/os_js.go +++ b/ui/app/os_js.go @@ -56,7 +56,7 @@ func createWindow(opts *WindowOptions) error { w.w = newWindow(w) go func() { windows <- w.w - w.w.event(ChangeStage{StageVisible}) + w.w.event(ChangeStage{StageRunning}) w.draw(true) select {} w.cleanup() diff --git a/ui/app/os_macos.go b/ui/app/os_macos.go index 63960ef3..006c50fb 100644 --- a/ui/app/os_macos.go +++ b/ui/app/os_macos.go @@ -134,7 +134,7 @@ func (w *window) draw(sync bool) { } cfg := getConfig() cfg.Now = time.Now() - w.setStage(StageVisible) + w.setStage(StageRunning) w.w.event(Draw{ Size: image.Point{ X: width, @@ -168,13 +168,13 @@ func gio_onTerminate(view C.CFTypeRef) { //export gio_onHide func gio_onHide(view C.CFTypeRef) { w := views[view] - w.setStage(StageInvisible) + w.setStage(StagePaused) } //export gio_onShow func gio_onShow(view C.CFTypeRef) { w := views[view] - w.setStage(StageVisible) + w.setStage(StageRunning) } //export gio_onCreate diff --git a/ui/app/os_wayland.go b/ui/app/os_wayland.go index fa2ac278..7e4f38cd 100644 --- a/ui/app/os_wayland.go +++ b/ui/app/os_wayland.go @@ -157,7 +157,7 @@ func createWindow(opts *WindowOptions) error { } go func() { windows <- w.w - w.setStage(StageVisible) + w.setStage(StageRunning) w.loop() w.destroy() conn.destroy() @@ -935,9 +935,9 @@ func (w *window) updateOutputs() { } w.mu.Unlock() if !found { - w.setStage(StageInvisible) + w.setStage(StagePaused) } else { - w.setStage(StageVisible) + w.setStage(StageRunning) w.draw(true) } } diff --git a/ui/app/os_windows.go b/ui/app/os_windows.go index 7ce3a5f2..53740209 100644 --- a/ui/app/os_windows.go +++ b/ui/app/os_windows.go @@ -239,7 +239,7 @@ func createNativeWindow(opts *WindowOptions) (*window, error) { } w := &window{ hwnd: hwnd, - stage: StageInvisible, + stage: StagePaused, } winMap[hwnd] = w w.hdc, err = getDC(hwnd) @@ -324,9 +324,9 @@ func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr case _WM_SIZE: switch wParam { case _SIZE_MINIMIZED: - w.setStage(StageInvisible) + w.setStage(StagePaused) case _SIZE_MAXIMIZED, _SIZE_RESTORED: - w.setStage(StageVisible) + w.setStage(StageRunning) w.draw(true) } } diff --git a/ui/app/window.go b/ui/app/window.go index 001ffc85..0f60a933 100644 --- a/ui/app/window.go +++ b/ui/app/window.go @@ -62,7 +62,7 @@ func newWindow(nw *window) *Window { w := &Window{ driver: nw, events: make(chan Event), - stage: StageInvisible, + stage: StagePaused, } return w } @@ -103,7 +103,7 @@ func (w *Window) Draw(root *ui.Ops) { w.hasNextFrame = false w.syncGPU = false w.mu.Unlock() - if stage < StageVisible { + if stage < StageRunning { return } if w.gpu != nil { @@ -176,7 +176,7 @@ func (w *Window) updateAnimation() { w.mu.Lock() defer w.mu.Unlock() animate := false - if w.stage >= StageVisible && w.hasNextFrame { + if w.stage >= StageRunning && w.hasNextFrame { if dt := time.Until(w.nextFrame); dt <= 0 { animate = true } else { @@ -244,7 +244,7 @@ func (w *Window) event(e Event) { if e.Size == (image.Point{}) { panic(errors.New("internal error: zero-sized Draw")) } - if w.stage < StageVisible { + if w.stage < StageRunning { // No drawing if not visible. break } @@ -270,7 +270,7 @@ func (w *Window) event(e Event) { w.syncGPU = false w.mu.Unlock() switch { - case stage < StageVisible: + case stage < StageRunning: w.gpu.Release() w.gpu = nil case sync: