Flutter macOS Embedder
FlutterWindowController Class Reference

#import <FlutterWindowController.h>

Inheritance diagram for FlutterWindowController:

Instance Methods

(void) - closeAllWindows
 
(void) - fixMoveRunLoopModeIfNeeded
 

Properties

FlutterEngine * engine
 

Detailed Description

Definition at line 15 of file FlutterWindowController.h.

Method Documentation

◆ closeAllWindows

- (void) closeAllWindows

Definition at line 189 of file FlutterWindowController.mm.

600  {
601  for (FlutterWindowOwner* owner in _windows) {
602  [owner.flutterViewController dispose];
603  [owner.window close];
604  }
605  [_windows removeAllObjects];
606 }

◆ fixMoveRunLoopModeIfNeeded

- (void) fixMoveRunLoopModeIfNeeded

Definition at line 189 of file FlutterWindowController.mm.

310  {
311  if (_runLoopModeFixApplied) {
312  return;
313  }
314  // When modal sheet is presented, for the duration of the animation the run loop
315  // is running in _NSMoveTimerRunLoopMode. This prevents Flutter content from
316  // being rendered. The solution is to add _NSMoveTimerRunLoopMode to common
317  // run loop modes, but referencing it directly may be flagged as SPI usage.
318  // Instead as a workaround a very short window zoom animation is triggered, which
319  // runs in _NSMoveTimerRunLoopMode adding the mode to CFRunLoop all modes list.
320  // After that it can be queried and added to common modes.
321  NSWindow* window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
322  styleMask:NSWindowStyleMaskResizable
323  backing:NSBackingStoreNonretained
324  defer:NO];
327  window.releasedWhenClosed = NO;
328  window.delegate = delegate;
329  window.ignoresMouseEvents = YES;
330  window.alphaValue = 0;
331  [window orderFront:nil];
332  [window zoom:nil];
333  [window close];
334  NSArray* modes = (__bridge_transfer NSArray*)CFRunLoopCopyAllModes(CFRunLoopGetCurrent());
335  for (NSString* mode in modes) {
336  if ([mode hasSuffix:@"MoveTimerRunLoopMode"]) {
337  CFRunLoopAddCommonMode(CFRunLoopGetCurrent(), (__bridge CFStringRef)mode);
338  }
339  }
340  _runLoopModeFixApplied = YES;
341 }

Property Documentation

◆ engine


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