Flutter macOS Embedder
FlutterWindowController Class Reference

#import <FlutterWindowController.h>

Inheritance diagram for FlutterWindowController:

Instance Methods

(void) - closeAllWindows
 
(void) - fixMoveRunLoopModeIfNeeded
 

Properties

FlutterEngineengine
 

Detailed Description

Definition at line 15 of file FlutterWindowController.h.

Method Documentation

◆ closeAllWindows

- (void) closeAllWindows

Definition at line 187 of file FlutterWindowController.mm.

538  {
539  for (FlutterWindowOwner* owner in _windows) {
540  [owner.flutterViewController dispose];
541  [owner.window close];
542  }
543  [_windows removeAllObjects];
544 }

◆ fixMoveRunLoopModeIfNeeded

- (void) fixMoveRunLoopModeIfNeeded

Definition at line 187 of file FlutterWindowController.mm.

291  {
292  if (_runLoopModeFixApplied) {
293  return;
294  }
295  // When modal sheet is presented, for the duration of the animation the run loop
296  // is running in _NSMoveTimerRunLoopMode. This prevents Flutter content from
297  // being rendered. The solution is to add _NSMoveTimerRunLoopMode to common
298  // run loop modes, but referencing it directly may be flagged as SPI usage.
299  // Instead as a workaround a very short window zoom animation is triggered, which
300  // runs in _NSMoveTimerRunLoopMode adding the mode to CFRunLoop all modes list.
301  // After that it can be queried and added to common modes.
302  NSWindow* window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
303  styleMask:NSWindowStyleMaskResizable
304  backing:NSBackingStoreNonretained
305  defer:NO];
308  window.releasedWhenClosed = NO;
309  window.delegate = delegate;
310  window.ignoresMouseEvents = YES;
311  window.alphaValue = 0;
312  [window orderFront:nil];
313  [window zoom:nil];
314  [window close];
315  NSArray* modes = (__bridge_transfer NSArray*)CFRunLoopCopyAllModes(CFRunLoopGetCurrent());
316  for (NSString* mode in modes) {
317  if ([mode hasSuffix:@"MoveTimerRunLoopMode"]) {
318  CFRunLoopAddCommonMode(CFRunLoopGetCurrent(), (__bridge CFStringRef)mode);
319  }
320  }
321  _runLoopModeFixApplied = YES;
322 }

Property Documentation

◆ engine


The documentation for this class was generated from the following files: