xrandr and scrolled virtual desktop

I have the feeling this is a FAQ, but I could not find it on the web, so please bear with me.

I am looking for the correct / preferred way of handling resolution changes (RandR / xrandr) when using a large virtual desktop scrolled by full-screen increments. Just “Restart” does not do what I want.

Let me be more specific. Assuming the screen resolution is initially 2000×2000 and the virtual desktop 4000×4000, i.e. 2×2 screens. There is a window at (2050,40), i.e. at (50,40) on screen (1,0).

Now, “xrandr --output HDMI2 --mode 1000x1000 --right-of HDMI1”, the screen resolution becomes 3000×2000. Then “Restart”.

The window stays at (2050,40), but these coordinates now mean (2050,40) on screen (0,0), or more precisely (50,40) on HDMI2 on screen (0,0). It may overlap to screen (1,0) if the width is more than 950.

What I would like: the window stays at “(50,40) on screen (1,0)”, i.e. moves to (3050,40).

It does not seem very difficult: just before restarting, Fvwm scrolls to (0,0). Something could, somewhere during the restart, move all the windows from x to new_scr_w * round(x / old_scr_w) + x % old_scr_w (and same for y; round should probably take th window width into account but that is a detail).

Any suggestion?