| Flutter macOS Embedder |

Classes | Functions
FlutterWindowController.h File Reference
`#import <Cocoa/Cocoa.h>`
`#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h"`
`#import "flutter/shell/platform/darwin/macos/framework/Headers/FlutterViewController.h"`

Go to the source code of this file.

## Classes
class | FlutterWindowController
struct | FlutterWindowRect
struct | FlutterWindowSize
struct | FlutterWindowOffset
struct | FlutterWindowConstraints
struct | FlutterWindowCreationRequest

## Functions
FLUTTER_DARWIN_EXPORT int64_t | InternalFlutter_WindowController_CreateRegularWindow (int64_t engine_id, const FlutterWindowCreationRequest *request)
FLUTTER_DARWIN_EXPORT int64_t | InternalFlutter_WindowController_CreateDialogWindow (int64_t engine_id, const FlutterWindowCreationRequest *request)
FLUTTER_DARWIN_EXPORT int64_t | InternalFlutter_WindowController_CreateTooltipWindow (int64_t engine_id, const FlutterWindowCreationRequest *request)
FLUTTER_DARWIN_EXPORT int64_t | InternalFlutter_WindowController_CreatePopupWindow (int64_t engine_id, const FlutterWindowCreationRequest *request)
FLUTTER_DARWIN_EXPORT void | InternalFlutter_Window_Destroy (int64_t engine_id, void *window)
FLUTTER_DARWIN_EXPORT void * | InternalFlutter_Window_GetHandle (int64_t engine_id, FlutterViewIdentifier view_id)
FLUTTER_DARWIN_EXPORT FlutterWindowSize | InternalFlutter_Window_GetContentSize (void *window)
FLUTTER_DARWIN_EXPORT void | InternalFlutter_Window_SetContentSize (void *window, const FlutterWindowSize *size)
FLUTTER_DARWIN_EXPORT void | InternalFlutter_Window_SetConstraints (void *window, const FlutterWindowConstraints *constraints)
FLUTTER_DARWIN_EXPORT void | InternalFlutter_Window_SetTitle (void *window, const char *title)
FLUTTER_DARWIN_EXPORT void | InternalFlutter_Window_SetMaximized (void *window, bool maximized)
FLUTTER_DARWIN_EXPORT bool | InternalFlutter_Window_IsMaximized (void *window)
FLUTTER_DARWIN_EXPORT void | InternalFlutter_Window_Minimize (void *window)
FLUTTER_DARWIN_EXPORT void | InternalFlutter_Window_Unminimize (void *window)
FLUTTER_DARWIN_EXPORT bool | InternalFlutter_Window_IsMinimized (void *window)
FLUTTER_DARWIN_EXPORT void | InternalFlutter_Window_SetFullScreen (void *window, bool fullScreen)
FLUTTER_DARWIN_EXPORT bool | InternalFlutter_Window_IsFullScreen (void *window)
FLUTTER_DARWIN_EXPORT void | InternalFlutter_Window_Activate (void *window)
FLUTTER_DARWIN_EXPORT char * | InternalFlutter_Window_GetTitle (void *window)
FLUTTER_DARWIN_EXPORT bool | InternalFlutter_Window_IsActivated (void *window)
FLUTTER_DARWIN_EXPORT void | InternalFlutter_Window_UpdatePosition (void *window)
FLUTTER_DARWIN_EXPORT FlutterWindowOffset | InternalFlutter_Window_GetOffsetInParent (void *window)

## Function Documentation

## ◆ InternalFlutter_Window_Activate()

FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_Activate | ( | void * | window | ) |

Definition at line 637 of file FlutterWindowController.mm.

637 {
638 NSWindow* w = (__bridge NSWindow*)window;
639 [NSApplication.sharedApplication activateIgnoringOtherApps:YES];
640 [w makeKeyAndOrderFront:nil];
641 }

## ◆ InternalFlutter_Window_Destroy()

FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_Destroy | ( | int64_t | engine_id,
|  | void * | window
| ) |  |

Definition at line 554 of file FlutterWindowController.mm.

554 {
555 NSWindow* w = (__bridge NSWindow*)window;
556 FlutterEngine* engine = [FlutterEngine engineForIdentifier:engine_id];
557 [engine.windowController destroyWindow:w];
558 }
FlutterEngine
Definition: FlutterEngine.h:32

References FlutterWindowController::engine.

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutter_Window_GetContentSize()

FLUTTER_DARWIN_EXPORT FlutterWindowSize InternalFlutter_Window_GetContentSize | ( | void * | window | ) |

Definition at line 566 of file FlutterWindowController.mm.

566 {
567 NSWindow* w = (__bridge NSWindow*)window;
568 NSRect contentRect = [w contentRectForFrameRect:w.frame];
569 return {
570 .width = contentRect.size.width,
571 .height = contentRect.size.height,
572 };
573 }

References FlutterWindowSize::width.

## ◆ InternalFlutter_Window_GetHandle()

FLUTTER_DARWIN_EXPORT void* InternalFlutter_Window_GetHandle | ( | int64_t | engine_id,
|  | FlutterViewIdentifier | view_id
| ) |  |

Definition at line 560 of file FlutterWindowController.mm.

560 {
561 FlutterEngine* engine = [FlutterEngine engineForIdentifier:engine_id];
562 FlutterViewController* controller = [engine viewControllerForIdentifier:view_id];
563 return (__bridge void*)controller.view.window;
564 }
FlutterViewController
Definition: FlutterViewController.h:73

References FlutterWindowController::engine.

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutter_Window_GetOffsetInParent()

FLUTTER_DARWIN_EXPORT FlutterWindowOffset InternalFlutter_Window_GetOffsetInParent | ( | void * | window | ) |

Definition at line 659 of file FlutterWindowController.mm.

659 {
660 NSWindow* w = (__bridge NSWindow*)window;
661 NSWindow* parent = w.parentWindow;
662 if (!parent) {
663 return {0, 0};
664 }
665 NSRect globalScreenFrame = ComputeGlobalScreenFrame();
666
667 NSRect parentRect = [parent contentRectForFrameRect:parent.frame];
668 FlipRect(parentRect, globalScreenFrame);
669
670 NSRect childRect = w.frame;
671 FlipRect(childRect, globalScreenFrame);
672
673 return {
674 .x = childRect.origin.x - parentRect.origin.x,
675 .y = childRect.origin.y - parentRect.origin.y,
676 };
677 }

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutter_Window_GetTitle()

FLUTTER_DARWIN_EXPORT char* InternalFlutter_Window_GetTitle | ( | void * | window | ) |

Definition at line 643 of file FlutterWindowController.mm.

643 {
644 NSWindow* w = (__bridge NSWindow*)window;
645 return strdup(w.title.UTF8String);
646 }

## ◆ InternalFlutter_Window_IsActivated()

FLUTTER_DARWIN_EXPORT bool InternalFlutter_Window_IsActivated | ( | void * | window | ) |

Definition at line 648 of file FlutterWindowController.mm.

648 {
649 NSWindow* w = (__bridge NSWindow*)window;
650 return w.isKeyWindow;
651 }

## ◆ InternalFlutter_Window_IsFullScreen()

FLUTTER_DARWIN_EXPORT bool InternalFlutter_Window_IsFullScreen | ( | void * | window | ) |

Definition at line 632 of file FlutterWindowController.mm.

632 {
633 NSWindow* w = (__bridge NSWindow*)window;
634 return (w.styleMask & NSWindowStyleMaskFullScreen) != 0;
635 }

## ◆ InternalFlutter_Window_IsMaximized()

FLUTTER_DARWIN_EXPORT bool InternalFlutter_Window_IsMaximized | ( | void * | window | ) |

Definition at line 602 of file FlutterWindowController.mm.

602 {
603 NSWindow* w = (__bridge NSWindow*)window;
604 return w.isZoomed;
605 }

## ◆ InternalFlutter_Window_IsMinimized()

FLUTTER_DARWIN_EXPORT bool InternalFlutter_Window_IsMinimized | ( | void * | window | ) |

Definition at line 617 of file FlutterWindowController.mm.

617 {
618 NSWindow* w = (__bridge NSWindow*)window;
619 return w.isMiniaturized;
620 }

## ◆ InternalFlutter_Window_Minimize()

FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_Minimize | ( | void * | window | ) |

Definition at line 607 of file FlutterWindowController.mm.

607 {
608 NSWindow* w = (__bridge NSWindow*)window;
609 [w miniaturize:nil];
610 }

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutter_Window_SetConstraints()

FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_SetConstraints | ( | void * | window,
|  | const FlutterWindowConstraints * | constraints
| ) |  |

Definition at line 581 of file FlutterWindowController.mm.

582 {
583 NSWindow* w = (__bridge NSWindow*)window;
584 FlutterWindowOwner* owner = (FlutterWindowOwner*)w.delegate;
585 [owner setConstraints:*constraints];
586 }
FlutterWindowOwner
Definition: FlutterWindowController.mm:16

## ◆ InternalFlutter_Window_SetContentSize()

FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_SetContentSize | ( | void * | window,
|  | const FlutterWindowSize * | size
| ) |  |

Definition at line 575 of file FlutterWindowController.mm.

575 {
576 NSWindow* w = (__bridge NSWindow*)window;
577 [w flutterSetContentSize:*size];
578 }

## ◆ InternalFlutter_Window_SetFullScreen()

FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_SetFullScreen | ( | void * | window,
|  | bool | fullScreen
| ) |  |

Definition at line 622 of file FlutterWindowController.mm.

622 {
623 NSWindow* w = (__bridge NSWindow*)window;
624 bool isFullScreen = (w.styleMask & NSWindowStyleMaskFullScreen) != 0;
625 if (fullScreen && !isFullScreen) {
626 [w toggleFullScreen:nil];
627 } else if (!fullScreen && isFullScreen) {
628 [w toggleFullScreen:nil];
629 }
630 }

## ◆ InternalFlutter_Window_SetMaximized()

FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_SetMaximized | ( | void * | window,
|  | bool | maximized
| ) |  |

Definition at line 593 of file FlutterWindowController.mm.

593 {
594 NSWindow* w = (__bridge NSWindow*)window;
595 if (maximized & !w.isZoomed) {
596 [w zoom:nil];
597 } else if (!maximized && w.isZoomed) {
598 [w zoom:nil];
599 }
600 }

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutter_Window_SetTitle()

FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_SetTitle | ( | void * | window,
|  | const char * | title
| ) |  |

Definition at line 588 of file FlutterWindowController.mm.

588 {
589 NSWindow* w = (__bridge NSWindow*)window;
590 w.title = [NSString stringWithUTF8String:title];
591 }

## ◆ InternalFlutter_Window_Unminimize()

FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_Unminimize | ( | void * | window | ) |

Definition at line 612 of file FlutterWindowController.mm.

612 {
613 NSWindow* w = (__bridge NSWindow*)window;
614 [w deminiaturize:nil];
615 }

## ◆ InternalFlutter_Window_UpdatePosition()

FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_UpdatePosition | ( | void * | window | ) |

Definition at line 653 of file FlutterWindowController.mm.

653 {
654 NSWindow* w = (__bridge NSWindow*)window;
655 FlutterWindowOwner* owner = (FlutterWindowOwner*)w.delegate;
656 [owner updatePosition];
657 }

## ◆ InternalFlutter_WindowController_CreateDialogWindow()

FLUTTER_DARWIN_EXPORT int64_t InternalFlutter_WindowController_CreateDialogWindow | ( | int64_t | engine_id,
|  | const FlutterWindowCreationRequest * | request
| ) |  |

Definition at line 530 of file FlutterWindowController.mm.

532 {
533 FlutterEngine* engine = [FlutterEngine engineForIdentifier:engine_id];
534 [engine enableMultiView];
535 return [engine.windowController createDialogWindow:request];
536 }

References FlutterWindowController::engine.

## ◆ InternalFlutter_WindowController_CreatePopupWindow()

FLUTTER_DARWIN_EXPORT int64_t InternalFlutter_WindowController_CreatePopupWindow | ( | int64_t | engine_id,
|  | const FlutterWindowCreationRequest * | request
| ) |  |

Definition at line 546 of file FlutterWindowController.mm.

548 {
549 FlutterEngine* engine = [FlutterEngine engineForIdentifier:engine_id];
550 [engine enableMultiView];
551 return [engine.windowController createPopupWindow:request];
552 }

References FlutterWindowController::engine.

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutter_WindowController_CreateRegularWindow()

FLUTTER_DARWIN_EXPORT int64_t InternalFlutter_WindowController_CreateRegularWindow | ( | int64_t | engine_id,
|  | const FlutterWindowCreationRequest * | request
| ) |  |

Definition at line 522 of file FlutterWindowController.mm.

524 {
525 FlutterEngine* engine = [FlutterEngine engineForIdentifier:engine_id];
526 [engine enableMultiView];
527 return [engine.windowController createRegularWindow:request];
528 }

References FlutterWindowController::engine.

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutter_WindowController_CreateTooltipWindow()

FLUTTER_DARWIN_EXPORT int64_t InternalFlutter_WindowController_CreateTooltipWindow | ( | int64_t | engine_id,
|  | const FlutterWindowCreationRequest * | request
| ) |  |

Definition at line 538 of file FlutterWindowController.mm.

540 {
541 FlutterEngine* engine = [FlutterEngine engineForIdentifier:engine_id];
542 [engine enableMultiView];
543 return [engine.windowController createTooltipWindow:request];
544 }

References FlutterWindowController::engine.

Referenced by flutter::testing::TEST_F().