Fixes X11 threading issue, under Linux

Uses #ifdef's to make a call to X11, to init threads. Fixes a crash on "run".