changeset 277:a796e97cc86d

dep/animone: x11: correctly check for connection failure if there's no X server running then the previous code segfaults(!)
author Paper <paper@paper.us.eu.org>
date Mon, 22 Apr 2024 19:11:06 -0400
parents ec0a2b5493f8
children c41c14ff8c67
files dep/animone/src/win/x11.cc
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dep/animone/src/win/x11.cc	Mon Apr 22 19:10:28 2024 -0400
+++ b/dep/animone/src/win/x11.cc	Mon Apr 22 19:11:06 2024 -0400
@@ -11,6 +11,7 @@
 #include <cstring>
 #include <set>
 #include <string>
+#include <memory>
 
 #include <chrono>
 
@@ -156,7 +157,7 @@
 		return false;
 
 	xcb_connection_t* connection = ::xcb_connect(NULL, NULL);
-	if (!connection)
+	if (xcb_connection_has_error(connection))
 		return false;
 
 	std::set<xcb_window_t> windows;
@@ -168,7 +169,7 @@
 				roots.push_back(iter.data->root);
 		}
 
-		if (!GetAllTopLevelWindowsEWMH(connection, roots, windows))
+		//if (!GetAllTopLevelWindowsEWMH(connection, roots, windows))
 			GetAllTopLevelWindowsICCCM(connection, roots, windows);
 	}