fix: offset lost after invoking gtk hide on linux #241
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've found there's an issue when using
gtk_widget_hide
method, causing offset lost after hide the window (always center).Reproduce repo(pure empty flutter project + window_manager): https://github.com/Kingtous/hide_and_show_issue_reproduce_demo
Note that this is NOT a issue in
window_manager
, but gtk is.gtk hide will reset offset of the window.
btw, i can reproduce this behavior of gtk also in rust code.
But if I saved the size and offset before hide, and set them once after invoking hide, it behaves normally.
So I add a workaround to make linux able to remember offset and size after hide, which uniforms behaviors of all platforms supported by
window_manager
. (the position and offset of the window after hiding it can be saved automatically by system, but linux gtk can't). With this PR, window manager can remember the position and offset after hiding windows on all platforms.