diff --git a/src/backend/udev.rs b/src/backend/udev.rs index 413116e..166ec87 100644 --- a/src/backend/udev.rs +++ b/src/backend/udev.rs @@ -85,10 +85,8 @@ use smithay_drm_extras::{ use crate::{ config::api::msg::{Args, OutgoingMsg}, - render::{pointer::PointerElement, CustomRenderElements}, - state::{ - take_presentation_feedback, Backend, CalloopData, State, SurfaceDmabufFeedback, WithState, - }, + render::{pointer::PointerElement, take_presentation_feedback, CustomRenderElements}, + state::{Backend, CalloopData, State, SurfaceDmabufFeedback, WithState}, window::WindowElement, }; diff --git a/src/backend/winit.rs b/src/backend/winit.rs index 412c296..23635a8 100644 --- a/src/backend/winit.rs +++ b/src/backend/winit.rs @@ -34,8 +34,8 @@ use smithay::{ }; use crate::{ - render::pointer::PointerElement, - state::{take_presentation_feedback, Backend, CalloopData, State, WithState}, + render::{pointer::PointerElement, take_presentation_feedback}, + state::{Backend, CalloopData, State, WithState}, }; use super::BackendData; diff --git a/src/render.rs b/src/render.rs index 3d4f0e8..f2a9807 100644 --- a/src/render.rs +++ b/src/render.rs @@ -6,13 +6,17 @@ use smithay::{ backend::renderer::{ element::{ self, surface::WaylandSurfaceRenderElement, texture::TextureBuffer, AsRenderElements, - Wrap, + RenderElementStates, Wrap, }, ImportAll, ImportMem, Renderer, Texture, }, desktop::{ layer_map_for_output, space::{SpaceElement, SpaceRenderElements, SurfaceTree}, + utils::{ + surface_presentation_feedback_flags_from_states, surface_primary_scanout_output, + OutputPresentationFeedback, + }, Space, }, input::pointer::{CursorImageAttributes, CursorImageStatus}, @@ -325,3 +329,37 @@ where output_render_elements } + +// TODO: docs +pub fn take_presentation_feedback( + output: &Output, + space: &Space, + render_element_states: &RenderElementStates, +) -> OutputPresentationFeedback { + let mut output_presentation_feedback = OutputPresentationFeedback::new(output); + + space.elements().for_each(|window| { + if space.outputs_for_element(window).contains(output) { + window.take_presentation_feedback( + &mut output_presentation_feedback, + surface_primary_scanout_output, + |surface, _| { + surface_presentation_feedback_flags_from_states(surface, render_element_states) + }, + ); + } + }); + + let map = smithay::desktop::layer_map_for_output(output); + for layer_surface in map.layers() { + layer_surface.take_presentation_feedback( + &mut output_presentation_feedback, + surface_primary_scanout_output, + |surface, _| { + surface_presentation_feedback_flags_from_states(surface, render_element_states) + }, + ); + } + + output_presentation_feedback +} diff --git a/src/state.rs b/src/state.rs index 0e01bd3..74312f9 100644 --- a/src/state.rs +++ b/src/state.rs @@ -25,16 +25,8 @@ use crate::{ }; use calloop::{channel::Sender, futures::Scheduler, RegistrationToken}; use smithay::{ - backend::renderer::element::RenderElementStates, - desktop::{ - utils::{ - surface_presentation_feedback_flags_from_states, surface_primary_scanout_output, - OutputPresentationFeedback, - }, - PopupManager, Space, - }, + desktop::{PopupManager, Space}, input::{keyboard::XkbConfig, pointer::CursorImageStatus, Seat, SeatState}, - output::Output, reexports::{ calloop::{ self, channel::Event, generic::Generic, Interest, LoopHandle, LoopSignal, Mode, @@ -399,40 +391,6 @@ pub struct SurfaceDmabufFeedback<'a> { pub scanout_feedback: &'a DmabufFeedback, } -// TODO: docs -pub fn take_presentation_feedback( - output: &Output, - space: &Space, - render_element_states: &RenderElementStates, -) -> OutputPresentationFeedback { - let mut output_presentation_feedback = OutputPresentationFeedback::new(output); - - space.elements().for_each(|window| { - if space.outputs_for_element(window).contains(output) { - window.take_presentation_feedback( - &mut output_presentation_feedback, - surface_primary_scanout_output, - |surface, _| { - surface_presentation_feedback_flags_from_states(surface, render_element_states) - }, - ); - } - }); - - let map = smithay::desktop::layer_map_for_output(output); - for layer_surface in map.layers() { - layer_surface.take_presentation_feedback( - &mut output_presentation_feedback, - surface_primary_scanout_output, - |surface, _| { - surface_presentation_feedback_flags_from_states(surface, render_element_states) - }, - ); - } - - output_presentation_feedback -} - pub struct ApiState { // TODO: this may not need to be in an arc mutex because of the move to async /// The stream API messages are being sent through