mirror of
https://github.com/wez/wezterm.git
synced 2024-12-25 06:12:16 +03:00
window: don't propagate errors from close notif channel
When a window is being destroyed we expect the receiver end to be disconnected, so we don't want to break out of the message loop if a couple of residual windows fail to notify.
This commit is contained in:
parent
453cfc1813
commit
325e755216
@ -478,7 +478,10 @@ impl Window {
|
|||||||
// Synthesize a resize event immediately; this allows
|
// Synthesize a resize event immediately; this allows
|
||||||
// the embedding application an opportunity to discover
|
// the embedding application an opportunity to discover
|
||||||
// the dpi and adjust for display scaling
|
// the dpi and adjust for display scaling
|
||||||
inner.borrow_mut().events.try_send(WindowEvent::Resized {
|
inner
|
||||||
|
.borrow_mut()
|
||||||
|
.events
|
||||||
|
.try_send(WindowEvent::Resized {
|
||||||
dimensions: Dimensions {
|
dimensions: Dimensions {
|
||||||
pixel_width: width as usize,
|
pixel_width: width as usize,
|
||||||
pixel_height: height as usize,
|
pixel_height: height as usize,
|
||||||
@ -486,7 +489,8 @@ impl Window {
|
|||||||
as usize,
|
as usize,
|
||||||
},
|
},
|
||||||
is_full_screen: false,
|
is_full_screen: false,
|
||||||
})?;
|
})
|
||||||
|
.ok();
|
||||||
|
|
||||||
Ok((window, receiver))
|
Ok((window, receiver))
|
||||||
}
|
}
|
||||||
|
@ -596,7 +596,7 @@ impl WaylandWindowInner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn do_paint(&mut self) -> anyhow::Result<()> {
|
fn do_paint(&mut self) -> anyhow::Result<()> {
|
||||||
self.events.try_send(WindowEvent::NeedRepaint)?;
|
self.events.try_send(WindowEvent::NeedRepaint).ok();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ impl XWindowInner {
|
|||||||
}
|
}
|
||||||
self.paint_all = false;
|
self.paint_all = false;
|
||||||
self.expose.clear();
|
self.expose.clear();
|
||||||
self.events.try_send(WindowEvent::NeedRepaint)?;
|
self.events.try_send(WindowEvent::NeedRepaint).ok();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ impl XWindowInner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn do_mouse_event(&mut self, event: MouseEvent) -> anyhow::Result<()> {
|
fn do_mouse_event(&mut self, event: MouseEvent) -> anyhow::Result<()> {
|
||||||
self.events.try_send(WindowEvent::MouseEvent(event))?;
|
self.events.try_send(WindowEvent::MouseEvent(event)).ok();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,17 +213,19 @@ impl XWindowInner {
|
|||||||
self.resize_promises.remove(0).ok(dimensions);
|
self.resize_promises.remove(0).ok(dimensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.events.try_send(WindowEvent::Resized {
|
self.events
|
||||||
|
.try_send(WindowEvent::Resized {
|
||||||
dimensions,
|
dimensions,
|
||||||
is_full_screen: self.is_fullscreen().unwrap_or(false),
|
is_full_screen: self.is_fullscreen().unwrap_or(false),
|
||||||
})?;
|
})
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
xcb::KEY_PRESS | xcb::KEY_RELEASE => {
|
xcb::KEY_PRESS | xcb::KEY_RELEASE => {
|
||||||
let key_press: &xcb::KeyPressEvent = unsafe { xcb::cast_event(event) };
|
let key_press: &xcb::KeyPressEvent = unsafe { xcb::cast_event(event) };
|
||||||
self.copy_and_paste.time = key_press.time();
|
self.copy_and_paste.time = key_press.time();
|
||||||
if let Some(key) = conn.keyboard.process_key_event(key_press) {
|
if let Some(key) = conn.keyboard.process_key_event(key_press) {
|
||||||
let key = key.normalize_shift();
|
let key = key.normalize_shift();
|
||||||
self.events.try_send(WindowEvent::KeyEvent(key))?;
|
self.events.try_send(WindowEvent::KeyEvent(key)).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +312,7 @@ impl XWindowInner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
xcb::DESTROY_NOTIFY => {
|
xcb::DESTROY_NOTIFY => {
|
||||||
self.events.try_send(WindowEvent::Destroyed)?;
|
self.events.try_send(WindowEvent::Destroyed).ok();
|
||||||
conn.windows.borrow_mut().remove(&self.window_id);
|
conn.windows.borrow_mut().remove(&self.window_id);
|
||||||
}
|
}
|
||||||
xcb::SELECTION_CLEAR => {
|
xcb::SELECTION_CLEAR => {
|
||||||
@ -353,11 +355,11 @@ impl XWindowInner {
|
|||||||
}
|
}
|
||||||
xcb::FOCUS_IN => {
|
xcb::FOCUS_IN => {
|
||||||
log::trace!("Calling focus_change(true)");
|
log::trace!("Calling focus_change(true)");
|
||||||
self.events.try_send(WindowEvent::FocusChanged(true))?;
|
self.events.try_send(WindowEvent::FocusChanged(true)).ok();
|
||||||
}
|
}
|
||||||
xcb::FOCUS_OUT => {
|
xcb::FOCUS_OUT => {
|
||||||
log::trace!("Calling focus_change(false)");
|
log::trace!("Calling focus_change(false)");
|
||||||
self.events.try_send(WindowEvent::FocusChanged(false))?;
|
self.events.try_send(WindowEvent::FocusChanged(false)).ok();
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
eprintln!("unhandled: {:x}", r);
|
eprintln!("unhandled: {:x}", r);
|
||||||
|
Loading…
Reference in New Issue
Block a user