From e1cd44922fa11c153eb66783f97000fb8c50a471 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 20 Feb 2018 15:02:39 -0800 Subject: [PATCH] move x11 code around idea is to reduce the cfg attributes and make it easier to split into system dependent renderers --- src/main.rs | 10 +++------- src/{xgfx.rs => xwindows/mod.rs} | 5 ++++- src/{ => xwindows}/xkeysyms.rs | 0 src/{ => xwindows}/xwin.rs | 8 ++++---- 4 files changed, 11 insertions(+), 12 deletions(-) rename src/{xgfx.rs => xwindows/mod.rs} (99%) rename src/{ => xwindows}/xkeysyms.rs (100%) rename src/{ => xwindows}/xwin.rs (99%) diff --git a/src/main.rs b/src/main.rs index c6b1dd126..7af95ce79 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,9 +43,9 @@ use std::time::Duration; mod config; #[cfg(all(unix, not(target_os = "macos")))] -mod xgfx; +mod xwindows; #[cfg(all(unix, not(target_os = "macos")))] -mod xkeysyms; +use xwindows::xwin::TerminalWindow; mod font; use font::FontConfiguration; @@ -54,10 +54,6 @@ mod pty; mod sigchld; mod textureatlas; -#[cfg(all(unix, not(target_os = "macos")))] -mod xwin; -#[cfg(all(unix, not(target_os = "macos")))] -use xwin::TerminalWindow; /// Determine which shell to run. /// We take the contents of the $SHELL env var first, then @@ -79,7 +75,7 @@ fn get_shell() -> Result { fn run() -> Result<(), Error> { let poll = Poll::new()?; - let conn = xgfx::Connection::new()?; + let conn = xwindows::Connection::new()?; let waiter = sigchld::ChildWaiter::new()?; diff --git a/src/xgfx.rs b/src/xwindows/mod.rs similarity index 99% rename from src/xgfx.rs rename to src/xwindows/mod.rs index ebd1796c3..153501968 100644 --- a/src/xgfx.rs +++ b/src/xwindows/mod.rs @@ -16,7 +16,10 @@ use xcb_util::ffi::keysyms::{xcb_key_press_lookup_keysym, xcb_key_symbols_alloc, use failure::{self, Error}; pub type Result = result::Result; -pub use xkeysyms::*; + +mod xkeysyms; +pub use self::xkeysyms::*; +pub mod xwin; pub struct Connection { pub display: *mut x11::xlib::Display, diff --git a/src/xkeysyms.rs b/src/xwindows/xkeysyms.rs similarity index 100% rename from src/xkeysyms.rs rename to src/xwindows/xkeysyms.rs diff --git a/src/xwin.rs b/src/xwindows/xwin.rs similarity index 99% rename from src/xwin.rs rename to src/xwindows/xwin.rs index df6f6e8ee..edd195d61 100644 --- a/src/xwin.rs +++ b/src/xwindows/xwin.rs @@ -1,3 +1,5 @@ +use super::{Connection, Drawable, Window}; +use super::xkeysyms; use config::TextStyle; use euclid; use failure::{self, Error}; @@ -20,8 +22,6 @@ use term::color::RgbaTuple; use term::hyperlink::Hyperlink; use xcb; use xcb_util; -use xgfx::{self, Connection, Drawable}; -use xkeysyms; use textureatlas::{Atlas, Sprite, SpriteSlice, TEX_SIZE}; @@ -234,7 +234,7 @@ void main() { /// Holds the information we need to implement TerminalHost struct Host<'a> { - window: xgfx::Window<'a>, + window: Window<'a>, pty: MasterPty, timestamp: xcb::xproto::Timestamp, clipboard: Option, @@ -406,7 +406,7 @@ impl<'a> TerminalWindow<'a> { tuple }; - let window = xgfx::Window::new(&conn, width, height)?; + let window = Window::new(&conn, width, height)?; window.set_title("wezterm"); let descender = if descender.is_positive() {