diff --git a/compositor/src/backends/direct.rs b/compositor/src/backends/direct.rs index 123dc7e..992b37f 100644 --- a/compositor/src/backends/direct.rs +++ b/compositor/src/backends/direct.rs @@ -380,6 +380,7 @@ fn send_frame_callbacks(state: &mut Ferese) { |_, _| Some(output.clone()), ); }); + state.send_cursor_frame(&output); state.space.refresh(); state.popups.cleanup(); if let Err(error) = state.display_handle.flush_clients() { diff --git a/compositor/src/state.rs b/compositor/src/state.rs index f8e014e..bcb90c1 100644 --- a/compositor/src/state.rs +++ b/compositor/src/state.rs @@ -3,7 +3,7 @@ use std::{ error::Error, ffi::OsString, sync::Arc, - time::Instant, + time::{Duration, Instant}, }; use ferese_animation::{ClientSize, SpringConfig, WindowGeometry}; @@ -12,8 +12,9 @@ use ferese_layout::{Axis, Direction, GapConfig, LayoutResult, Rect, SizeConstrai use smithay::{ backend::drm::DrmEventTime, - desktop::{PopupManager, Space, Window, WindowSurfaceType}, + desktop::{PopupManager, Space, Window, WindowSurfaceType, utils::send_frames_surface_tree}, input::{Seat, SeatState, pointer::CursorImageStatus}, + output::Output, reexports::{ calloop::{EventLoop, Interest, LoopSignal, Mode, PostAction, generic::Generic}, wayland_protocols::xdg::shell::server::xdg_toplevel, @@ -191,6 +192,20 @@ impl Ferese { }) } + pub fn send_cursor_frame(&self, output: &Output) { + let CursorImageStatus::Surface(surface) = &self.cursor_status else { + return; + }; + + send_frames_surface_tree( + surface, + output, + self.start_time.elapsed(), + Some(Duration::ZERO), + |_, _| Some(output.clone()), + ); + } + pub fn window_under_visual(&self, position: Point) -> Option { self.space.elements().rev().find_map(|window| { let id = self.window_ids.get(window)?; diff --git a/compositor/src/winit.rs b/compositor/src/winit.rs index 16769b9..1ad8467 100644 --- a/compositor/src/winit.rs +++ b/compositor/src/winit.rs @@ -138,6 +138,7 @@ pub fn init(event_loop: &mut EventLoop, state: &mut Ferese) -> Result<() |_, _| Some(output.clone()), ); }); + state.send_cursor_frame(&output); state.space.refresh(); state.popups.cleanup(); if let Err(error) = state.display_handle.flush_clients() {