aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2021-12-03 06:50:14 +0300
committerGitHub <noreply@github.com>2021-12-03 03:50:14 +0000
commit4c6a763850a5dec0fa34d15e356dcba19875690a (patch)
treed32af54c261a97525410ae6c98527debc51885e9 /alacritty/src
parent8681f71084894db6d1e258be17db1f80bb669314 (diff)
downloadr-alacritty-4c6a763850a5dec0fa34d15e356dcba19875690a.tar.gz
r-alacritty-4c6a763850a5dec0fa34d15e356dcba19875690a.tar.bz2
r-alacritty-4c6a763850a5dec0fa34d15e356dcba19875690a.zip
Bump glutin to 0.28.0
Fixes #5603. Fixes #5422. Fixes #5350. Fixes #4105. Co-authored-by: Christian Duerr <contact@christianduerr.com>
Diffstat (limited to 'alacritty/src')
-rw-r--r--alacritty/src/cli.rs2
-rw-r--r--alacritty/src/display/mod.rs2
-rw-r--r--alacritty/src/display/wayland_theme.rs81
-rw-r--r--alacritty/src/display/window.rs27
-rw-r--r--alacritty/src/window_context.rs3
5 files changed, 3 insertions, 112 deletions
diff --git a/alacritty/src/cli.rs b/alacritty/src/cli.rs
index fb3cb011..9b1b8e6c 100644
--- a/alacritty/src/cli.rs
+++ b/alacritty/src/cli.rs
@@ -238,7 +238,7 @@ impl From<TerminalOptions> for PtyConfig {
let working_directory = options.working_directory.take();
let shell = options.command();
let hold = options.hold;
- PtyConfig { hold, shell, working_directory }
+ PtyConfig { shell, working_directory, hold }
}
}
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
index 5cd59711..cd465913 100644
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -56,8 +56,6 @@ pub mod window;
mod bell;
mod color;
mod meter;
-#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
-mod wayland_theme;
/// Maximum number of linewraps followed outside of the viewport during search highlighting.
pub const MAX_SEARCH_LINES: usize = 100;
diff --git a/alacritty/src/display/wayland_theme.rs b/alacritty/src/display/wayland_theme.rs
deleted file mode 100644
index b56ad0c7..00000000
--- a/alacritty/src/display/wayland_theme.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-use glutin::platform::unix::{ARGBColor, Button, ButtonState, Element, Theme as WaylandTheme};
-
-use alacritty_terminal::term::color::Rgb;
-
-use crate::config::color::Colors;
-
-const INACTIVE_OPACITY: u8 = 127;
-
-#[derive(Debug, Clone)]
-pub struct AlacrittyWaylandTheme {
- pub foreground: ARGBColor,
- pub background: ARGBColor,
- pub dim_foreground: ARGBColor,
- pub hovered_close_icon: ARGBColor,
- pub hovered_maximize_icon: ARGBColor,
- pub hovered_minimize_icon: ARGBColor,
-}
-
-impl AlacrittyWaylandTheme {
- pub fn new(colors: &Colors) -> Self {
- let hovered_close_icon = colors.normal.red.into_rgba();
- let hovered_maximize_icon = colors.normal.green.into_rgba();
- let hovered_minimize_icon = colors.normal.yellow.into_rgba();
- let foreground = colors.search_bar_foreground().into_rgba();
- let background = colors.search_bar_background().into_rgba();
-
- let mut dim_foreground = foreground;
- dim_foreground.a = INACTIVE_OPACITY;
-
- Self {
- foreground,
- background,
- dim_foreground,
- hovered_close_icon,
- hovered_maximize_icon,
- hovered_minimize_icon,
- }
- }
-}
-
-impl WaylandTheme for AlacrittyWaylandTheme {
- fn element_color(&self, element: Element, window_active: bool) -> ARGBColor {
- match element {
- Element::Bar | Element::Separator => self.background,
- Element::Text if window_active => self.foreground,
- Element::Text => self.dim_foreground,
- }
- }
-
- fn button_color(
- &self,
- button: Button,
- state: ButtonState,
- foreground: bool,
- window_active: bool,
- ) -> ARGBColor {
- if !foreground {
- return ARGBColor { a: 0, r: 0, g: 0, b: 0 };
- } else if !window_active {
- return self.dim_foreground;
- }
-
- match (state, button) {
- (ButtonState::Idle, _) => self.foreground,
- (ButtonState::Disabled, _) => self.dim_foreground,
- (_, Button::Minimize) => self.hovered_minimize_icon,
- (_, Button::Maximize) => self.hovered_maximize_icon,
- (_, Button::Close) => self.hovered_close_icon,
- }
- }
-}
-
-trait IntoArgbColor {
- fn into_rgba(self) -> ARGBColor;
-}
-
-impl IntoArgbColor for Rgb {
- fn into_rgba(self) -> ARGBColor {
- ARGBColor { a: 0xff, r: self.r, g: self.g, b: self.b }
- }
-}
diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs
index feeb6fb2..84ef2b07 100644
--- a/alacritty/src/display/window.rs
+++ b/alacritty/src/display/window.rs
@@ -13,9 +13,6 @@ use {
wayland_client::protocol::wl_surface::WlSurface,
wayland_client::{Attached, EventQueue, Proxy},
glutin::platform::unix::EventLoopWindowTargetExtUnix,
-
- crate::config::color::Colors,
- crate::display::wayland_theme::AlacrittyWaylandTheme,
};
#[rustfmt::skip]
@@ -61,10 +58,6 @@ use crate::gl;
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
static WINDOW_ICON: &[u8] = include_bytes!("../../alacritty.png");
-/// Maximum DPR on X11 before it is assumed that XRandr is reporting incorrect values.
-#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
-const MAX_X11_DPR: f64 = 10.;
-
/// This should match the definition of IDI_ICON from `windows.rc`.
#[cfg(windows)]
const IDI_ICON: WORD = 0x101;
@@ -209,10 +202,6 @@ impl Window {
#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
let wayland_surface = if is_wayland {
- // 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 _) };
@@ -221,14 +210,7 @@ impl Window {
None
};
- #[allow(unused_mut)]
- let mut dpr = windowed_context.window().scale_factor();
-
- // Handle winit reporting invalid values due to incorrect XRandr monitor metrics.
- #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
- if !is_wayland && dpr > MAX_X11_DPR {
- dpr = 1.;
- }
+ let dpr = windowed_context.window().scale_factor();
Ok(Self {
current_mouse_cursor,
@@ -423,11 +405,6 @@ impl Window {
self.wayland_surface.as_ref()
}
- #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
- pub fn set_wayland_theme(&mut self, colors: &Colors) {
- self.window().set_wayland_theme(AlacrittyWaylandTheme::new(colors));
- }
-
/// Adjust the IME editor position according to the new location of the cursor.
pub fn update_ime_position(&mut self, point: Point, size: &SizeInfo) {
let nspot_x = f64::from(size.padding_x() + point.column.0 as f32 * size.cell_width());
@@ -457,7 +434,7 @@ impl Window {
#[cfg(target_os = "macos")]
pub fn set_has_shadow(&self, has_shadows: bool) {
let raw_window = match self.window().raw_window_handle() {
- RawWindowHandle::MacOS(handle) => handle.ns_window as id,
+ RawWindowHandle::AppKit(handle) => handle.ns_window as id,
_ => return,
};
diff --git a/alacritty/src/window_context.rs b/alacritty/src/window_context.rs
index 6763420c..f0b111b5 100644
--- a/alacritty/src/window_context.rs
+++ b/alacritty/src/window_context.rs
@@ -177,9 +177,6 @@ impl WindowContext {
self.display.window.set_title(&config.window.title);
}
- #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
- self.display.window.set_wayland_theme(&config.colors);
-
// Set subpixel anti-aliasing.
#[cfg(target_os = "macos")]
crossfont::set_font_smoothing(config.font.use_thin_strokes);