mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-27 11:16:03 +00:00
Do not use chan_signal on windows
This commit is contained in:
parent
26e5f51192
commit
3f16e8ed60
@ -38,7 +38,7 @@ version = "1.0.0"
|
|||||||
optional = true
|
optional = true
|
||||||
version = "1.3.1"
|
version = "1.3.1"
|
||||||
|
|
||||||
[dependencies.chan-signal]
|
[target.'cfg(unix)'.dependencies.chan-signal]
|
||||||
version = "0.3"
|
version = "0.3"
|
||||||
|
|
||||||
[dependencies.ncurses]
|
[dependencies.ncurses]
|
||||||
|
@ -364,6 +364,19 @@ fn on_resize() {
|
|||||||
pancurses::resize_term(size.y as i32, size.x as i32);
|
pancurses::resize_term(size.y as i32, size.x as i32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
fn resize_channel() -> chan::Receiver<chan_signal::Signal> {
|
||||||
|
chan_signal::notify(&[chan_signal::Signal::WINCH])
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(unix))]
|
||||||
|
fn resize_channel() -> chan::Receiver<()> {
|
||||||
|
let (sender, receiver) = chan::async();
|
||||||
|
// Forget the sender, so the channel doesn't close, but never completes.
|
||||||
|
::std::mem::forget(sender);
|
||||||
|
receiver
|
||||||
|
}
|
||||||
|
|
||||||
impl backend::Backend for Backend {
|
impl backend::Backend for Backend {
|
||||||
fn screen_size(&self) -> Vec2 {
|
fn screen_size(&self) -> Vec2 {
|
||||||
// Coordinates are reversed here
|
// Coordinates are reversed here
|
||||||
@ -438,7 +451,7 @@ impl backend::Backend for Backend {
|
|||||||
&mut self, event_sink: chan::Sender<Event>,
|
&mut self, event_sink: chan::Sender<Event>,
|
||||||
stops: chan::Receiver<bool>,
|
stops: chan::Receiver<bool>,
|
||||||
) {
|
) {
|
||||||
let resize = chan_signal::notify(&[chan_signal::Signal::WINCH]);
|
let resize = resize_channel();
|
||||||
let (sender, receiver) = chan::async();
|
let (sender, receiver) = chan::async();
|
||||||
let needs_resize = Arc::clone(&self.needs_resize);
|
let needs_resize = Arc::clone(&self.needs_resize);
|
||||||
|
|
||||||
|
@ -74,7 +74,11 @@ extern crate chan;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate maplit;
|
extern crate maplit;
|
||||||
|
|
||||||
|
// We use chan_signal to detect SIGWINCH.
|
||||||
|
// It's not how windows work, so no need to use that.
|
||||||
|
#[cfg(unix)]
|
||||||
extern crate chan_signal;
|
extern crate chan_signal;
|
||||||
|
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
extern crate num;
|
extern crate num;
|
||||||
extern crate owning_ref;
|
extern crate owning_ref;
|
||||||
|
Loading…
Reference in New Issue
Block a user