Backported support for syswm from master.