mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
+8
-2
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user