hacky workaround to actually close focused client
This commit is contained in:
parent
f7855e4a52
commit
abac766e92
|
@ -52,7 +52,7 @@ pub async fn on_recv<Dpy: AsyncDisplay + ?Sized>(
|
|||
conn: &mut Dpy,
|
||||
) -> Result<()> {
|
||||
match &*data {
|
||||
"close" => manager.remove_focused_client(conn).await?,
|
||||
"close" => manager.destroy_focused_client(conn).await?,
|
||||
_ => println!("{}", data),
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -570,12 +570,23 @@ impl XcrabWindowManager {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn remove_focused_client<Dpy: AsyncDisplay + ?Sized>(
|
||||
pub async fn destroy_focused_client<Dpy: AsyncDisplay + ?Sized>(
|
||||
&mut self,
|
||||
conn: &mut Dpy,
|
||||
) -> Result<()> {
|
||||
if let Some(focused) = self.focused {
|
||||
self.remove_client(conn, focused).await
|
||||
let client_key = *self
|
||||
.clients
|
||||
.get(&focused)
|
||||
.ok_or(XcrabError::ClientDoesntExist)?;
|
||||
|
||||
self.remove_client(conn, focused).await?;
|
||||
|
||||
let client = self.rects.get(client_key).unwrap();
|
||||
|
||||
client.unwrap_client().frame.win.free_async(conn).await?;
|
||||
|
||||
Ok(())
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue