share a reference to the config
This commit is contained in:
1 parent
feaad96069
commit
f7a567b847
2 files changed
+8
-7
No files matched your search
+2
-2
@@ -31,14 +31,14 @@ type FontPtr = Rc<RefCell<Box<NamedFont>>>;
|
||||
|
||||
/// Matches and loads fonts for a given input style
|
||||
pub struct FontConfiguration {
|
||||
config: Config,
|
||||
config: Rc<Config>,
|
||||
fonts: RefCell<HashMap<TextStyle, FontPtr>>,
|
||||
system: FontSystemImpl,
|
||||
}
|
||||
|
||||
impl FontConfiguration {
|
||||
/// Create a new empty configuration
|
||||
pub fn new(config: Config) -> Self {
|
||||
pub fn new(config: Rc<Config>) -> Self {
|
||||
Self {
|
||||
config,
|
||||
fonts: RefCell::new(HashMap::new()),
|
||||
|
||||
+6
-5
@@ -373,7 +373,7 @@ impl GuiEventLoop {
|
||||
fn run_glium(
|
||||
master: pty::MasterPty,
|
||||
child: std::process::Child,
|
||||
config: config::Config,
|
||||
config: &Rc<config::Config>,
|
||||
fontconfig: FontConfiguration,
|
||||
terminal: term::Terminal,
|
||||
initial_pixel_width: u16,
|
||||
@@ -392,7 +392,8 @@ fn run_glium(
|
||||
fontconfig,
|
||||
config
|
||||
.colors
|
||||
.map(|p| p.into())
|
||||
.as_ref()
|
||||
.map(|p| p.clone().into())
|
||||
.unwrap_or_else(term::color::ColorPalette::default),
|
||||
)?;
|
||||
|
||||
@@ -421,13 +422,13 @@ fn run() -> Result<(), Error> {
|
||||
as if it were a login shell.",
|
||||
))
|
||||
.get_matches();
|
||||
let config = config::Config::load()?;
|
||||
let config = Rc::new(config::Config::load()?);
|
||||
println!("Using configuration: {:#?}", config);
|
||||
|
||||
// First step is to figure out the font metrics so that we know how
|
||||
// big things are going to be.
|
||||
|
||||
let fontconfig = FontConfiguration::new(config.clone());
|
||||
let fontconfig = FontConfiguration::new(Rc::clone(&config));
|
||||
let font = fontconfig.default_font()?;
|
||||
|
||||
// we always load the cell_height for font 0,
|
||||
@@ -469,7 +470,7 @@ fn run() -> Result<(), Error> {
|
||||
run_glium(
|
||||
master,
|
||||
child,
|
||||
config,
|
||||
&config,
|
||||
fontconfig,
|
||||
terminal,
|
||||
initial_pixel_width,
|
||||
|
||||
Reference in new issue
Block a user