Check that window position is in bounds for resolution on boot of desktop app
qdot opened this issue · comments
Someone submitted a configuration file with the following:
"flutter.gui_window_posx": 2987,
"flutter.gui_window_posy": -12,
Our windowing library in flutter will happily place things completely off screen when settings are like this. We should check position on boot and reset it if it's outside current resolution.
Additional info:
- User had one monitor scaled (125%), one unscaled
- Cannot repro locally with both monitors at 150%
Okay, I found out, how can this be done.
If you have multiple monitors and change the primary display, the position can be out of bounds.
Let's say, you have 2 monitors, and the left one is the primary.
Move the intiface window to the secondary display (to the right) and close it.
Now make the right screen to primary display.
Now if you start intiface it will try to show up right from the primary display so it will be out of bounds.
Based on this commit and since it seems the position calculation is also based on the screen_retriever package:
I think you have to use the screen_retriever
package too validate whether the position is out of bounds or not..
Has anyone found a way to retrieve the window once this has happened? Maybe reset a config file somewhere?
You can delete the intiface config files
On windows they're at c:\Users\[your user name]\AppData\Roaming\com.nonpolynomial\intiface_central
.
You can just remove that whole directory.
Whoops this shouldn't have gotten closed.
@jabiim Ok, Screen retriever did the trick. I just calculate a dumb bounding box from the display positions and check that. Testing against the "change main display" test case works. Probably still some edge cases this may not cover when used with screens that don't create a perfect rectangle, but it's good enough for now.
Will close once this build is shipped.
Fixed in v2.5.0 (with an actual robust solution that does handle non-convex monitor geometries)