Revert "ui/app,apps: unexport ChangeStage and Stage"

I found a convincing use case: stopping asynchronous activities
while paused. A follow up change will rename the stages and add
an example.

This reverts commit f9840b0963.
This commit is contained in:
Elias Naur
2019-05-12 14:47:38 +02:00
parent af7a0ad293
commit 4441a3e13e
8 changed files with 62 additions and 57 deletions
+10 -10
View File
@@ -38,7 +38,7 @@ type window struct {
dpi int
fontScale float32
stage stage
stage Stage
started bool
mu sync.Mutex
@@ -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(StageInvisible)
return handle
}
@@ -104,7 +104,7 @@ func onCreateView(env *C.JNIEnv, class C.jclass, view C.jobject) C.jlong {
func onDestroyView(env *C.JNIEnv, class C.jclass, handle C.jlong) {
w := views[handle]
delete(views, handle)
w.setStage(stageDead)
w.setStage(StageDead)
C.gio_jni_DeleteGlobalRef(env, w.view)
w.view = 0
}
@@ -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(StageInvisible)
}
//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(StageInvisible)
}
//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 >= StageVisible {
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 < StageVisible {
return
}
w.mu.Lock()
@@ -197,16 +197,16 @@ func (w *window) setVisible() {
if width == 0 || height == 0 {
return
}
w.setStage(stageVisible)
w.setStage(StageVisible)
w.draw(true)
}
func (w *window) setStage(stage stage) {
func (w *window) setStage(stage Stage) {
if stage == w.stage {
return
}
w.stage = stage
w.event(changeStage{stage})
w.event(ChangeStage{stage})
}
func (w *window) display() unsafe.Pointer {