Mercurial > libanimone
diff src/win/x11.cc @ 9:fac204fb3748
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 | 97ea6a3e1954 |
children | ddf550313ed7 |
line wrap: on
line diff
--- a/src/win/x11.cc Thu Apr 18 16:51:35 2024 -0400 +++ b/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); }