diff dep/animia/CMakeLists.txt @ 234:8ccf0302afb1

dep/animia: convert xlib code to xcb I'm not *entirely* sure if this will work correctly for everything, but it works fine enough
author Paper <mrpapersonic@gmail.com>
date Tue, 16 Jan 2024 08:08:42 -0500
parents 53211cb1e7f5
children
line wrap: on
line diff
--- a/dep/animia/CMakeLists.txt	Mon Jan 15 08:10:58 2024 -0500
+++ b/dep/animia/CMakeLists.txt	Tue Jan 16 08:08:42 2024 -0500
@@ -88,53 +88,18 @@
 	endif() # LINUX
 endif() # WIN32 AND APPLE
 
-# It's technically possible to have an X server on macOS, so we
-# should compile X11 support.
 # X11
-find_package(X11 COMPONENTS X11 XRes)
-
-if(X11_FOUND)
-	# Getting PIDs from windows...
-	if (X11_XRes_FOUND)
-		list(APPEND DEFINES HAVE_XRES)
-	else() # NOT X11_XRes_FOUND
-		message(WARNING "libXRes could not be found! Finding PIDs in X11 windows may not work correctly!")
-	endif() # X11_XRes_FOUND
-
-	list(APPEND DEFINES X11)
-	list(APPEND SRC_FILES src/win/x11.cc)
-	list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS})
-	list(APPEND LIBRARIES ${X11_LIBRARIES}) # This will include Xres, I think..
-else() # NOT X11_FOUND
-	# For some systems, i.e. Debian, FindX11 fails to find X11, so we have
-	# to use pkg_config as a fallback
-	find_package(PkgConfig)
-	if(PKG_CONFIG_FOUND)
-		pkg_check_modules(X11 x11)
-		if(X11_FOUND)
-			# Check for XRes the hard way
-			find_path(X11_XRes_HEADER "X11/extensions/XRes.h" PATHS ${X11_INCLUDE_DIRS})
-			find_library(X11_XRes_LIB XRes PATHS ${X11_LIBRARY_DIRS})
-
-			if(X11_XRes_HEADER AND X11_XRes_LIB)
-				# TODO: We should REALLY check for XResQueryClientIds here...
-				list(APPEND DEFINES HAVE_XRES)
-				list(APPEND LIBRARIES ${X11_XRes_LIB})
-			else()
-				message(WARNING "libXRes could not be found! Finding PIDs in X11 windows may not work correctly!")
-			endif()
-
-			list(APPEND DEFINES X11)
-			list(APPEND SRC_FILES src/win/x11.cc)
-			list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS})
-			list(APPEND LIBRARIES ${X11_LINK_LIBRARIES})
-		endif() # X11_FOUND
-	endif() # PKG_CONFIG_FOUND
-endif() # X11_FOUND
-
-# Wayland.
 find_package(PkgConfig)
 if(PKG_CONFIG_FOUND)
+	pkg_check_modules(XCB xcb xcb-res)
+	if (XCB_FOUND)
+		list(APPEND DEFINES X11)
+		list(APPEND LIBRARIES ${XCB_LINK_LIBRARIES})
+		list(APPEND INCLUDE_DIRS ${XCB_INCLUDE_DIRS})
+		list(APPEND SRC_FILES src/win/x11.cc)
+	endif() # XCB_FOUND
+
+	# Wayland
 	pkg_check_modules(WAYLAND wayland-client)
 	if(WAYLAND_FOUND)
 		enable_language(C)