restructure to put gui loop and window impls closer together
This commit is contained in:
1 parent
271dd0edf4
commit
bc313522a8
16 files changed
+38
-40
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
//! Configuration for the gui portion of the terminal
|
||||
|
||||
use crate::font::FontSystemSelection;
|
||||
use crate::guiloop::GuiSelection;
|
||||
use crate::frontend::guiloop::GuiSelection;
|
||||
use crate::{get_shell, Command};
|
||||
use directories::UserDirs;
|
||||
use failure::{err_msg, Error};
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
use super::GuiSystem;
|
||||
use crate::config::Config;
|
||||
use crate::font::{FontConfiguration, FontSystemSelection};
|
||||
use crate::gliumwindows;
|
||||
pub use crate::gliumwindows::GliumTerminalWindow;
|
||||
use crate::guicommon::window::TerminalWindow;
|
||||
use crate::guiloop::SessionTerminated;
|
||||
use crate::frontend::glium::window::GliumTerminalWindow;
|
||||
use crate::frontend::guicommon::window::TerminalWindow;
|
||||
use crate::frontend::guiloop::GuiSystem;
|
||||
use crate::frontend::guiloop::SessionTerminated;
|
||||
use crate::mux::tab::Tab;
|
||||
use crate::mux::Mux;
|
||||
use crate::spawn_tab;
|
||||
use failure::Error;
|
||||
use glium;
|
||||
use glium::glutin::EventsLoopProxy;
|
||||
pub use glium::glutin::WindowId;
|
||||
use glium::glutin::WindowId;
|
||||
use promise::{Executor, Future, SpawnFunc};
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
@@ -66,7 +65,7 @@ impl Executor for GlutinGuiExecutor {
|
||||
/// The primary mapping is from `WindowId` -> `GliumTerminalWindow`.
|
||||
#[derive(Default)]
|
||||
struct Windows {
|
||||
by_id: HashMap<WindowId, gliumwindows::GliumTerminalWindow>,
|
||||
by_id: HashMap<WindowId, GliumTerminalWindow>,
|
||||
}
|
||||
|
||||
/// The `GuiEventLoop` represents the combined gui event processor,
|
||||
@@ -236,7 +235,7 @@ impl GuiEventLoop {
|
||||
}
|
||||
|
||||
/// Add a window to the event loop and run it.
|
||||
pub fn add_window(&self, window: gliumwindows::GliumTerminalWindow) -> Result<(), Error> {
|
||||
pub fn add_window(&self, window: GliumTerminalWindow) -> Result<(), Error> {
|
||||
let window_id = window.window_id();
|
||||
let mut windows = self.windows.borrow_mut();
|
||||
windows.by_id.insert(window_id, window);
|
||||
@@ -0,0 +1,2 @@
|
||||
pub mod glutinloop;
|
||||
pub mod window;
|
||||
@@ -3,10 +3,10 @@
|
||||
use crate::config::Config;
|
||||
use crate::failure::Error;
|
||||
use crate::font::FontConfiguration;
|
||||
use crate::guicommon::host::{HostHelper, HostImpl, TabHost};
|
||||
use crate::guicommon::window::{Dimensions, TerminalWindow};
|
||||
use crate::guiloop::glutinloop::GuiEventLoop;
|
||||
use crate::guiloop::SessionTerminated;
|
||||
use crate::frontend::glium::glutinloop::GuiEventLoop;
|
||||
use crate::frontend::guicommon::host::{HostHelper, HostImpl, TabHost};
|
||||
use crate::frontend::guicommon::window::{Dimensions, TerminalWindow};
|
||||
use crate::frontend::guiloop::SessionTerminated;
|
||||
use crate::mux::tab::{Tab, TabId};
|
||||
use crate::mux::window::WindowId;
|
||||
use crate::mux::Mux;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,6 @@
|
||||
use crate::config::Config;
|
||||
use crate::font::FontConfiguration;
|
||||
use crate::guicommon::localtab::LocalTab;
|
||||
use crate::frontend::guicommon::localtab::LocalTab;
|
||||
use crate::mux::tab::{Tab, TabId};
|
||||
use crate::mux::window::WindowId;
|
||||
use crate::mux::Mux;
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::ExitStatus;
|
||||
use crate::config::Config;
|
||||
use crate::font::FontConfiguration;
|
||||
use crate::mux::tab::Tab;
|
||||
use crate::mux::Mux;
|
||||
use crate::ExitStatus;
|
||||
use failure::Error;
|
||||
use promise::Executor;
|
||||
use std::rc::Rc;
|
||||
@@ -29,9 +29,9 @@ impl Default for GuiSelection {
|
||||
impl GuiSelection {
|
||||
pub fn try_new(self, mux: &Rc<Mux>) -> Result<Rc<GuiSystem>, Error> {
|
||||
let system = match self {
|
||||
GuiSelection::Glutin => glutinloop::GlutinGuiSystem::try_new(mux),
|
||||
GuiSelection::Glutin => super::glium::glutinloop::GlutinGuiSystem::try_new(mux),
|
||||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
GuiSelection::X11 => x11::X11GuiSystem::try_new(mux),
|
||||
GuiSelection::X11 => super::xwindows::x11loop::X11GuiSystem::try_new(mux),
|
||||
#[cfg(not(all(unix, not(target_os = "macos"))))]
|
||||
GuiSelection::X11 => bail!("X11 not compiled in"),
|
||||
};
|
||||
@@ -74,10 +74,6 @@ pub trait GuiSystem {
|
||||
fn gui_executor(&self) -> Box<Executor>;
|
||||
}
|
||||
|
||||
pub mod glutinloop;
|
||||
#[cfg(all(unix, not(feature = "force-glutin"), not(target_os = "macos")))]
|
||||
pub mod x11;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[allow(dead_code)]
|
||||
pub enum SessionTerminated {
|
||||
@@ -0,0 +1,6 @@
|
||||
pub mod guicommon;
|
||||
pub mod guiloop;
|
||||
|
||||
pub mod glium;
|
||||
#[cfg(all(unix, not(feature = "force-glutin"), not(target_os = "macos")))]
|
||||
pub mod xwindows;
|
||||
File renamed without changes.
@@ -27,6 +27,7 @@ pub type Result<T> = result::Result<T, Error>;
|
||||
|
||||
mod xkeysyms;
|
||||
pub use self::xkeysyms::*;
|
||||
pub mod x11loop;
|
||||
pub mod xwin;
|
||||
|
||||
pub struct Connection {
|
||||
@@ -1,12 +1,12 @@
|
||||
use crate::config::Config;
|
||||
use crate::font::{FontConfiguration, FontSystemSelection};
|
||||
use crate::guicommon::window::TerminalWindow;
|
||||
use crate::guiloop::GuiSystem;
|
||||
use crate::frontend::guicommon::window::TerminalWindow;
|
||||
use crate::frontend::guiloop::GuiSystem;
|
||||
use crate::frontend::xwindows::xwin::X11TerminalWindow;
|
||||
use crate::frontend::xwindows::Connection;
|
||||
use crate::mux::tab::Tab;
|
||||
use crate::mux::Mux;
|
||||
use crate::spawn_tab;
|
||||
use crate::xwindows::xwin::X11TerminalWindow;
|
||||
use crate::xwindows::Connection;
|
||||
use failure::Error;
|
||||
use mio::{Events, Poll, PollOpt, Ready, Token};
|
||||
use mio_extras::channel::{channel, Receiver as GuiReceiver, Sender as GuiSender};
|
||||
@@ -70,7 +70,7 @@ thread_local! {
|
||||
static X11_EVENT_LOOP: RefCell<Option<Rc<GuiEventLoop>>> = RefCell::new(None);
|
||||
}
|
||||
|
||||
impl super::GuiSystem for X11GuiSystem {
|
||||
impl GuiSystem for X11GuiSystem {
|
||||
fn gui_executor(&self) -> Box<Executor> {
|
||||
self.event_loop.gui_executor()
|
||||
}
|
||||
File renamed without changes.
@@ -1,15 +1,15 @@
|
||||
use super::super::opengl::render::Renderer;
|
||||
use super::xkeysyms;
|
||||
use super::{Connection, Window};
|
||||
use crate::config::Config;
|
||||
use crate::font::FontConfiguration;
|
||||
use crate::guicommon::host::{HostHelper, HostImpl, TabHost};
|
||||
use crate::guicommon::window::{Dimensions, TerminalWindow};
|
||||
use crate::guiloop::x11::{GuiEventLoop, WindowId as X11WindowId};
|
||||
use crate::guiloop::SessionTerminated;
|
||||
use crate::frontend::guicommon::host::{HostHelper, HostImpl, TabHost};
|
||||
use crate::frontend::guicommon::window::{Dimensions, TerminalWindow};
|
||||
use crate::frontend::guiloop::SessionTerminated;
|
||||
use crate::frontend::xwindows::x11loop::{GuiEventLoop, WindowId as X11WindowId};
|
||||
use crate::mux::tab::{Tab, TabId};
|
||||
use crate::mux::window::WindowId;
|
||||
use crate::mux::Mux;
|
||||
use crate::opengl::render::Renderer;
|
||||
use failure::Error;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
+3
-9
@@ -10,22 +10,16 @@ use failure::Error;
|
||||
use std::ffi::OsString;
|
||||
use structopt::StructOpt;
|
||||
|
||||
#[cfg(all(unix, not(feature = "force-glutin"), not(target_os = "macos")))]
|
||||
mod xwindows;
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
mod config;
|
||||
mod gliumwindows;
|
||||
mod guicommon;
|
||||
mod guiloop;
|
||||
mod frontend;
|
||||
mod mux;
|
||||
mod opengl;
|
||||
mod server;
|
||||
use crate::guicommon::localtab::LocalTab;
|
||||
use crate::guiloop::GuiSelection;
|
||||
use crate::guiloop::GuiSystem;
|
||||
use crate::frontend::guicommon::localtab::LocalTab;
|
||||
use crate::frontend::guiloop::{GuiSelection, GuiSystem};
|
||||
use crate::mux::tab::Tab;
|
||||
use crate::mux::Mux;
|
||||
|
||||
|
||||
Reference in new issue
Block a user