@@ -237,6 +237,14 @@ static FlMethodResponse* set_window_maximum_size(FlWindowSizePlugin* self,
237
237
self->window_geometry .max_width = static_cast <gint>(width);
238
238
self->window_geometry .max_height = static_cast <gint>(height);
239
239
240
+ // Flutter uses -1 as unconstrained, GTK doesn't have an unconstrained value.
241
+ if (self->window_geometry .max_width < 0 ) {
242
+ self->window_geometry .max_width = G_MAXINT;
243
+ }
244
+ if (self->window_geometry .max_height < 0 ) {
245
+ self->window_geometry .max_height = G_MAXINT;
246
+ }
247
+
240
248
update_window_geometry (self);
241
249
242
250
return FL_METHOD_RESPONSE (fl_method_success_response_new (nullptr ));
@@ -296,10 +304,20 @@ static FlMethodResponse* get_window_minimum_size(FlWindowSizePlugin* self) {
296
304
// Gets the window maximum size.
297
305
static FlMethodResponse* get_window_maximum_size (FlWindowSizePlugin* self) {
298
306
g_autoptr (FlValue) size = fl_value_new_list ();
299
- fl_value_append_take (size,
300
- fl_value_new_float (self->window_geometry .max_width ));
301
- fl_value_append_take (size,
302
- fl_value_new_float (self->window_geometry .max_height ));
307
+
308
+ gint max_width = self->window_geometry .max_width ;
309
+ gint max_height = self->window_geometry .max_height ;
310
+
311
+ // Flutter uses -1 as unconstrained, GTK doesn't have an unconstrained value.
312
+ if (max_width == G_MAXINT) {
313
+ max_width = -1 ;
314
+ }
315
+ if (max_height == G_MAXINT) {
316
+ max_height = -1 ;
317
+ }
318
+
319
+ fl_value_append_take (size, fl_value_new_float (max_width));
320
+ fl_value_append_take (size, fl_value_new_float (max_height));
303
321
304
322
return FL_METHOD_RESPONSE (fl_method_success_response_new (size));
305
323
}
@@ -356,8 +374,8 @@ static void fl_window_size_plugin_class_init(FlWindowSizePluginClass* klass) {
356
374
static void fl_window_size_plugin_init (FlWindowSizePlugin* self) {
357
375
self->window_geometry .min_width = -1 ;
358
376
self->window_geometry .min_height = -1 ;
359
- self->window_geometry .max_width = - 1 ;
360
- self->window_geometry .max_height = - 1 ;
377
+ self->window_geometry .max_width = G_MAXINT ;
378
+ self->window_geometry .max_height = G_MAXINT ;
361
379
}
362
380
363
381
FlWindowSizePlugin* fl_window_size_plugin_new (FlPluginRegistrar* registrar) {
0 commit comments