1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 22:01:47 +03:00

fixup linux build

This commit is contained in:
Wez Furlong 2021-05-05 08:11:40 -07:00
parent 5d037eae52
commit 9fd04f6024
3 changed files with 41 additions and 0 deletions

View File

@ -14,6 +14,7 @@ use config::ConfigHandle;
use filedescriptor::FileDescriptor; use filedescriptor::FileDescriptor;
use promise::{Future, Promise}; use promise::{Future, Promise};
use smithay_client_toolkit as toolkit; use smithay_client_toolkit as toolkit;
use std::any::Any;
use std::cell::RefCell; use std::cell::RefCell;
use std::convert::TryInto; use std::convert::TryInto;
use std::io::{Read, Write}; use std::io::{Read, Write};
@ -610,6 +611,20 @@ impl WindowOps for WaylandWindow {
Ok(()) Ok(())
} }
fn notify<T: Any + Send + Sync>(&self, t: T)
where
Self: Sized,
{
let mut t = Some(t);
WaylandConnection::with_window_inner(self.0, move |inner| {
inner
.events
.try_send(WindowEvent::Notification(Box::new(t.take().unwrap())))
.ok();
Ok(())
});
}
fn close(&self) -> Future<()> { fn close(&self) -> Future<()> {
WaylandConnection::with_window_inner(self.0, |inner| { WaylandConnection::with_window_inner(self.0, |inner| {
inner.close(); inner.close();

View File

@ -12,6 +12,7 @@ use anyhow::{anyhow, Context as _};
use async_trait::async_trait; use async_trait::async_trait;
use config::ConfigHandle; use config::ConfigHandle;
use promise::{Future, Promise}; use promise::{Future, Promise};
use std::any::Any;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::convert::TryInto; use std::convert::TryInto;
use std::rc::{Rc, Weak}; use std::rc::{Rc, Weak};
@ -900,6 +901,20 @@ impl WindowOps for XWindow {
.await .await
} }
fn notify<T: Any + Send + Sync>(&self, t: T)
where
Self: Sized,
{
let mut t = Some(t);
XConnection::with_window_inner(self.0, move |inner| {
inner
.events
.try_send(WindowEvent::Notification(Box::new(t.take().unwrap())))
.ok();
Ok(())
});
}
fn close(&self) -> Future<()> { fn close(&self) -> Future<()> {
XConnection::with_window_inner(self.0, |inner| { XConnection::with_window_inner(self.0, |inner| {
inner.close(); inner.close();

View File

@ -11,6 +11,7 @@ use crate::{Clipboard, Dimensions, MouseCursor, ScreenPoint, WindowEventReceiver
use async_trait::async_trait; use async_trait::async_trait;
use config::ConfigHandle; use config::ConfigHandle;
use promise::*; use promise::*;
use std::any::Any;
use std::rc::Rc; use std::rc::Rc;
pub enum Connection { pub enum Connection {
@ -144,6 +145,16 @@ impl WindowOps for Window {
Self::Wayland(w) => w.close(), Self::Wayland(w) => w.close(),
} }
} }
fn notify<T: Any + Send + Sync>(&self, t: T)
where
Self: Sized,
{
match self {
Self::X11(x) => x.notify(t),
#[cfg(feature = "wayland")]
Self::Wayland(w) => w.notify(t),
}
}
fn hide(&self) -> Future<()> { fn hide(&self) -> Future<()> {
match self { match self {