commit 29d45ba

shrub  ·  2025-12-15 22:06:23 +0000 UTC
parent 7cd1fe7
swc_window_at
new public api, returns the topmost window at some compositor global
pair of coordinates
2 files changed,  +16, -0
+9, -0
 1@@ -43,6 +43,7 @@
 2 #include "surface.h"
 3 #include "util.h"
 4 #include "view.h"
 5+#include "window.h"
 6 
 7 #include <errno.h>
 8 #include <stdlib.h>
 9@@ -597,6 +598,14 @@ raise_window(struct compositor_view *view)
10 	schedule_updates(screens);
11 }
12 
13+EXPORT struct swc_window *
14+swc_window_at(int32_t x, int32_t y)
15+{
16+	struct compositor_view *view = window_view(view_at(x, y));
17+
18+	return view ? &view->window->base : NULL;
19+}
20+
21 struct compositor_view *
22 compositor_create_view(struct surface *surface)
23 {
+7, -0
 1@@ -298,6 +298,13 @@ void swc_window_begin_resize(struct swc_window *window, uint32_t edges);
 2  */
 3 void swc_window_end_resize(struct swc_window *window);
 4 
 5+/**
 6+ * returns the topmost window at any given compositor global coordinates
 7+ *
 8+ * returns null if there is no window at that point
 9+ */
10+struct swc_window *swc_window_at(int32_t x, int32_t y);
11+
12 /* }}} */
13 
14 /* Bindings {{{ */