Call XInitThreads() at the beginning of main()

This is related to issue #2803 and related to pull request linuxmint/cinnamon-desktop#6 which depend on this. See those issues for more information.