Refactor fullscreen exit handling to ensure frame constraint suppression is lifted consistently after a delay
This commit is contained in:
@@ -804,18 +804,17 @@ static void update_titlebar_button_visibility_after_fullscreen_transition(_GLFWw
|
|||||||
for (_GLFWwindow *ww = _glfw.windowListHead; ww; ww = ww->next) {
|
for (_GLFWwindow *ww = _glfw.windowListHead; ww; ww = ww->next) {
|
||||||
if (ww->id == wid) { w = ww; break; }
|
if (ww->id == wid) { w = ww; break; }
|
||||||
}
|
}
|
||||||
if (!w) return;
|
if (w) {
|
||||||
NSWindow *nswindow = w->ns.object;
|
NSWindow *nswindow = w->ns.object;
|
||||||
@try {
|
|
||||||
[nswindow setStyleMask: savedMask];
|
[nswindow setStyleMask: savedMask];
|
||||||
[nswindow setFrame: savedFrame display:YES];
|
[nswindow setFrame: savedFrame display:YES];
|
||||||
update_titlebar_button_visibility_after_fullscreen_transition(w, true, false);
|
update_titlebar_button_visibility_after_fullscreen_transition(w, true, false);
|
||||||
[nswindow makeFirstResponder:w->ns.view];
|
[nswindow makeFirstResponder:w->ns.view];
|
||||||
NSNotification *resize = [NSNotification notificationWithName:NSWindowDidResizeNotification object:nswindow];
|
NSNotification *resize = [NSNotification notificationWithName:NSWindowDidResizeNotification object:nswindow];
|
||||||
[w->ns.delegate performSelector:@selector(windowDidResize:) withObject:resize afterDelay:0];
|
[w->ns.delegate performSelector:@selector(windowDidResize:) withObject:resize afterDelay:0];
|
||||||
} @finally {
|
}
|
||||||
// Keep suppressing constraints to block deferred macOS tiling
|
// Lift the constraint guard after a delay, even if the window
|
||||||
// repositioning, then lift the guard. The delay is empirical (#9572).
|
// was not found (destroyed), to keep the flag consistent (#9572).
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(500 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(500 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{
|
||||||
_GLFWwindow *w2 = NULL;
|
_GLFWwindow *w2 = NULL;
|
||||||
for (_GLFWwindow *ww = _glfw.windowListHead; ww; ww = ww->next) {
|
for (_GLFWwindow *ww = _glfw.windowListHead; ww; ww = ww->next) {
|
||||||
@@ -823,7 +822,6 @@ static void update_titlebar_button_visibility_after_fullscreen_transition(_GLFWw
|
|||||||
}
|
}
|
||||||
if (w2) w2->ns.suppress_frame_constraints = false;
|
if (w2) w2->ns.suppress_frame_constraints = false;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user