ec- / Quake3e

Improved Quake III Arena engine
GNU General Public License v2.0
1.22k stars 153 forks source link

sdl_glimp: save window position before quit #210

Closed shumvgolove closed 1 year ago

shumvgolove commented 1 year ago

quake3e always choose nearest display based on stored vid_xpos and vid_ypos. But here's the catch: these values are never modified if window position is changed (e.g. quake3e moved to another display). At least, for SDL_VIDEODRIVER=wayland.

This commit introduces storing state of window position upon shutdown of client.

This is my first contribution (aka "quickly hacked solution") to any public C code, so I apologize in advance if I didn't understand something / didn't put these functions in appropriate place. Thanks!

shumvgolove commented 1 year ago

Hm, maybe this isn't the right place after all: these vars should be set in sdl_input.c upon SDL_WINDOWEVENT_MOVED event, but in my case they are always constant (wayland issue?). Also, I think we should repaint (reinit?) the whole window if it moved to another display.

How can I debug this further?

ec- commented 1 year ago

Well, if it is never updated in SDL_WINDOWEVENT_MOVED then there is no sense to save non-updated (-initial) values at all. You may try to check whenever e.window contains some useful data during other SDL_WINDOWEVENT_* events and try to update vid_ cvars after that

shumvgolove commented 1 year ago

Thanks for the reply, will check.

ec- commented 1 year ago

Closing till more info/update coming