internal/ui: refactoring: simplify ResetForFrame

Updating the layout is already done every frame, so doing this in
ResetForFrame is not needed.

Updates #490
This commit is contained in:
Hajime Hoshi 2022-02-13 19:31:23 +09:00
parent 7b164882fc
commit 6a8e45e6c1
3 changed files with 1 additions and 10 deletions

View File

@ -1350,12 +1350,6 @@ func (u *UserInterface) IsScreenTransparent() bool {
}
func (u *UserInterface) ResetForFrame() {
// The offscreens must be updated every frame (#490).
var w, h float64
u.t.Call(func() {
w, h = u.updateSize()
})
u.context.layout(w, h)
u.input.resetForFrame()
u.m.Lock()

View File

@ -637,7 +637,6 @@ func (u *UserInterface) IsScreenTransparent() bool {
}
func (u *UserInterface) ResetForFrame() {
u.updateSize()
u.input.resetForFrame()
}

View File

@ -290,8 +290,6 @@ func (u *UserInterface) run(context Context, mainloop bool) (err error) {
<-u.setGBuildSizeCh
}
// Force to set the screen size
u.layoutIfNeeded()
for {
if err := u.update(); err != nil {
return err
@ -330,6 +328,7 @@ func (u *UserInterface) update() error {
renderEndCh <- struct{}{}
}()
u.layoutIfNeeded()
if err := u.context.updateFrame(deviceScale()); err != nil {
return err
}
@ -433,7 +432,6 @@ func (u *UserInterface) IsScreenTransparent() bool {
}
func (u *UserInterface) ResetForFrame() {
u.layoutIfNeeded()
u.input.resetForFrame()
}