Move some trait bounds to definition of AsGlowRenderer

Everything implementing `AsGlowRenderer` implements `Renderer` and various
other traits, and by making `AsGlowRenderer` depend on these trait,
things requiring `AsGlowRenderer` can avoid listing those traits as
well.

Looks like implied trait bounds still won't work for the
`Self::TexutureId` and `Self::Error` requirements? So those are not
included here.
This commit is contained in:
Ian Douglas Scott 2026-03-11 10:04:15 -07:00
parent d902f4b5c3
commit c860fcddad
9 changed files with 86 additions and 93 deletions

View file

@ -45,11 +45,10 @@ use cosmic::Theme;
use element::FromGlesError;
use smithay::{
backend::{
allocator::{Fourcc, dmabuf::Dmabuf},
allocator::Fourcc,
drm::{DrmDeviceFd, DrmNode},
renderer::{
Bind, Blit, Color32F, ExportMem, ImportAll, ImportMem, Offscreen, Renderer, Texture,
TextureFilter,
Color32F, ImportAll, Offscreen, Renderer, Texture, TextureFilter,
damage::{Error as RenderError, OutputDamageTracker, RenderOutputResult},
element::{
Element, Id, Kind, RenderElement, WeakId,
@ -478,7 +477,7 @@ pub fn cursor_elements<'a, 'frame, R>(
exclude_dnd_icon: bool,
) -> Vec<CosmicElement<R>>
where
R: Renderer + ImportAll + ImportMem + AsGlowRenderer,
R: AsGlowRenderer,
R::TextureId: Send + Clone + 'static,
CosmicMappedRenderElement<R>: RenderElement<R>,
{
@ -620,7 +619,7 @@ pub fn output_elements<R>(
_fps: Option<(&EguiState, &Timings)>,
) -> Result<Vec<CosmicElement<R>>, RenderError<R::Error>>
where
R: Renderer + ImportAll + ImportMem + AsGlowRenderer,
R: AsGlowRenderer,
R::TextureId: Send + Clone + 'static,
R::Error: FromGlesError,
CosmicMappedRenderElement<R>: RenderElement<R>,
@ -718,7 +717,7 @@ pub fn workspace_elements<R>(
element_filter: ElementFilter,
) -> Result<Vec<CosmicElement<R>>, RenderError<R::Error>>
where
R: Renderer + ImportAll + ImportMem + AsGlowRenderer,
R: AsGlowRenderer,
R::TextureId: Send + Clone + 'static,
R::Error: FromGlesError,
CosmicMappedRenderElement<R>: RenderElement<R>,
@ -1060,7 +1059,7 @@ pub struct PostprocessState {
}
impl PostprocessState {
pub fn new_with_renderer<R: AsGlowRenderer + Offscreen<GlesTexture>>(
pub fn new_with_renderer<R: AsGlowRenderer>(
renderer: &mut R,
format: Fourcc,
output_config: PostprocessOutputConfig,
@ -1091,7 +1090,7 @@ impl PostprocessState {
})
}
pub fn track_cursor<R: AsGlowRenderer + Offscreen<GlesTexture>>(
pub fn track_cursor<R: AsGlowRenderer>(
&mut self,
renderer: &mut R,
format: Fourcc,
@ -1193,14 +1192,7 @@ pub fn render_output<'d, R>(
loop_handle: &calloop::LoopHandle<'static, State>,
) -> Result<RenderOutputResult<'d>, RenderError<R::Error>>
where
R: Renderer
+ ImportAll
+ ImportMem
+ ExportMem
+ Bind<Dmabuf>
+ Offscreen<GlesTexture>
+ Blit
+ AsGlowRenderer,
R: AsGlowRenderer,
R::TextureId: Send + Clone + 'static,
R::Error: FromGlesError,
CosmicElement<R>: RenderElement<R>,
@ -1505,7 +1497,7 @@ pub fn render_workspace<'d, R>(
element_filter: ElementFilter,
) -> Result<(RenderOutputResult<'d>, Vec<CosmicElement<R>>), RenderError<R::Error>>
where
R: Renderer + ImportAll + ImportMem + ExportMem + Bind<Dmabuf> + AsGlowRenderer,
R: AsGlowRenderer,
R::TextureId: Send + Clone + 'static,
R::Error: FromGlesError,
CosmicElement<R>: RenderElement<R>,