stub out muxserver frontend

This commit is contained in:
Wez Furlong committed 2019-03-22 20:41:50 -07:00
1 parent c6acc36ee5
commit 3c7eeac2da
4 files changed
+46 -27

No files matched your search

+8 -6
View File
@@ -7,9 +7,9 @@ use promise::Executor;
use std::rc::Rc;
use std::sync::Arc;
pub mod guicommon;
pub mod glium;
pub mod guicommon;
pub mod muxserver;
#[cfg(all(unix, not(feature = "force-glutin"), not(target_os = "macos")))]
pub mod xwindows;
@@ -17,6 +17,7 @@ pub mod xwindows;
pub enum FrontEndSelection {
Glutin,
X11,
MuxServer,
}
impl Default for FrontEndSelection {
@@ -33,19 +34,19 @@ impl Default for FrontEndSelection {
impl FrontEndSelection {
pub fn try_new(self, mux: &Rc<Mux>) -> Result<Rc<FrontEnd>, Error> {
let system = match self {
match self {
FrontEndSelection::Glutin => glium::glutinloop::GlutinFrontEnd::try_new(mux),
#[cfg(all(unix, not(target_os = "macos")))]
FrontEndSelection::X11 => xwindows::x11loop::X11FrontEnd::try_new(mux),
#[cfg(not(all(unix, not(target_os = "macos"))))]
FrontEndSelection::X11 => bail!("X11 not compiled in"),
};
system
FrontEndSelection::MuxServer => muxserver::MuxServerFrontEnd::try_new(mux),
}
}
// TODO: find or build a proc macro for this
pub fn variants() -> Vec<&'static str> {
vec!["Glutin", "X11"]
vec!["Glutin", "X11", "MuxServer"]
}
}
@@ -55,6 +56,7 @@ impl std::str::FromStr for FrontEndSelection {
match s.to_lowercase().as_ref() {
"glutin" => Ok(FrontEndSelection::Glutin),
"x11" => Ok(FrontEndSelection::X11),
"muxserver" => Ok(FrontEndSelection::MuxServer),
_ => Err(format_err!(
"{} is not a valid FrontEndSelection variant, possible values are {:?}",
s,
+37
View File
@@ -0,0 +1,37 @@
//! Implements the multiplexer server frontend
use crate::config::Config;
use crate::font::FontConfiguration;
use crate::frontend::FrontEnd;
use crate::mux::tab::Tab;
use crate::mux::Mux;
use failure::Error;
use promise::Executor;
use std::rc::Rc;
use std::sync::Arc;
pub struct MuxServerFrontEnd {}
impl MuxServerFrontEnd {
pub fn try_new(_mux: &Rc<Mux>) -> Result<Rc<FrontEnd>, Error> {
Ok(Rc::new(Self {}))
}
}
impl FrontEnd for MuxServerFrontEnd {
fn gui_executor(&self) -> Box<Executor> {
unimplemented!();
}
fn run_forever(&self) -> Result<(), Error> {
unimplemented!();
}
fn spawn_new_window(
&self,
_config: &Arc<Config>,
_fontconfig: &Rc<FontConfiguration>,
_tab: &Rc<Tab>,
) -> Result<(), Error> {
unimplemented!();
}
}
+1 -10
View File
@@ -96,11 +96,6 @@ struct Opt {
/// as if it were a login shell.
#[structopt(parse(from_os_str))]
prog: Vec<OsString>,
/// Rather than running the terminal, run as the
/// multiplexer server.
#[structopt(long = "start-mux-server")]
start_mux_server: bool,
}
fn run_terminal_gui(config: Arc<config::Config>, opts: Opt) -> Result<(), Error> {
@@ -134,11 +129,7 @@ fn main() -> Result<(), Error> {
});
println!("Using configuration: {:#?}\nopts: {:#?}", config, opts);
if opts.start_mux_server {
server::listener::run_mux_server(config)
} else {
run_terminal_gui(config, opts)
}
run_terminal_gui(config, opts)
}
fn spawn_tab(
-11
View File
@@ -1,10 +1,6 @@
use crate::config::Config;
use crate::mux::Mux;
use crate::server::{UnixListener, UnixStream};
use failure::Error;
use std::io::{Read, Write};
use std::rc::Rc;
use std::sync::Arc;
pub trait SocketLike: Read + Write + Send {}
@@ -38,10 +34,3 @@ impl Listener {
}
pub struct ClientSession {}
pub fn run_mux_server(config: Arc<Config>) -> Result<(), Error> {
let mux = Rc::new(Mux::default());
Mux::set_mux(&mux);
Ok(())
}