From a9637f87e7c850717443f10af15bed62655fc445 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 17 Jan 2025 13:18:40 +0100 Subject: Fix background not being transparent on sway when a wayland application is focused and opening the ui --- src/WindowUtils.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/WindowUtils.cpp') 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 +extern "C" { +#include +} + #include #include #include @@ -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 *monitors = (std::vector*)userdata; + monitors->push_back({mgl::vec2i(monitor->pos.x, monitor->pos.y), mgl::vec2i(monitor->size.x, monitor->size.y)}); + } + + std::vector get_monitors(Display *dpy) { + std::vector monitors; + mgl_for_each_active_monitor_output(dpy, get_monitors_callback, &monitors); + return monitors; + } } \ No newline at end of file -- cgit v1.2.3