slajerek / RetroDebugger

Retro Debugger is a multiplatform debugger APIs host for retro computers: C64 (Vice), Atari800 and NES (NestopiaUE).
175 stars 20 forks source link

Window position is not correctly restored on restart on MS Windows #40

Closed slajerek closed 4 months ago

slajerek commented 5 months ago

Describe the bug After restarting app, the window position is not correctly restored on MS Windows. Each time app is restarted the app window moves slightly up, causing it to finally leave screen.

Expected behavior App window should appear with the same position as when app was closed.

Desktop (please complete the following information):

Additional context This looks to be a bug in SDL2 related to WinAPI and specifically SDL_GetWindowPosition. It is noted also in SDL2 docs. I was not able to find a solution that is reliable and portable between various MS Windows versions, to get window position x,y and then set a new position on startup using the same x,y. It looks that position needs to be adjusted by some theme metrics like SM_CYCAPTION or something on some MS Windows versions, but on some others not.

The problem is exposed in src.Windows/SYS_Platform.cpp and VID_StoreMainWindowPosition, VID_GetStartupMainWindowPosition

Possible workaround is to move window to a new position after it is spawned, not on startup - that worked in old C64 Debugger.

slajerek commented 4 months ago

This is fixed and will be released with 0.64.68