@ -13,7 +13,7 @@ static struct wlr_scene *scene_root_from_node(struct wlr_scene_node *node) {
return ( struct wlr_scene * ) node ;
return ( struct wlr_scene * ) node ;
}
}
static struct wlr_scene_surface * scene_surface_from_node(
struct wlr_scene_surface * wlr_ scene_surface_from_node(
struct wlr_scene_node * node ) {
struct wlr_scene_node * node ) {
assert ( node - > type = = WLR_SCENE_NODE_SURFACE ) ;
assert ( node - > type = = WLR_SCENE_NODE_SURFACE ) ;
return ( struct wlr_scene_surface * ) node ;
return ( struct wlr_scene_surface * ) node ;
@ -74,7 +74,7 @@ void wlr_scene_node_destroy(struct wlr_scene_node *node) {
free ( scene ) ;
free ( scene ) ;
break ;
break ;
case WLR_SCENE_NODE_SURFACE : ;
case WLR_SCENE_NODE_SURFACE : ;
struct wlr_scene_surface * scene_surface = scene_surface_from_node( node ) ;
struct wlr_scene_surface * scene_surface = wlr_ scene_surface_from_node( node ) ;
wl_list_remove ( & scene_surface - > surface_destroy . link ) ;
wl_list_remove ( & scene_surface - > surface_destroy . link ) ;
free ( scene_surface ) ;
free ( scene_surface ) ;
break ;
break ;
@ -198,7 +198,7 @@ static void scene_node_for_each_surface(struct wlr_scene_node *node,
ly + = node - > state . y ;
ly + = node - > state . y ;
if ( node - > type = = WLR_SCENE_NODE_SURFACE ) {
if ( node - > type = = WLR_SCENE_NODE_SURFACE ) {
struct wlr_scene_surface * scene_surface = scene_surface_from_node( node ) ;
struct wlr_scene_surface * scene_surface = wlr_ scene_surface_from_node( node ) ;
user_iterator ( scene_surface - > surface , lx , ly , user_data ) ;
user_iterator ( scene_surface - > surface , lx , ly , user_data ) ;
}
}
@ -213,8 +213,8 @@ void wlr_scene_node_for_each_surface(struct wlr_scene_node *node,
scene_node_for_each_surface ( node , 0 , 0 , user_iterator , user_data ) ;
scene_node_for_each_surface ( node , 0 , 0 , user_iterator , user_data ) ;
}
}
struct wlr_s urfa ce * wlr_scene_nod e_surfac e_at( struct wlr_scene_node * node ,
struct wlr_s cene_nod e * wlr_scene_nod e_at( struct wlr_scene_node * node ,
double lx , double ly , double * sx, double * s y) {
double lx , double ly , double * nx, double * n y) {
if ( ! node - > state . enabled ) {
if ( ! node - > state . enabled ) {
return NULL ;
return NULL ;
}
}
@ -225,24 +225,40 @@ struct wlr_surface *wlr_scene_node_surface_at(struct wlr_scene_node *node,
struct wlr_scene_node * child ;
struct wlr_scene_node * child ;
wl_list_for_each_reverse ( child , & node - > state . children , state . link ) {
wl_list_for_each_reverse ( child , & node - > state . children , state . link ) {
struct wlr_s urface * surfac e =
struct wlr_s cene_node * nod e =
wlr_scene_node_ surface_ at( child , lx , ly , sx, s y) ;
wlr_scene_node_ at( child , lx , ly , nx, n y) ;
if ( surfac e ! = NULL ) {
if ( nod e ! = NULL ) {
return surfac e;
return nod e;
}
}
}
}
if ( node - > type = = WLR_SCENE_NODE_SURFACE ) {
switch ( node - > type ) {
struct wlr_scene_surface * scene_surface = scene_surface_from_node ( node ) ;
case WLR_SCENE_NODE_SURFACE : ;
struct wlr_scene_surface * scene_surface = wlr_scene_surface_from_node ( node ) ;
if ( wlr_surface_point_accepts_input ( scene_surface - > surface , lx , ly ) ) {
if ( wlr_surface_point_accepts_input ( scene_surface - > surface , lx , ly ) ) {
if ( sx ! = NULL ) {
if ( nx ! = NULL ) {
* sx = lx ;
* nx = lx ;
}
if ( ny ! = NULL ) {
* ny = ly ;
}
return & scene_surface - > node ;
}
break ;
case WLR_SCENE_NODE_RECT : ;
struct wlr_scene_rect * rect = scene_rect_from_node ( node ) ;
if ( lx > = 0 & & lx < rect - > width & & ly > = 0 & & ly < rect - > height ) {
if ( nx ! = NULL ) {
* nx = lx ;
}
}
if ( sy ! = NULL ) {
if ( n y ! = NULL ) {
* sy = ly ;
* n y = ly ;
}
}
return scene_surface - > surface ;
return & rect - > nod e;
}
}
break ;
default :
break ;
}
}
return NULL ;
return NULL ;
@ -342,7 +358,7 @@ static void render_node_iterator(struct wlr_scene_node *node,
/* Root node has nothing to render itself */
/* Root node has nothing to render itself */
break ;
break ;
case WLR_SCENE_NODE_SURFACE : ;
case WLR_SCENE_NODE_SURFACE : ;
struct wlr_scene_surface * scene_surface = scene_surface_from_node( node ) ;
struct wlr_scene_surface * scene_surface = wlr_ scene_surface_from_node( node ) ;
struct wlr_surface * surface = scene_surface - > surface ;
struct wlr_surface * surface = scene_surface - > surface ;
struct wlr_texture * texture = wlr_surface_get_texture ( surface ) ;
struct wlr_texture * texture = wlr_surface_get_texture ( surface ) ;