Fix headless build error and abstract OSK bypass.

Thanks to Henrik for the idea on how to fix it.