aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2020-07-28 13:00:55 +0300
committerGitHub <noreply@github.com>2020-07-28 13:00:55 +0300
commit6c4e45f3a69c71958e65fae9a15f82d0c5a27742 (patch)
tree311a32b95b705e9cded8fa2c6f06b297586513fe /alacritty/src
parentb7faa9f4378cf922c44f53a8003731fb0de13670 (diff)
downloadr-alacritty-6c4e45f3a69c71958e65fae9a15f82d0c5a27742.tar.gz
r-alacritty-6c4e45f3a69c71958e65fae9a15f82d0c5a27742.tar.bz2
r-alacritty-6c4e45f3a69c71958e65fae9a15f82d0c5a27742.zip
Bump minimum supported Rust version to 1.43.0
Diffstat (limited to 'alacritty/src')
-rw-r--r--alacritty/src/clipboard.rs13
-rw-r--r--alacritty/src/config/mod.rs2
-rw-r--r--alacritty/src/display.rs40
-rw-r--r--alacritty/src/event.rs30
-rw-r--r--alacritty/src/main.rs2
-rw-r--r--alacritty/src/window.rs28
6 files changed, 45 insertions, 70 deletions
diff --git a/alacritty/src/clipboard.rs b/alacritty/src/clipboard.rs
index df0b1c78..b9708d6f 100644
--- a/alacritty/src/clipboard.rs
+++ b/alacritty/src/clipboard.rs
@@ -29,15 +29,10 @@ impl Clipboard {
#[cfg(not(any(target_os = "macos", windows)))]
pub fn new(_display: Option<*mut c_void>) -> Self {
#[cfg(feature = "wayland")]
- {
- if let Some(display) = _display {
- let (selection, clipboard) =
- unsafe { wayland_clipboard::create_clipboards_from_external(display) };
- return Self {
- clipboard: Box::new(clipboard),
- selection: Some(Box::new(selection)),
- };
- }
+ if let Some(display) = _display {
+ let (selection, clipboard) =
+ unsafe { wayland_clipboard::create_clipboards_from_external(display) };
+ return Self { clipboard: Box::new(clipboard), selection: Some(Box::new(selection)) };
}
#[cfg(feature = "x11")]
diff --git a/alacritty/src/config/mod.rs b/alacritty/src/config/mod.rs
index 7fffcc39..226c6775 100644
--- a/alacritty/src/config/mod.rs
+++ b/alacritty/src/config/mod.rs
@@ -4,8 +4,6 @@ use std::fs;
use std::io;
use std::path::PathBuf;
-#[cfg(windows)]
-use dirs;
use log::{error, warn};
use alacritty_terminal::config::{Config as TermConfig, LOG_TARGET_CONFIG};
diff --git a/alacritty/src/display.rs b/alacritty/src/display.rs
index ad22c852..8fa82338 100644
--- a/alacritty/src/display.rs
+++ b/alacritty/src/display.rs
@@ -188,11 +188,9 @@ impl Display {
// Initialize Wayland event queue, to handle Wayland callbacks.
#[cfg(not(any(target_os = "macos", windows)))]
- {
- if let Some(display) = event_loop.wayland_display() {
- let display = unsafe { WaylandDisplay::from_external_display(display as _) };
- wayland_event_queue = Some(display.create_event_queue());
- }
+ if let Some(display) = event_loop.wayland_display() {
+ let display = unsafe { WaylandDisplay::from_external_display(display as _) };
+ wayland_event_queue = Some(display.create_event_queue());
}
// Create the window where Alacritty will be displayed.
@@ -271,16 +269,14 @@ impl Display {
#[cfg(not(any(target_os = "macos", windows)))]
let is_x11 = event_loop.is_x11();
+ // On Wayland we can safely ignore this call, since the window isn't visible until you
+ // actually draw something into it and commit those changes.
#[cfg(not(any(target_os = "macos", windows)))]
- {
- // On Wayland we can safely ignore this call, since the window isn't visible until you
- // actually draw something into it and commit those changes.
- if is_x11 {
- window.swap_buffers();
- renderer.with_api(&config.ui_config, config.cursor, &size_info, |api| {
- api.finish();
- });
- }
+ if is_x11 {
+ window.swap_buffers();
+ renderer.with_api(&config.ui_config, config.cursor, &size_info, |api| {
+ api.finish();
+ });
}
window.set_visible(true);
@@ -608,15 +604,13 @@ impl Display {
self.window.swap_buffers();
#[cfg(not(any(target_os = "macos", windows)))]
- {
- if self.is_x11 {
- // On X11 `swap_buffers` does not block for vsync. However the next OpenGl command
- // will block to synchronize (this is `glClear` in Alacritty), which causes a
- // permanent one frame delay.
- self.renderer.with_api(&config.ui_config, config.cursor, &size_info, |api| {
- api.finish();
- });
- }
+ if self.is_x11 {
+ // On X11 `swap_buffers` does not block for vsync. However the next OpenGl command
+ // will block to synchronize (this is `glClear` in Alacritty), which causes a
+ // permanent one frame delay.
+ self.renderer.with_api(&config.ui_config, config.cursor, &size_info, |api| {
+ api.finish();
+ });
}
}
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index 803e4398..c30765ae 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -830,14 +830,10 @@ impl<N: Notify + OnResize> Processor<N> {
self.submit_display_update(&mut terminal, old_is_searching, display_update_pending);
}
+ // Skip rendering on Wayland until we get frame event from compositor.
#[cfg(not(any(target_os = "macos", windows)))]
- {
- // Skip rendering on Wayland until we get frame event from compositor.
- if event_loop.is_wayland()
- && !self.display.window.should_draw.load(Ordering::Relaxed)
- {
- return;
- }
+ if event_loop.is_wayland() && !self.display.window.should_draw.load(Ordering::Relaxed) {
+ return;
}
if terminal.dirty {
@@ -934,15 +930,13 @@ impl<N: Notify + OnResize> Processor<N> {
match event {
WindowEvent::CloseRequested => processor.ctx.terminal.exit(),
WindowEvent::Resized(size) => {
+ // Minimizing the window sends a Resize event with zero width and
+ // height. But there's no need to ever actually resize to this.
+ // Both WinPTY & ConPTY have issues when resizing down to zero size
+ // and back.
#[cfg(windows)]
- {
- // Minimizing the window sends a Resize event with zero width and
- // height. But there's no need to ever actually resize to this.
- // Both WinPTY & ConPTY have issues when resizing down to zero size
- // and back.
- if size.width == 0 && size.height == 0 {
- return;
- }
+ if size.width == 0 && size.height == 0 {
+ return;
}
processor.ctx.display_update_pending.set_dimensions(size);
@@ -1091,10 +1085,8 @@ impl<N: Notify + OnResize> Processor<N> {
}
#[cfg(not(any(target_os = "macos", windows)))]
- {
- if processor.ctx.event_loop.is_wayland() {
- processor.ctx.window.set_wayland_theme(&config.colors);
- }
+ if processor.ctx.event_loop.is_wayland() {
+ processor.ctx.window.set_wayland_theme(&config.colors);
}
// Set subpixel anti-aliasing.
diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs
index ae3ef346..e6884204 100644
--- a/alacritty/src/main.rs
+++ b/alacritty/src/main.rs
@@ -15,8 +15,6 @@ use std::fs;
use std::io::{self, Write};
use std::sync::Arc;
-#[cfg(target_os = "macos")]
-use dirs;
use glutin::event_loop::EventLoop as GlutinEventLoop;
use log::{error, info};
#[cfg(windows)]
diff --git a/alacritty/src/window.rs b/alacritty/src/window.rs
index 81a61218..6659a9e0 100644
--- a/alacritty/src/window.rs
+++ b/alacritty/src/window.rs
@@ -176,22 +176,20 @@ impl Window {
let mut wayland_surface = None;
#[cfg(not(any(target_os = "macos", windows)))]
- {
- if event_loop.is_x11() {
- // On X11, embed the window inside another if the parent ID has been set.
- if let Some(parent_window_id) = window_config.embed {
- x_embed_window(windowed_context.window(), parent_window_id);
- }
- } else {
- // Apply client side decorations theme.
- let theme = AlacrittyWaylandTheme::new(&config.colors);
- windowed_context.window().set_wayland_theme(theme);
-
- // Attach surface to Alacritty's internal wayland queue to handle frame callbacks.
- let surface = windowed_context.window().wayland_surface().unwrap();
- let proxy: Proxy<WlSurface> = unsafe { Proxy::from_c_ptr(surface as _) };
- wayland_surface = Some(proxy.attach(wayland_event_queue.as_ref().unwrap().token()));
+ if event_loop.is_x11() {
+ // On X11, embed the window inside another if the parent ID has been set.
+ if let Some(parent_window_id) = window_config.embed {
+ x_embed_window(windowed_context.window(), parent_window_id);
}
+ } else {
+ // Apply client side decorations theme.
+ let theme = AlacrittyWaylandTheme::new(&config.colors);
+ windowed_context.window().set_wayland_theme(theme);
+
+ // Attach surface to Alacritty's internal wayland queue to handle frame callbacks.
+ let surface = windowed_context.window().wayland_surface().unwrap();
+ let proxy: Proxy<WlSurface> = unsafe { Proxy::from_c_ptr(surface as _) };
+ wayland_surface = Some(proxy.attach(wayland_event_queue.as_ref().unwrap().token()));
}
Ok(Self {