Skip to content

Commit 15e0965

Browse files
committed
Suppress scaler auto-resize in fullscreen via the AppKit query
cocoadisplay_resize_window read settings_current.full_screen twice to skip the resize when the window is fullscreen — once on the caller's thread (worker or main) and again after dispatching to main. The authoritative fullscreen state lives in NSWindow's styleMask, which is main-thread-only. Drop the pre-dispatch check and let the main-thread block be the sole gate. The cost is one extra cheap dispatch when the resize is going to be skipped anyway; the win is one fewer read of a mirrored flag whose only purpose was thread-safe access from worker code.
1 parent f8324c1 commit 15e0965

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

ui/cocoa/cocoadisplay.m

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,20 +244,22 @@ Callers may be on a worker thread (fuse_init runs on the emulator thread
244244
{
245245
/* Startup applies the saved scaler before the first rendered frame; let
246246
AppKit keep the restored window frame until emulation is visibly running. */
247-
if( !display_ui_initialised || !window_resize_enabled ||
248-
settings_current.full_screen ) return;
247+
if( !display_ui_initialised || !window_resize_enabled ) return;
249248

250249
float factor = scaler_get_scaling_factor( current_scaler );
251250
NSSize size = NSMakeSize( image_width * factor, image_height * factor );
252251

253252
dispatch_async( dispatch_get_main_queue(), ^{
254-
/* Re-check after the hop in case the user entered fullscreen between
255-
enqueue and execute. */
256-
if( settings_current.full_screen ) return;
253+
NSWindow *win = [[DisplayOpenGLView instance] window];
254+
/* AppKit's fullscreen Space owns the window frame; application code
255+
cannot resize a fullscreen window. The pre-dispatch check was
256+
previously a worker-thread-safe read of a mirrored flag; the
257+
authoritative state lives in the window's styleMask, which must be
258+
read on main. */
259+
if( ( [win styleMask] & NSWindowStyleMaskFullScreen ) != 0 ) return;
257260

258261
/* Preserve the window's perceived centre; setContentSize: would anchor
259262
the top-left and drift the centre across repeated scaler changes. */
260-
NSWindow *win = [[DisplayOpenGLView instance] window];
261263
NSRect old = [win frame];
262264
NSRect frame = [win frameRectForContentRect:
263265
NSMakeRect( 0, 0, size.width, size.height )];

0 commit comments

Comments
 (0)