aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2021-08-28 14:14:16 -0500
committerSimon Ser <contact@emersion.fr>2021-09-02 19:05:02 +0200
commit9ed16e39faad3e4a61a788a0772cee4645bc259d (patch)
tree52253eff56daddea3532fe8c8241b0c2b0936bdf /include/wlr
parentb7cd06e8fa1d51c36f81040ca818cccfb9e5f56e (diff)
scene: replace surface_at() with node_at()
With the addition of a non-surface node type, it was unclear how such nodes should interact with scene_node_surface_at(). For example, if the topmost node at the given point is a RECT, should the function treat that node as transparent and continue searching, or as opaque and return (probably) NULL? Instead, replace the function with one returning a scene_node, which will allow for more consistent behavior across different node types. Compositors can downcast scene_surface nodes via the now-public wlr_scene_surface_from_node() if they need access to the surface itself.
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/types/wlr_scene.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h
index 4b3c1aaf..651840c3 100644
--- a/include/wlr/types/wlr_scene.h
+++ b/include/wlr/types/wlr_scene.h
@@ -114,12 +114,13 @@ void wlr_scene_node_reparent(struct wlr_scene_node *node,
void wlr_scene_node_for_each_surface(struct wlr_scene_node *node,
wlr_surface_iterator_func_t iterator, void *user_data);
/**
- * Find a surface in this scene-graph that accepts input events at the given
- * layout-local coordinates. Returns the surface and coordinates relative to
- * the returned surface, or NULL if no surface is found at that location.
+ * Find the topmost node in this scene-graph that contains the point at the
+ * given layout-local coordinates. (For surface nodes, this means accepting
+ * input events at that point.) Returns the node and coordinates relative to the
+ * returned node, or NULL if no node is found at that location.
*/
-struct wlr_surface *wlr_scene_node_surface_at(struct wlr_scene_node *node,
- double lx, double ly, double *sx, double *sy);
+struct wlr_scene_node *wlr_scene_node_at(struct wlr_scene_node *node,
+ double lx, double ly, double *nx, double *ny);
/**
* Create a new scene-graph.
@@ -142,6 +143,8 @@ void wlr_scene_render_output(struct wlr_scene *scene, struct wlr_output *output,
struct wlr_scene_surface *wlr_scene_surface_create(struct wlr_scene_node *parent,
struct wlr_surface *surface);
+struct wlr_scene_surface *wlr_scene_surface_from_node(struct wlr_scene_node *node);
+
/**
* Add a node displaying a solid-colored rectangle to the scene-graph.
*/