1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-02 23:55:11 +03:00

start to allow runtime gui frontend changes

This commit is contained in:
Wez Furlong 2019-02-19 21:09:55 -08:00
parent 98275e78e1
commit 4ab73ebb2c
3 changed files with 24 additions and 0 deletions

View File

@ -83,6 +83,8 @@ pub struct GuiEventLoop {
const TICK_INTERVAL: Duration = Duration::from_millis(50);
const MAX_POLL_LOOP_DURATION: Duration = Duration::from_millis(500);
impl super::GuiSystem for GuiEventLoop {}
impl GuiEventLoop {
pub fn new() -> Result<Self, Error> {
let event_loop = glium::glutin::EventsLoop::new();

View File

@ -1,6 +1,26 @@
use super::ExitStatus;
use failure::Error;
#[derive(Debug, Deserialize, Clone, Copy)]
pub enum GuiSelection {
Glutin,
X11,
}
impl Default for GuiSelection {
fn default() -> Self {
if cfg!(feature = "force-glutin") {
GuiSelection::Glutin
} else if cfg!(all(unix, not(target_os = "macos"))) {
GuiSelection::X11
} else {
GuiSelection::Glutin
}
}
}
pub trait GuiSystem {}
#[cfg(any(windows, feature = "force-glutin", target_os = "macos"))]
mod glutinloop;

View File

@ -71,6 +71,8 @@ const TOK_CORE: usize = 0xffff_ffff;
const TOK_CHLD: usize = 0xffff_fffd;
const TOK_XCB: usize = 0xffff_fffc;
impl super::GuiSystem for GuiEventLoop {}
impl GuiEventLoop {
pub fn new() -> Result<Self, Error> {
let poll = Poll::new()?;