- Most monitors have multiple digital inputs. Connect each computer to one of them
- Use a USB switch keyboard and mouse
- Before switching the USB switch, press the "lock screen" key combination and make sure locking the screen drops the video signal
- After switching the USB switch, pressing shift should bring up the login dialog and re-activate video output. Since the monitor has just lost the signal in the previous step, it will scan the inputs and switch to the desired signal.
A lot of these things seem to "help" by inserting their own USB host device that acts as a proxy for attached USB peripherals. This allows them to do (ostensibly) useful useful things such as intercepting keypresses and responding to them (e.g. by switching to another input).
Don't get one of those, get a physical switch that just connects the leads to the correct port when pressed. I got this USB 2.0 switch (all you need for input devices) for $12 [0]. I'm sure there are others available with more ports, but this is all I needed.