pk-hack / CoilSnake

https://pk-hack.github.io/CoilSnake/
GNU General Public License v3.0
158 stars 37 forks source link

Window location fix #269

Closed charasyn closed 1 year ago

charasyn commented 1 year ago

This change should make the window location restoring feature more consistent. On Windows, the window would shift a small amount on every startup, due to differences between the location being set by the geometry function, vs. the location read using the winfo_rootx/winfo_rooty functions. Using winfo_x/winfo_y instead seems to give correct results.

Additionally, when I tested on Linux, the window would also shift on every startup. I ended up finding out that this was due to the location being set to 0,0 and then the window being shifted down by my menubar - as a result, every time I started the program it would shift the window up to compensate for it being moved down (ypos -= self.root.winfo_rooty() would shift the window's Y position up by the height of my menubar). Now, we move the window to 100,100 instead of 0,0 in order to determine the difference between where geometry() is putting us vs. the actual position recorded.