1
+ // Copyright 2013 The Flutter Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
1
5
#import " flutter/shell/platform/darwin/macos/framework/Source/FlutterWindowController.h"
2
6
3
7
#import " flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h"
7
11
8
12
#include " flutter/shell/platform/common/isolate_scope.h"
9
13
10
- struct FlutterWindowCreationRequest {
11
- double width;
12
- double height;
13
- double min_width;
14
- double min_height;
15
- double max_width;
16
- double max_height;
17
- void (*on_close)();
18
- void (*on_size_change)();
19
- };
20
-
21
14
// / A delegate for a Flutter managed window.
22
15
@interface FlutterWindowOwner : NSObject <NSWindowDelegate > {
23
16
// / Strong reference to the window. This is the only strong reference to the
@@ -134,57 +127,43 @@ - (void)destroyWindow:(NSWindow*)window {
134
127
135
128
@end
136
129
137
- extern " C" {
138
130
// NOLINTBEGIN(google-objc-function-naming)
139
131
140
- FLUTTER_DARWIN_EXPORT
141
- int64_t flutter_create_regular_window (int64_t engine_id,
142
- const FlutterWindowCreationRequest* request) {
132
+ int64_t FlutterCreateRegularWindow (int64_t engine_id, const FlutterWindowCreationRequest* request) {
143
133
FlutterEngine* engine = [FlutterEngine engineForIdentifier: engine_id];
144
134
[engine enableMultiView ];
145
135
return [engine.windowController createRegularWindow: request];
146
136
}
147
137
148
- FLUTTER_DARWIN_EXPORT
149
- void flutter_destroy_window (int64_t engine_id, void * window) {
138
+ void FlutterDestroyWindow (int64_t engine_id, void * window) {
150
139
NSWindow * w = (__bridge NSWindow *)window;
151
140
FlutterEngine* engine = [FlutterEngine engineForIdentifier: engine_id];
152
141
[engine.windowController destroyWindow: w];
153
142
}
154
143
155
- FLUTTER_DARWIN_EXPORT
156
- void * flutter_get_window_handle (int64_t engine_id, FlutterViewIdentifier view_id) {
144
+ void * FlutterGetWindowHandle (int64_t engine_id, FlutterViewIdentifier view_id) {
157
145
FlutterEngine* engine = [FlutterEngine engineForIdentifier: engine_id];
158
146
FlutterViewController* controller = [engine viewControllerForIdentifier: view_id];
159
147
return (__bridge void *)controller.view .window ;
160
148
}
161
149
162
- struct FlutterWindowSize {
163
- double width;
164
- double height;
165
- };
166
-
167
- FLUTTER_DARWIN_EXPORT
168
- void flutter_get_window_size (void * window, FlutterWindowSize* size) {
150
+ void FlutterGetWindowSize (void * window, FlutterWindowSize* size) {
169
151
NSWindow * w = (__bridge NSWindow *)window;
170
152
size->width = w.frame .size .width ;
171
153
size->height = w.frame .size .height ;
172
154
}
173
155
174
- FLUTTER_DARWIN_EXPORT
175
- void flutter_set_window_size (void * window, double width, double height) {
156
+ void FlutterSetWindowSize (void * window, double width, double height) {
176
157
NSWindow * w = (__bridge NSWindow *)window;
177
158
[w setContentSize: NSMakeSize (width, height)];
178
159
}
179
160
180
- FLUTTER_DARWIN_EXPORT
181
- void flutter_set_window_title (void * window, const char * title) {
161
+ void FlutterSetWindowTitle (void * window, const char * title) {
182
162
NSWindow * w = (__bridge NSWindow *)window;
183
163
w.title = [NSString stringWithUTF8String: title];
184
164
}
185
165
186
- FLUTTER_DARWIN_EXPORT
187
- int64_t flutter_get_window_state (void * window) {
166
+ int64_t FlutterGetWindowState (void * window) {
188
167
NSWindow * w = (__bridge NSWindow *)window;
189
168
if (w.isZoomed ) {
190
169
return 1 ;
@@ -195,8 +174,7 @@ int64_t flutter_get_window_state(void* window) {
195
174
}
196
175
}
197
176
198
- FLUTTER_DARWIN_EXPORT
199
- void flutter_set_window_state (void * window, int64_t state) {
177
+ void FlutterSetWindowState (void * window, int64_t state) {
200
178
NSWindow * w = (__bridge NSWindow *)window;
201
179
if (state == 1 ) {
202
180
[w zoom: nil ];
@@ -217,4 +195,3 @@ void flutter_set_window_state(void* window, int64_t state) {
217
195
}
218
196
219
197
// NOLINTEND(google-objc-function-naming)
220
- } // extern "C"
0 commit comments