Permalink
Browse files

More graceful exit when X11 is not available on Linux

  • Loading branch information...
Simon Robertshaw
Simon Robertshaw committed Aug 7, 2016
1 parent 30c7c91 commit 86b83798f79428824b633399bb3fca67f844d607
Showing with 13 additions and 6 deletions.
  1. +13 −6 src/PowderToySDL.cpp
@@ -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;

0 comments on commit 86b8379

Please sign in to comment.