mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 15:45:38 +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:
@@ -17,6 +17,7 @@ type renderLoop struct {
|
||||
drawing bool
|
||||
err error
|
||||
|
||||
ctx wm.Context
|
||||
frames chan frame
|
||||
results chan frameResult
|
||||
refresh chan struct{}
|
||||
@@ -38,6 +39,7 @@ type frameResult struct {
|
||||
|
||||
func newLoop(ctx wm.Context) (*renderLoop, error) {
|
||||
l := &renderLoop{
|
||||
ctx: ctx,
|
||||
frames: make(chan frame),
|
||||
results: make(chan frameResult),
|
||||
refresh: make(chan struct{}),
|
||||
@@ -132,6 +134,7 @@ func (l *renderLoop) Summary() string {
|
||||
}
|
||||
|
||||
func (l *renderLoop) Refresh() {
|
||||
l.ctx.Refresh()
|
||||
if l.err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user