make the frontends get the palette from the terminalstate

This isn't complete because it only copies it at startup
into the renderer.
This commit is contained in:
Wez Furlong committed 2019-06-01 16:01:00 -07:00
1 parent 6e4db86f7e
commit 2ec436a4b9
4 files changed
+9 -14

No files matched your search

+1 -7
View File
@@ -196,12 +196,6 @@ impl GliumTerminalWindow {
config: &Arc<Config>,
tab: &Rc<Tab>,
) -> Result<GliumTerminalWindow, Error> {
let palette = config
.colors
.as_ref()
.map(|p| p.clone().into())
.unwrap_or_else(term::color::ColorPalette::default);
let (physical_rows, physical_cols) = tab.renderer().physical_dimensions();
let metrics = fonts.default_font_metrics()?;
@@ -247,7 +241,7 @@ impl GliumTerminalWindow {
let width = width as u16;
let height = height as u16;
let renderer = Renderer::new(&host.display, width, height, fonts, palette)?;
let renderer = Renderer::new(&host.display, width, height, fonts, tab.palette())?;
let mux = Mux::get().unwrap();
let mux_window_id = mux.add_new_window_with_tab(tab)?;
+5
View File
@@ -3,6 +3,7 @@ use crate::mux::tab::{alloc_tab_id, Tab, TabId};
use failure::Error;
use portable_pty::{Child, MasterPty, PtySize};
use std::cell::{RefCell, RefMut};
use term::color::ColorPalette;
use term::{KeyCode, KeyModifiers, MouseEvent, Terminal, TerminalHost};
pub struct LocalTab {
@@ -80,6 +81,10 @@ impl Tab for LocalTab {
fn get_title(&self) -> String {
self.terminal.borrow_mut().get_title().to_string()
}
fn palette(&self) -> ColorPalette {
self.terminal.borrow().palette().clone()
}
}
impl LocalTab {
+1 -7
View File
@@ -122,12 +122,6 @@ impl X11TerminalWindow {
config: &Arc<Config>,
tab: &Rc<Tab>,
) -> Result<X11TerminalWindow, Error> {
let palette = config
.colors
.as_ref()
.map(|p| p.clone().into())
.unwrap_or_else(term::color::ColorPalette::default);
let (physical_rows, physical_cols) = tab.renderer().physical_dimensions();
let metrics = fonts.default_font_metrics()?;
@@ -151,7 +145,7 @@ impl X11TerminalWindow {
fonts: Rc::clone(fonts),
});
let renderer = Renderer::new(&host.window, width, height, fonts, palette)?;
let renderer = Renderer::new(&host.window, width, height, fonts, tab.palette())?;
let mux = Mux::get().unwrap();
let mux_window_id = mux.add_new_window_with_tab(tab)?;
host.window.show();
+2
View File
@@ -1,6 +1,7 @@
use crate::mux::renderable::Renderable;
use failure::Error;
use std::cell::RefMut;
use term::color::ColorPalette;
use term::{KeyCode, KeyModifiers, MouseEvent, TerminalHost};
static TAB_ID: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::AtomicUsize::new(0);
@@ -28,4 +29,5 @@ pub trait Tab {
fn mouse_event(&self, event: MouseEvent, host: &mut TerminalHost) -> Result<(), Error>;
fn advance_bytes(&self, buf: &[u8], host: &mut TerminalHost);
fn is_dead(&self) -> bool;
fn palette(&self) -> ColorPalette;
}