1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-20 19:27:22 +03:00

add feature to force building with glutin on linux

this helps me verify from WSL that I didn't break compilation in
the refactoring to follow
This commit is contained in:
Wez Furlong 2019-02-16 09:27:22 -08:00
parent 9bc99f5f1c
commit d95da9c159
5 changed files with 23 additions and 28 deletions

View File

@ -55,5 +55,6 @@ core-text = "~9.2"
[features]
debug-escape-sequences = ["term/debug-escape-sequences"]
force-glutin = []
[workspace]

View File

@ -9,7 +9,7 @@ use font::FontConfiguration;
use futures;
use glium;
use glium::glutin::{self, ElementState, MouseCursor};
use guiloop::GuiEventLoop;
use guiloop::{GuiEventLoop, SessionTerminated};
use opengl::render::Renderer;
use opengl::textureatlas::OutOfTextureSpace;
use pty::MasterPty;
@ -18,11 +18,11 @@ use std::io::{Read, Write};
use std::os::unix::io::{AsRawFd, RawFd};
use std::process::{Child, Command, ExitStatus};
use std::rc::Rc;
use term::hyperlink::Hyperlink;
use term::KeyCode;
use term::KeyModifiers;
use term::{self, Terminal};
use term::{MouseButton, MouseEventKind};
use termwiz::hyperlink::Hyperlink;
struct Host {
display: glium::Display,
@ -41,10 +41,10 @@ impl term::TerminalHost for Host {
fn click_link(&mut self, link: &Rc<Hyperlink>) {
// TODO: make this configurable
let mut cmd = Command::new("xdg-open");
cmd.arg(&link.url);
cmd.arg(link.uri());
match cmd.spawn() {
Ok(_) => {}
Err(err) => eprintln!("failed to spawn xdg-open {}: {:?}", link.url, err),
Err(err) => eprintln!("failed to spawn xdg-open {}: {:?}", link.uri(), err),
}
}
@ -533,7 +533,7 @@ impl TerminalWindow {
event: WindowEvent::Moved(x, y),
..
} => {
self.window_position = Some((x, y));
self.host.window_position = Some((x, y));
}
Event::WindowEvent {
event: WindowEvent::ReceivedCharacter(c),

View File

@ -1,7 +1,7 @@
use failure::Error;
use futures::{future, Future};
use glium;
use glium::glutin::{EventsLoopProxy, WindowId};
use glium::glutin::EventsLoopProxy;
use mio;
use mio::{PollOpt, Ready, Token};
use std::cell::RefCell;
@ -12,6 +12,9 @@ use std::rc::Rc;
use std::sync::mpsc::{self, Receiver, Sender, TryRecvError};
use std::time::Duration;
pub use glium::glutin::WindowId;
pub use gliumwindows::TerminalWindow;
use futurecore;
use gliumwindows;
use remotemio;
@ -115,7 +118,7 @@ impl GuiEventLoop {
let dead = match self.windows.borrow_mut().by_id.get_mut(&window_id) {
Some(window) => match window.dispatch_event(event) {
Ok(_) => None,
Err(err) => match err.downcast_ref::<gliumwindows::SessionTerminated>() {
Err(err) => match err.downcast_ref::<super::SessionTerminated>() {
Some(_) => Some(window_id),
_ => return Err(err),
},
@ -187,10 +190,7 @@ impl GuiEventLoop {
};
if let Err(err) = result {
if err
.downcast_ref::<gliumwindows::SessionTerminated>()
.is_some()
{
if err.downcast_ref::<super::SessionTerminated>().is_some() {
self.schedule_window_close(window_id)?;
} else {
bail!("{:?}", err);

View File

@ -1,28 +1,22 @@
use failure::Error;
use std::process::ExitStatus;
#[cfg(any(windows, target_os = "macos"))]
#[cfg(any(windows, feature = "force-glutin", target_os = "macos"))]
mod glutinloop;
#[cfg(any(windows, target_os = "macos"))]
pub use glutinloop::{GuiEventLoop, GuiSender};
#[cfg(any(windows, feature = "force-glutin", target_os = "macos"))]
pub use self::glutinloop::{GuiEventLoop, GuiSender, TerminalWindow, WindowId};
#[cfg(any(windows, target_os = "macos"))]
pub use gliumwindows::TerminalWindow;
#[cfg(any(windows, feature = "force-glutin", target_os = "macos"))]
pub use std::sync::mpsc::Receiver as GuiReceiver;
#[cfg(any(windows, target_os = "macos"))]
pub use mpsc::Receiver as GuiReceiver;
#[cfg(any(windows, target_os = "macos"))]
pub use glium::glutin::WindowId;
#[cfg(all(unix, not(target_os = "macos")))]
#[cfg(all(unix, not(feature = "force-glutin"), not(target_os = "macos")))]
pub use xwindows::xwin::TerminalWindow;
#[cfg(all(unix, not(target_os = "macos")))]
#[cfg(all(unix, not(feature = "force-glutin"), not(target_os = "macos")))]
mod x11;
#[cfg(all(unix, not(target_os = "macos")))]
#[cfg(all(unix, not(feature = "force-glutin"), not(target_os = "macos")))]
pub use self::x11::*;
#[derive(Debug, Fail)]

View File

@ -41,7 +41,7 @@ extern crate x11;
extern crate xcb;
#[cfg(all(unix, not(target_os = "macos")))]
extern crate xcb_util;
#[cfg(all(unix, not(target_os = "macos")))]
#[cfg(all(unix, not(feature = "force-glutin"), not(target_os = "macos")))]
mod xwindows;
use std::process::Command;
@ -51,11 +51,11 @@ mod config;
mod futurecore;
mod opengl;
#[cfg(any(windows,target_os = "macos"))]
#[cfg(any(windows, feature = "force-glutin", target_os = "macos"))]
mod remotemio;
mod clipboard;
#[cfg(any(windows,target_os = "macos"))]
#[cfg(any(windows, feature = "force-glutin", target_os = "macos"))]
mod gliumwindows;
mod guiloop;