mirror of
https://github.com/alacritty/alacritty.git
synced 2026-12-05 18:55:00 +03:00
Borrow glutin::Window instead of using Arc
glutin::Window is not threadsafe; putting it into an Arc is misleading (although the glutin::Window type claims to be Send + Sync). The reference was just needed on the main thread anyway, so it's better to just pass a ref around directly.
This commit is contained in:
1 parent
ce32eee099
commit
43397cefec
1 file changed
+12
-13
+12
-13
@@ -183,7 +183,6 @@ fn main() {
|
||||
let signal_flag = Flag::new(false);
|
||||
|
||||
let terminal = Arc::new(FairMutex::new(terminal));
|
||||
let window = Arc::new(window);
|
||||
|
||||
// Setup the rsize callback for osx
|
||||
let terminal_ref = terminal.clone();
|
||||
@@ -215,7 +214,7 @@ fn main() {
|
||||
|
||||
// Wraps a renderer and gives simple draw() api.
|
||||
let mut display = Display::new(
|
||||
window.clone(),
|
||||
&window,
|
||||
renderer,
|
||||
glyph_cache,
|
||||
render_timer,
|
||||
@@ -290,8 +289,8 @@ impl config::OnConfigReload for ConfigHandler {
|
||||
}
|
||||
}
|
||||
|
||||
struct Display {
|
||||
window: Arc<glutin::Window>,
|
||||
struct Display<'a> {
|
||||
window: &'a glutin::Window,
|
||||
renderer: QuadRenderer,
|
||||
glyph_cache: GlyphCache,
|
||||
render_timer: bool,
|
||||
@@ -300,20 +299,20 @@ struct Display {
|
||||
pty: Pty,
|
||||
}
|
||||
|
||||
impl Display {
|
||||
impl<'a> Display<'a> {
|
||||
pub fn update_config(&mut self, config: &Config) {
|
||||
self.renderer.update_config(config);
|
||||
self.render_timer = config.render_timer();
|
||||
}
|
||||
|
||||
pub fn new(window: Arc<glutin::Window>,
|
||||
renderer: QuadRenderer,
|
||||
glyph_cache: GlyphCache,
|
||||
render_timer: bool,
|
||||
rx: mpsc::Receiver<(u32, u32)>,
|
||||
pty: Pty)
|
||||
-> Display
|
||||
{
|
||||
pub fn new(
|
||||
window: &glutin::Window,
|
||||
renderer: QuadRenderer,
|
||||
glyph_cache: GlyphCache,
|
||||
render_timer: bool,
|
||||
rx: mpsc::Receiver<(u32, u32)>,
|
||||
pty: Pty
|
||||
) -> Display {
|
||||
Display {
|
||||
window: window,
|
||||
renderer: renderer,
|
||||
|
||||
Reference in new issue
Block a user