app,app/internal/wm: fold context MakeCurrent/ReleaseCurrent into Lock/Unlock

While here, make context Refresh useful and remove the redundant
MakeCurrent from the window loop.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-08-04 12:03:04 +02:00
parent 4dd6a50670
commit 0bdc2e0432
11 changed files with 83 additions and 132 deletions
+6 -14
View File
@@ -149,6 +149,7 @@ func (w *Window) validateAndProcess(driver wm.Driver, frameStart time.Time, size
if err != nil {
return err
}
sync = true
}
w.loop, err = newLoop(w.ctx)
if err != nil {
@@ -156,6 +157,11 @@ func (w *Window) validateAndProcess(driver wm.Driver, frameStart time.Time, size
return err
}
}
if sync && w.ctx != nil {
w.driverRun(func(_ wm.Driver) {
w.ctx.Refresh()
})
}
w.processFrame(frameStart, size, frame)
if sync && w.loop != nil {
if err := w.loop.Flush(); err != nil {
@@ -416,13 +422,6 @@ func (w *Window) destroy(err error) {
}
}
func (w *Window) refresh() {
w.driverRun(func(_ wm.Driver) {
w.ctx.Refresh()
})
w.loop.Refresh()
}
func (w *Window) destroyGPU() {
if w.loop != nil {
w.loop.Release()
@@ -484,8 +483,6 @@ func (w *Window) run(opts *wm.Options) {
w.loop.Release()
w.loop = nil
}
} else {
w.refresh()
}
}
w.stage = e2.Stage
@@ -505,11 +502,6 @@ func (w *Window) run(opts *wm.Options) {
e2.Frame = w.update
e2.Queue = &w.queue
w.out <- e2.FrameEvent
if w.loop != nil {
if e2.Sync {
w.refresh()
}
}
frame, gotFrame := w.waitFrame()
err := w.validateAndProcess(driver, frameStart, e2.Size, e2.Sync, frame)
if gotFrame {