google / flutter-desktop-embedding

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

Can't maximize/resize in linux #844

Closed techno-disaster closed 3 years ago

techno-disaster commented 3 years ago

Describe the bug Have the simple counter app in running, the setWindowMinSize works but I can't get it to maximise or resize the window. Could this be a windowing system issue? I'm on Fedora KDE right now.

Doctor Output Please provide the output of flutter doctor -v:

[✓] Flutter (Channel master, 2.1.0-13.0.pre.208, on Linux, locale en_IN.UTF-8)
    • Flutter version 2.1.0-13.0.pre.208 at /home/techno_disaster/fvm/versions/master
    • Framework revision b921a2443f (2 hours ago), 2021-03-23 08:11:58 -0700
    • Engine revision d59a01d2d3
    • Dart version 2.13.0 (build 2.13.0-150.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/techno_disaster/Android/Sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /usr/local/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 11.0.0 (Fedora 11.0.0-2.fc33)
    • cmake version 3.19.7
    • ninja version 1.10.2
    • pkg-config version 1.7.3

[✓] Android Studio (version 4.0)
    • Android Studio at /usr/local/android-studio
    • Flutter plugin version 50.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.54.3)
    • VS Code at /usr/share/code
    • Flutter extension version 3.20.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Linux
    • Chrome (web)    • chrome • web-javascript • Google Chrome 89.0.4389.90

• No issues found!
stuartmorgan commented 3 years ago

the setWindowMinSize works but I can't get it to maximise

I'm not sure what this means; there's no functionality in window_size to maximize a window. Are you saying that setWindowMinSize breaks your ability to maximize the window via the UI?

techno-disaster commented 3 years ago

the setWindowMinSize works but I can't get it to maximise

I'm not sure what this means; there's no functionality in window_size to maximize a window. Are you saying that setWindowMinSize breaks your ability to maximize the window via the UI?

yep, and it also breaks resizing the same by grabbing some corner. Also just saw that if I set setWindowMaxSize to some const value the resizing works but setting setWindowMaxSize to infinite breaks it again

techno-disaster commented 3 years ago

Just read the README to not create issues here. Should I make a new one on the Flutter issue tracker?

stuartmorgan commented 3 years ago

Just read the README to not create issues here.

That's not what the README actually says. If this issue only happens after calling setWindowMinSize, then it's a bug report about a plugin in this repository:

For bug reports and feature requests related to the plugins in this repository, please file issues here.

stuartmorgan commented 3 years ago

@robert-ancell This suggests that -1 isn't working as "unset" as the GtkWindow docs claim. Any thoughts on why that would be?

robert-ancell commented 3 years ago

It's very hard to tell exactly what is going wrong without a test case - @Techno-Disaster can you show some code that reproduces this?

I had a look at the code and Flutter considers a minimum size of (0, 0) to be unconstrained, but GTK expects (-1, -1). I've made a PR that fixes this. If you were setting a minimum size and then clearing it, then this would have not be informing GTK to make the window unconstrained. If that was the problem then changing the min size from (0, 0) to (-1, -1) may make the problem go away.

Under GNOME, setting the min/max window sizes has no effect on the ability to maximise - this behaviour may be window manager dependent.

davidmartos96 commented 3 years ago

@robert-ancell A sample where it fails can be the following, which is a GUI for the command line tool fvm. https://github.com/leoafarias/sidekick/blob/b12b1b2adc7163dc5828fadd6de32bc820fe505a/lib/main.dart#L22

stuartmorgan commented 3 years ago

I had a look at the code and Flutter considers a minimum size of (0, 0) to be unconstrained, but GTK expects (-1, -1).

The cases described are ones where the minimum values are set to non-special values, but the max values are -1, so it's max that's the issue here.

robert-ancell commented 3 years ago

Ah, re-reading the documentation I see that setting a size to (-1, -1) sets it to the requisition size, which is the size that GTK has determined the window should be. To be unconstrained we want to set the size to (G_MAXINT, G_MAXINT).

stuartmorgan commented 3 years ago

which is the size that GTK has determined the window should be

Ah-ha; when I looked at the docs I assumed that meant the size that the resize action was requesting a resize to.