Skip to content

Commit

Permalink
refactor: remove some function
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Aug 10, 2024
1 parent 1cb6bbc commit 7c5e175
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
2 changes: 1 addition & 1 deletion iced_layershell/src/multi_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ where
.expect("Cannot send");
}
LayershellCustomActionsWithInfo::ForgetLastOutput => {
return ReturnData::ForgetLastOutput
ev.foget_last_output();

Check warning on line 372 in iced_layershell/src/multi_window.rs

View workflow job for this annotation

GitHub Actions / build

"foget" should be "forget".

Check warning on line 372 in iced_layershell/src/multi_window.rs

View workflow job for this annotation

GitHub Actions / build

"foget" should be "forget".
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions layershellev/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ pub enum ReturnData<INFO> {
RequestSetCursorShape((String, WlPointer, u32)),
NewLayerShell((NewLayerShellSettings, Option<INFO>)),
NewPopUp((NewPopUpSettings, Option<INFO>)),
RemoveShell(id::Id),
ForgetLastOutput,
None,
}

Expand Down
24 changes: 4 additions & 20 deletions layershellev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ impl<T> WindowState<T> {
}
self.units.remove(index);
}

pub fn foget_last_output(&mut self) {

Check warning on line 574 in layershellev/src/lib.rs

View workflow job for this annotation

GitHub Actions / build

"foget" should be "forget".

Check warning on line 574 in layershellev/src/lib.rs

View workflow job for this annotation

GitHub Actions / build

"foget" should be "forget".
self.last_wloutput.take();
}
}

/// Simple WindowState, without any data binding or info
Expand Down Expand Up @@ -1897,9 +1901,6 @@ impl<T: 'static> WindowState<T> {
cursor_surface.commit();
}
}
ReturnData::ForgetLastOutput => {
self.last_wloutput.take();
}
ReturnData::NewLayerShell((
NewLayerShellSettings {
size,
Expand Down Expand Up @@ -2038,23 +2039,6 @@ impl<T: 'static> WindowState<T> {
binding: info,
});
}
ReturnData::RemoveShell(id) => {
let Some(index) = self
.units
.iter()
.position(|unit| unit.id == id && unit.becreated)
else {
continue;
};

self.units[index].shell.destroy();
self.units[index].wl_surface.destroy();

if let Some(buffer) = self.units[index].buffer.as_ref() {
buffer.destroy()
}
self.units.remove(index);
}
_ => {}
}
}
Expand Down

0 comments on commit 7c5e175

Please sign in to comment.