scene: use scene_node_get_size in wlr_scene_node_at

This allows to unify the RECT and BUFFER code-paths. The BUFFER one
will become more complicated with destination size and transforms.
This commit is contained in:
Simon Ser 2021-09-20 18:46:55 +02:00 committed by Simon Zeni
parent 27b529f8a0
commit 3d4afbe945
1 changed files with 4 additions and 7 deletions

View File

@ -528,14 +528,11 @@ struct wlr_scene_node *wlr_scene_node_at(struct wlr_scene_node *node,
struct wlr_scene_surface *scene_surface = wlr_scene_surface_from_node(node); struct wlr_scene_surface *scene_surface = wlr_scene_surface_from_node(node);
intersects = wlr_surface_point_accepts_input(scene_surface->surface, lx, ly); intersects = wlr_surface_point_accepts_input(scene_surface->surface, lx, ly);
break; break;
case WLR_SCENE_NODE_RECT:; case WLR_SCENE_NODE_RECT:
struct wlr_scene_rect *rect = scene_rect_from_node(node);
intersects = lx >= 0 && lx < rect->width && ly >= 0 && ly < rect->height;
break;
case WLR_SCENE_NODE_BUFFER:; case WLR_SCENE_NODE_BUFFER:;
struct wlr_scene_buffer *scene_buffer = scene_buffer_from_node(node); int width, height;
intersects = lx >= 0 && lx < scene_buffer->buffer->width && scene_node_get_size(node, &width, &height);
ly >= 0 && ly < scene_buffer->buffer->height; intersects = lx >= 0 && lx < width && ly >= 0 && ly < height;
break; break;
} }