aboutsummaryrefslogtreecommitdiff
path: root/src/diagnostic.c
diff options
context:
space:
mode:
authorallusive-dev <[email protected]>2023-09-19 17:47:33 +1000
committerallusive-dev <[email protected]>2023-09-19 17:47:33 +1000
commita93aba600b1c5d019b680b9f4ff3fa85d5d43a60 (patch)
tree77f8152222655657472a70e0bfa413a0495dd555 /src/diagnostic.c
parentreset (diff)
downloadcompfy-a93aba600b1c5d019b680b9f4ff3fa85d5d43a60.tar.xz
compfy-a93aba600b1c5d019b680b9f4ff3fa85d5d43a60.zip
Fixed broken files/code and other errors
Diffstat (limited to 'src/diagnostic.c')
-rw-r--r--src/diagnostic.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/diagnostic.c b/src/diagnostic.c
new file mode 100644
index 0000000..d275b1a
--- /dev/null
+++ b/src/diagnostic.c
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: MPL-2.0
+// Copyright (c) 2018 Yuxuan Shui <[email protected]>
+
+#include <stdio.h>
+#include <xcb/xcb.h>
+#include <xcb/composite.h>
+
+#include "backend/driver.h"
+#include "diagnostic.h"
+#include "config.h"
+#include "picom.h"
+#include "common.h"
+
+void print_diagnostics(session_t *ps, const char *config_file, bool compositor_running) {
+ printf("**Version:** " COMPTON_VERSION "\n");
+ //printf("**CFLAGS:** %s\n", "??");
+ printf("\n### Extensions:\n\n");
+ printf("* Shape: %s\n", ps->shape_exists ? "Yes" : "No");
+ printf("* XRandR: %s\n", ps->randr_exists ? "Yes" : "No");
+ printf("* Present: %s\n", ps->present_exists ? "Present" : "Not Present");
+ printf("\n### Misc:\n\n");
+ printf("* Use Overlay: %s\n", ps->overlay != XCB_NONE ? "Yes" : "No");
+ if (ps->overlay == XCB_NONE) {
+ if (compositor_running) {
+ printf(" (Another compositor is already running)\n");
+ } else if (session_redirection_mode(ps) != XCB_COMPOSITE_REDIRECT_MANUAL) {
+ printf(" (Not in manual redirection mode)\n");
+ } else {
+ printf("\n");
+ }
+ }
+#ifdef __FAST_MATH__
+ printf("* Fast Math: Yes\n");
+#endif
+ printf("* Config file used: %s\n", config_file ?: "None");
+ printf("\n### Drivers (inaccurate):\n\n");
+ print_drivers(ps->drivers);
+
+ for (int i = 0; i < NUM_BKEND; i++) {
+ if (backend_list[i] && backend_list[i]->diagnostics) {
+ printf("\n### Backend: %s\n\n", BACKEND_STRS[i]);
+ auto data = backend_list[i]->init(ps);
+ if (!data) {
+ printf(" Cannot initialize this backend\n");
+ } else {
+ backend_list[i]->diagnostics(data);
+ backend_list[i]->deinit(data);
+ }
+ }
+ }
+}
+
+// vim: set noet sw=8 ts=8 :