Turning DisplayPort monitor off disables monitor completely
DisplayPort acts as a PNP device, so turning off the monitor disconnects it from the computer as if it was removed and windows are moved out because Windows forgets this device, until it is turned on again and is "discovered".
One solution is to just let the screen go into sleep instead of turning it off. There are ways of programmatically forcing that, for example by using the monoff command in the free Wizmo utility to turn off all monitors.
Another solution for NVIDIA cards is detailed in DisplayPort Blanking / Screen Autodetect Problems by setting the monitor to use EDID information from a file instead of from the monitor, so auto-detect is not required.
This is done in NVIDIA Control Panel -> Workstation -> View system topology -> EDID source (for the monitor) -> Monitor... -> Export EDID.
Repeat this for each monitor. The topology should list the display as either EDID 'forced' or 'file'. See the linked article for more detail.
Disable the "DisplayData Channel Command Interface" (DDC/CI) in your monitor settings.
As a result Windows will not recognize if you turn off your monitor and your desktop icons stay as they should. I successfully tested this on a Dell monitor!
Wikipedia descripes DDC/CI as follows. I'll just leave it at that. There isn't much about it on the net.
[...] DDC/CI specifies a means for a computer to send commands to the monitor, as well as receive sensor data from the monitor, over a bidirectional link. [...] Some tilting DDC/CI monitors support an auto-pivot function, where a rotation sensor in the monitor enables the operating system to keep the display upright as the monitor is moved between its portrait and landscape positions.
Most DDC/CI monitors support only a small subset of MCCS commands and some have undocumented commands. Many manufacturers did not pay attention to DDC/CI in the past, but now almost all monitors support such general MCCS commands as brightness and contrast management.
http://en.wikipedia.org/wiki/Display_Data_Channel#DDC.2FCI
(or)
Switch from DisplayPort to HDMI and block pin #19 with electrical tape.
Unfortunately this is only possible if monitor and graphics card have additional HDMI ports.
Female end (monitor) Male end (Cable)
- Pin 19: Hot Plug detect (all versions) and HEC Data+ (optional, HDMI 1.4+ with Ethernet)
DisplayPort also has a Hot Plug pin (pin #18), but I doubt someone is able to tape this specific pin since DP connectors are just too small.
I've run into this issue as well and I've decided to write a little utility to restore the position and sizes of the windows on each of the screens. I unfortunately have an AMD card so the Nvidia solutions don't work for me.
http://www.ninjacrab.com/persistent-windows/