app,app/internal/wm: [macOS] refresh context on display change

The NSViewGlobalFrameDidChangeNotification notification is documented to
be fired every time [NSOpenGLContext update] needs to be called.
However, the notification fails to fire on my setup when a window is
moved to a display with a different pixel scale, which leads to
incorrectly sized output.

This change gets rid of the notification and updates the context before
every frame.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-06-12 19:27:48 +02:00
parent 9b5e9ae607
commit 0e592f8bc6
13 changed files with 60 additions and 24 deletions
+8 -2
View File
@@ -414,6 +414,12 @@ func (w *Window) destroy(err error) {
}
}
func (w *Window) refresh() {
w.driverRun(func(_ wm.Driver) {
w.loop.Refresh()
})
}
func (w *Window) destroyGPU() {
if w.loop != nil {
w.loop.Release()
@@ -473,7 +479,7 @@ func (w *Window) run(opts *wm.Options) {
if e2.Stage < system.StageRunning {
w.destroyGPU()
} else {
w.loop.Refresh()
w.refresh()
}
}
w.stage = e2.Stage
@@ -495,7 +501,7 @@ func (w *Window) run(opts *wm.Options) {
w.out <- e2.FrameEvent
if w.loop != nil {
if e2.Sync {
w.loop.Refresh()
w.refresh()
}
}
frame, gotFrame := w.waitFrame()