ogre icon indicating copy to clipboard operation
ogre copied to clipboard

RenderWindow 'top' and 'left' values don't get updated when window moves

Open valverl opened this issue 2 months ago • 1 comments

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.

valverl avatar Nov 12 '25 17:11 valverl

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.

paroj avatar Nov 13 '25 15:11 paroj