commit 29d45bacfa75283a95eb8ac8e660edd6b25b9e64
parent 7cd1fe7081c2e3453cc7aaf1420cd95ebe3ae07a
Author: shrub <maybeshrub@gmail.com>
Date: Mon, 15 Dec 2025 22:06:23 +0000
swc_window_at
new public api, returns the topmost window at some compositor global
pair of coordinates
Diffstat:
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/libswc/compositor.c b/libswc/compositor.c
@@ -43,6 +43,7 @@
#include "surface.h"
#include "util.h"
#include "view.h"
+#include "window.h"
#include <errno.h>
#include <stdlib.h>
@@ -597,6 +598,14 @@ raise_window(struct compositor_view *view)
schedule_updates(screens);
}
+EXPORT struct swc_window *
+swc_window_at(int32_t x, int32_t y)
+{
+ struct compositor_view *view = window_view(view_at(x, y));
+
+ return view ? &view->window->base : NULL;
+}
+
struct compositor_view *
compositor_create_view(struct surface *surface)
{
diff --git a/libswc/swc.h b/libswc/swc.h
@@ -298,6 +298,13 @@ void swc_window_begin_resize(struct swc_window *window, uint32_t edges);
*/
void swc_window_end_resize(struct swc_window *window);
+/**
+ * returns the topmost window at any given compositor global coordinates
+ *
+ * returns null if there is no window at that point
+ */
+struct swc_window *swc_window_at(int32_t x, int32_t y);
+
/* }}} */
/* Bindings {{{ */