Skip to content

Commit

Permalink
add way to make subsurfaces from surfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhbooth committed Apr 11, 2024
1 parent f3587a9 commit e3ab33e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/subcompositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ impl SubcompositorState {
self.subcompositor.get_subsurface(&surface, &parent, queue_handle, subsurface_data);
(subsurface, surface)
}

pub fn create_subsurface_for_surface<State>(
&self,
surface: &WlSurface,
queue_handle: &QueueHandle<State>,
) -> WlSubsurface
where
State: Dispatch<WlSurface, SurfaceData> + Dispatch<WlSubsurface, SubsurfaceData> + 'static,
{
let parent = surface.data::<SurfaceData>().unwrap().parent_surface().unwrap();
let subsurface_data = SubsurfaceData::new(surface.clone());
let subsurface =
self.subcompositor.get_subsurface(surface, &parent, queue_handle, subsurface_data);
subsurface
}
}

impl<D> Dispatch<WlSubsurface, SubsurfaceData, D> for SubcompositorState
Expand Down

0 comments on commit e3ab33e

Please sign in to comment.