From 916b7729a542c2f037522bc03efc7d2980faa939 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Tue, 16 Apr 2024 15:34:25 -0700 Subject: [PATCH] fix: Add `Element::kind` method to `CosmicElement` The default implementation always returned `Kind::Unspecified`. Instead, we should pass this method through to the wrapped element. This fixes the use of cursor planes. Now trace logs show Smithay assigning an element to the cursor plane, and tools like `drm_info` show the cursor plane with an `FB_ID` attached. --- src/backend/render/element.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/backend/render/element.rs b/src/backend/render/element.rs index 22527785..66220daf 100644 --- a/src/backend/render/element.rs +++ b/src/backend/render/element.rs @@ -5,7 +5,7 @@ use smithay::{ element::{ surface::WaylandSurfaceRenderElement, utils::{Relocate, RelocateRenderElement}, - Element, Id, RenderElement, UnderlyingStorage, + Element, Id, Kind, RenderElement, UnderlyingStorage, }, glow::{GlowFrame, GlowRenderer}, utils::{CommitCounter, DamageSet}, @@ -151,6 +151,18 @@ where CosmicElement::Egui(elem) => elem.alpha(), } } + + fn kind(&self) -> Kind { + match self { + CosmicElement::Workspace(elem) => elem.kind(), + CosmicElement::Cursor(elem) => elem.kind(), + CosmicElement::Dnd(elem) => elem.kind(), + CosmicElement::MoveGrab(elem) => elem.kind(), + CosmicElement::AdditionalDamage(elem) => elem.kind(), + #[cfg(feature = "debug")] + CosmicElement::Egui(elem) => elem.kind(), + } + } } impl RenderElement for CosmicElement {