I have been doing this for years without any additional software: just make sure your monitor goes to blank when locking the screen:
1. lock screen
2. Switch USB switch to the other source
3. Press space to activate the other PC
4. Monitor should automatically sitch to the "new" active source.