microsoft / WPFDXInterop

Repo for WPF DX Interop support
MIT License
307 stars 98 forks source link

isNewSurface is insufficient to detect screensaver/lock/Ctrl-Alt-Delete losses #23

Open FlsZen opened 8 years ago

FlsZen commented 8 years ago

The OnRender callback's Boolean/isNewSurface flag isn't set as true after the desktop is locked / Ctrl-Alt-Delete pressed / screensaver / etc., so while rendering is happening, the visible image isn't being updated. I'm not a DX expert, so I'm not sure what goes on under the hood, but I did notice that the device's NativePointer changes in these circumstances.

To detect these situations, my code now notices that the device's NativePointer changes: if (isNewSurface || device.NativePointer != _currentDevice) { _currentDevice = device.NativePointer; ...set up as new... {