Consider cursor and drag surfaces in visible_output_for_surface

This ensures that a commit to a cursor or drag surface will queue a
redraw, even if nothing else has changed on screen.

This can be tested by running `vkgears` in an otherwise empty
cosmic-comp instance, and dragging it.
This commit is contained in:
Ian Douglas Scott 2025-06-06 15:54:02 -07:00 committed by Victoria Brekenfeld
parent 3197e52afd
commit 726994b858

View file

@ -12,7 +12,7 @@ use std::{
use wayland_backend::server::ClientId;
use crate::wayland::{
handlers::data_device,
handlers::data_device::{self, get_dnd_icon},
protocols::workspace::{State as WState, WorkspaceCapabilities},
};
use cosmic_comp_config::{
@ -1833,6 +1833,38 @@ impl Shell {
.any(|e| e.has_surface(surface, WindowSurfaceType::ALL))
})
})
// cursor and drag surfaces
.or_else(|| {
self.outputs().find(|o| {
self.seats
.iter()
.filter(|seat| seat.active_output() == **o)
.any(|seat| {
let cursor_status = seat.cursor_image_status();
if let CursorImageStatus::Surface(s) = cursor_status {
if s == *surface {
return true;
}
}
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
for (window, _) in grab_state.element().windows() {
let mut matches = false;
window.0.with_surfaces(|s, _| {
matches |= s == surface;
});
if matches {
return true;
}
}
}
}
get_dnd_icon(seat).is_some_and(|icon| icon.surface == *surface)
})
})
})
}
pub fn workspace_for_surface(&self, surface: &WlSurface) -> Option<(WorkspaceHandle, Output)> {