RenderWindow 'top' and 'left' values don't get updated when window moves
System Information
- Ogre Version: 14.4.1
- Operating System / Platform: Windows 11
- RenderSystem: OpenGL
Detailled description
RenderWindow::getMetrics() reports stale top and left values after the window has been moved, unless it has also been resized. It seems to come down to ApplicationContextSDL not calling RenderWindow::reposition when processing a window move event. This is the relevant code in ApplicationContextSDL::pollEvents():
case SDL_WINDOWEVENT:
if(event.window.event != SDL_WINDOWEVENT_RESIZED)
continue;
for(auto & window : mWindows)
{
if(event.window.windowID != SDL_GetWindowID(window.native))
continue;
Ogre::RenderWindow* win = window.render;
win->resize(event.window.data1, event.window.data2);
windowResized(win);
}
break;
It seems like we should be doing something similar for SDL_WINDOWEVENT_MOVED events. I can give that a go if you're happy with me trying.
actually I would like to restrict native window handling in Ogre to a minimum, as it is a headache to maintain and add for new platforms. In fact Win32 is one of the fews backends that support that at all. On Vulkan and Wayland I did not even try.
That being said, this is a rather minor addition, so I would not mind. But RenderWindow::reposition is the wrong method to call as its purpose is to move the window to the given position. Instead you should rather introduce RenderWindow::_notifyPosition to merely set top and left.