diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-01-17 13:18:40 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-01-17 13:18:40 +0100 |
commit | a9637f87e7c850717443f10af15bed62655fc445 (patch) | |
tree | 32cf2b2bf25a4a65d615f6a158a84d5b50b0a469 /src/WindowUtils.cpp | |
parent | eb4ce76f013d4df74897466702769086329911c3 (diff) |
Fix background not being transparent on sway when a wayland application is focused and opening the ui
Diffstat (limited to 'src/WindowUtils.cpp')
-rw-r--r-- | src/WindowUtils.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/WindowUtils.cpp b/src/WindowUtils.cpp index 0bd3a8e..ea9dfbd 100644 --- a/src/WindowUtils.cpp +++ b/src/WindowUtils.cpp @@ -6,6 +6,10 @@ #include <mglpp/system/Utf8.hpp> +extern "C" { +#include <mgl/window/window.h> +} + #include <stdbool.h> #include <stdint.h> #include <stdio.h> @@ -470,7 +474,18 @@ namespace gsr { bool is_compositor_running(Display *dpy, int screen) { char prop_name[20]; snprintf(prop_name, sizeof(prop_name), "_NET_WM_CM_S%d", screen); - Atom prop_atom = XInternAtom(dpy, prop_name, False); + const Atom prop_atom = XInternAtom(dpy, prop_name, False); return XGetSelectionOwner(dpy, prop_atom) != None; } + + static void get_monitors_callback(const mgl_monitor *monitor, void *userdata) { + std::vector<Monitor> *monitors = (std::vector<Monitor>*)userdata; + monitors->push_back({mgl::vec2i(monitor->pos.x, monitor->pos.y), mgl::vec2i(monitor->size.x, monitor->size.y)}); + } + + std::vector<Monitor> get_monitors(Display *dpy) { + std::vector<Monitor> monitors; + mgl_for_each_active_monitor_output(dpy, get_monitors_callback, &monitors); + return monitors; + } }
\ No newline at end of file |