1
0
Fork 0
forked from wry/wry

surface: don't destroy idle inhibitors when destroying node

This commit is contained in:
Julian Orth 2024-03-29 18:37:03 +01:00
parent 7661e011c0
commit 566a05494a
2 changed files with 4 additions and 4 deletions

View file

@ -236,7 +236,7 @@ pub struct WlSurface {
cursors: SmallMap<SeatId, Rc<CursorSurface>, 1>,
pub dnd_icons: SmallMap<SeatId, Rc<WlSeatGlobal>, 1>,
pub tracker: Tracker<Self>,
idle_inhibitors: CopyHashMap<ZwpIdleInhibitorV1Id, Rc<ZwpIdleInhibitorV1>>,
idle_inhibitors: SmallMap<ZwpIdleInhibitorV1Id, Rc<ZwpIdleInhibitorV1>, 1>,
viewporter: CloneCell<Option<Rc<WpViewport>>>,
output: CloneCell<Rc<OutputNode>>,
fractional_scale: CloneCell<Option<Rc<WpFractionalScaleV1>>>,
@ -1186,7 +1186,7 @@ impl WlSurface {
pub fn set_visible(&self, visible: bool) {
self.visible.set(visible);
for inhibitor in self.idle_inhibitors.lock().values() {
for (_, inhibitor) in &self.idle_inhibitors {
if visible {
inhibitor.activate();
} else {
@ -1213,7 +1213,7 @@ impl WlSurface {
for (_, constraint) in &self.constraints {
constraint.deactivate();
}
for (_, inhibitor) in self.idle_inhibitors.lock().drain() {
for (_, inhibitor) in &self.idle_inhibitors {
inhibitor.deactivate();
}
let children = self.children.borrow();

View file

@ -32,7 +32,7 @@ impl ZwpIdleInhibitorV1 {
}
pub fn install(self: &Rc<Self>) -> Result<(), ZwpIdleInhibitorV1Error> {
self.surface.idle_inhibitors.set(self.id, self.clone());
self.surface.idle_inhibitors.insert(self.id, self.clone());
if self.surface.visible.get() {
self.activate();
}