Skip to content

Commit 726994b

Browse files
ids1024Drakulix
authored andcommitted
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.
1 parent 3197e52 commit 726994b

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

src/shell/mod.rs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::{
1212
use wayland_backend::server::ClientId;
1313

1414
use crate::wayland::{
15-
handlers::data_device,
15+
handlers::data_device::{self, get_dnd_icon},
1616
protocols::workspace::{State as WState, WorkspaceCapabilities},
1717
};
1818
use cosmic_comp_config::{
@@ -1833,6 +1833,38 @@ impl Shell {
18331833
.any(|e| e.has_surface(surface, WindowSurfaceType::ALL))
18341834
})
18351835
})
1836+
// cursor and drag surfaces
1837+
.or_else(|| {
1838+
self.outputs().find(|o| {
1839+
self.seats
1840+
.iter()
1841+
.filter(|seat| seat.active_output() == **o)
1842+
.any(|seat| {
1843+
let cursor_status = seat.cursor_image_status();
1844+
if let CursorImageStatus::Surface(s) = cursor_status {
1845+
if s == *surface {
1846+
return true;
1847+
}
1848+
}
1849+
1850+
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
1851+
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
1852+
for (window, _) in grab_state.element().windows() {
1853+
let mut matches = false;
1854+
window.0.with_surfaces(|s, _| {
1855+
matches |= s == surface;
1856+
});
1857+
if matches {
1858+
return true;
1859+
}
1860+
}
1861+
}
1862+
}
1863+
1864+
get_dnd_icon(seat).is_some_and(|icon| icon.surface == *surface)
1865+
})
1866+
})
1867+
})
18361868
}
18371869

18381870
pub fn workspace_for_surface(&self, surface: &WlSurface) -> Option<(WorkspaceHandle, Output)> {

0 commit comments

Comments
 (0)