google / flutter-desktop-embedding

Experimental plugins for Flutter for Desktop
Apache License 2.0
7.1k stars 607 forks source link

[window_size] setWindowMinSize and setWindowMaxSize not setting correct window size on Linux #854

Open Letal1s opened 3 years ago

Letal1s commented 3 years ago

When making a flutter app for Linux, the initial size can be set by altering the parameters of gtk_window_set_default_size() in my_application.cc: gtk_window_set_default_size(window, 450, 750);

Then trying to set maximum and minimum sizes using the window_size plugin in dart code using the same dimensions:

final fixedSize = Size(450, 750);
setWindowMinSize(fixedSize);
setWindowMaxSize(fixedSize);

However when setting this maximum and minimum the window is resized to below the size set initially in the native code using GTK, despite using the same dimensions. Wouldn't the expected behaviour be for the app not to change size at all?

stuartmorgan commented 3 years ago

These are pretty straightforward passthroughs to GTK window methods; perhaps there's a subtle behavioral difference between size and geometry APIs.

Out of curiosity, if you are changing the runner code already, why aren't you just setting gtk_window_set_resizable to false, which seems to be what you want here?

Letal1s commented 3 years ago

I did in fact end up changing gtk_window_set_resizable once I'd looked at GTK documentation some more and that seems to work fine. The only reason I started medalling in the runner code anyway was because of the window size not being set correctly through the functions I detailed though. I thought I'd bring this up as it certainly was a bit odd, and upon trying to retrieve the window size in dart code after being set this way the values have in fact decreased significantly from what was passed into the functions.