When I first start my application, drawing coordinates correspond to mouse-reporting positions, meaning if I hover the mouse at (10,10) and issue a drawing command to draw a pixel at (10,10), the pixel appears right under the mouse pointer.
However, I have recently implemented a reshape function, if I grab the window by its lower-right-hand corner and generate lots of callbacks to the reshape function, the physical drawing coordinates gradually drift away from their original positions toward the bottom and right.
Whatever window size I specify originally, drawing and mouse coordinates line up, but after enough resizing of the window, they progressively drift apart, whether I am making the window bigger or smaller. The mouse-reporting positions seem to stay absolute and correct, but all drawing in the window seems to drift even if I hard-code coordinates.
The application is a simple 2D display.
What should I do to fix this?