-
Notifications
You must be signed in to change notification settings - Fork 431
Description
Due to unknown behavior, the .window-state.json
cache file may record unexpected values for the width and height fields, resulting in abnormal window sizes when users launch the application.
For related issue examples:
clash-verge-rev/clash-verge-rev#3493 (comment)
clash-verge-rev/clash-verge-rev#3237 (comment)
Since these feedbacks was submitted by users of our downstream repository, the available clues are limited. However, according to community reports, when this issue occurs, triggering a window resize using system shortcuts or deleting the {identifier}\.window-state.json
file and restarting the application can restore the window to its normal size.
I tried to manually reproduce this unexpected behavior by modifying the width and height values in the cache file.
{
"main": {
"width": 0,
"height": 0,
......
}
}
No visible window will be created by this.
{
"main": {
"width": 400,
"height": 40,
"decorated": false,
......
}
}
The window created is very similar to what has been reported in the community issues.
I found the following code to handle the window size settings, but I haven’t seen any width and height validation elsewhere.
plugins-workspace/plugins/window-state/src/lib.rs
Lines 210 to 215 in 9bc4b22
if flags.contains(StateFlags::SIZE) { | |
self.set_size(PhysicalSize { | |
width: state.width, | |
height: state.height, | |
})?; | |
} |