Background/Foreground Keyboard and Mouse input handler