Skip to content

Commit

Permalink
Check for XSetIOErrorExitHandler so old Xlib versions can work just fine
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Maiquez <[email protected]>
  • Loading branch information
Almamu committed May 8, 2022
1 parent 6808f31 commit ffa6932
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ find_package(LZ4 REQUIRED)
find_package(FFMPEG REQUIRED)
find_package(FreeImage REQUIRED)


include_directories(
${X11_INCLUDE_DIR}
${XRANDR_INCLUDE_DIR}
Expand Down Expand Up @@ -204,4 +205,9 @@ target_link_libraries(wallengine
${SDL_MIXER_LIBRARIES}
${FFMPEG_LIBRARIES}
${FREEIMAGE_LIBRARIES}
glfw)
glfw)

set(CMAKE_REQUIRED_LIBRARIES ${X11_LIBRARIES})

# make sure some of the X11 functions we'll use are available
check_function_exists(XSetIOErrorExitHandler "Xlib.h" HAVE_XSETIOERROREXITHANDLER)
2 changes: 2 additions & 0 deletions src/WallpaperEngine/Render/CContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ void CContext::initializeViewports ()
this->m_display = XOpenDisplay (nullptr);

// set the error handling to try and recover from X disconnections
#ifdef HAVE_XSETIOERROREXITHANDLER
XSetIOErrorExitHandler (this->m_display, CustomXIOErrorExitHandler, this);
#endif /* HAVE_XSETIOERROREXITHANDLER */
XSetErrorHandler (CustomXErrorHandler);
XSetIOErrorHandler (CustomXIOErrorHandler);

Expand Down

0 comments on commit ffa6932

Please sign in to comment.