Skip to content

Commit

Permalink
More graceful exit when X11 is not available on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Robertshaw committed Aug 7, 2016
1 parent 30c7c91 commit 86b8379
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/PowderToySDL.cpp
Expand Up @@ -1059,12 +1059,19 @@ int main(int argc, char * argv[])
#if defined (USE_SDL) && defined(LIN) && defined(SDL_VIDEO_DRIVER_X11)
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
SDL_VERSION(&sdl_wminfo.version);
SDL_GetWMInfo(&sdl_wminfo);
sdl_wminfo.info.x11.lock_func();
XA_CLIPBOARD = XInternAtom(sdl_wminfo.info.x11.display, "CLIPBOARD", 1);
XA_TARGETS = XInternAtom(sdl_wminfo.info.x11.display, "TARGETS", 1);
XA_UTF8_STRING = XInternAtom(sdl_wminfo.info.x11.display, "UTF8_STRING", 1);
sdl_wminfo.info.x11.unlock_func();
if(SDL_GetWMInfo(&sdl_wminfo) > 0)
{
sdl_wminfo.info.x11.lock_func();
XA_CLIPBOARD = XInternAtom(sdl_wminfo.info.x11.display, "CLIPBOARD", 1);
XA_TARGETS = XInternAtom(sdl_wminfo.info.x11.display, "TARGETS", 1);
XA_UTF8_STRING = XInternAtom(sdl_wminfo.info.x11.display, "UTF8_STRING", 1);
sdl_wminfo.info.x11.unlock_func();
}
else
{
fprintf(stderr, "X11 setup failed, X11 window info not found");
exit(-1);
}
#endif
ui::Engine::Ref().g = new Graphics();
ui::Engine::Ref().Scale = scale;
Expand Down

0 comments on commit 86b8379

Please sign in to comment.