1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-18 13:55:23 -05:00

Bump glutin to 0.25.0

Fixes #4206.
Fixes #4162.
Fixes #4017.
Fixes #3998.
Fixes #3831.
Fixes #3782.
Fixes #3708.
Fixes #2734.
Fixes #2714.
Fixes #1801.
This commit is contained in:
Kirill Chibisov 2020-10-07 17:40:50 +03:00 committed by GitHub
parent 44a6dba0af
commit 67db9b228d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 482 additions and 420 deletions

View file

@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- CLI parameter `--option`/`-o` to override any configuration field
- Escape sequences to report text area size in pixels (`CSI 14 t`) and in characters (`CSI 18 t`)
- Support for single line terminals dimensions
- Right clicking on Wayland's client side decorations will show application menu
### Changed
@ -33,6 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- The user's background color is now used as the foreground for the render timer
- Use yellow/red from the config for error and warning messages instead of fixed colors
- Existing CLI parameters are now passed to instances spawned using `SpawnNewInstance`
- Wayland's Client side decorations now use the search bar colors
### Fixed
@ -48,6 +50,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Selection expanding over 2 characters when scrolled in history with fullwidth characters in use
- Selection scrolling not starting when mouse is over the message bar
- Incorrect text width calculation in message bar when the message contains multibyte characters
- Remapped caps lock to escape not triggering escape bindings on Wayland
- Crash when setting overly long title on Wayland
- Switching in and out of various window states, like Fullscreen, not persisting window size on Wayland
- Crash when providing 0 for `XCURSOR_SIZE` on Wayland
- Gap between window and server side decorations on KWIN Wayland
- Wayland's client side decorations not working after tty switch
- `Fullscreen` startup mode not working on Wayland
- Window not being rescaled when changing DPR of the current monitor on Wayland
- Crash in some cases when pointer isn't presented upon startup on Wayland
- IME not working on Wayland
- Crash on startup on GNOME since its 3.37.90 version on Wayland
- Touchpad scrolling scrolled less than it should on macOS/Wayland on scaled outputs
- Incorrect modifiers at startup on X11
- `Add` and `Subtract` keys are now named `NumpadAdd` and `NumpadSubtract` respectively
## 0.5.0

645
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -691,39 +691,42 @@
#- { key: N, mods: Shift, mode: Vi, action: SearchPrevious }
# (Windows, Linux, and BSD only)
#- { key: V, mods: Control|Shift, action: Paste }
#- { key: C, mods: Control|Shift, action: Copy }
#- { key: F, mods: Control|Shift, action: SearchForward }
#- { key: B, mods: Control|Shift, action: SearchBackward }
#- { key: C, mods: Control|Shift, mode: Vi, action: ClearSelection }
#- { key: Insert, mods: Shift, action: PasteSelection }
#- { key: Key0, mods: Control, action: ResetFontSize }
#- { key: Equals, mods: Control, action: IncreaseFontSize }
#- { key: Add, mods: Control, action: IncreaseFontSize }
#- { key: Subtract, mods: Control, action: DecreaseFontSize }
#- { key: Minus, mods: Control, action: DecreaseFontSize }
#- { key: V, mods: Control|Shift, action: Paste }
#- { key: C, mods: Control|Shift, action: Copy }
#- { key: F, mods: Control|Shift, action: SearchForward }
#- { key: B, mods: Control|Shift, action: SearchBackward }
#- { key: C, mods: Control|Shift, mode: Vi, action: ClearSelection }
#- { key: Insert, mods: Shift, action: PasteSelection }
#- { key: Key0, mods: Control, action: ResetFontSize }
#- { key: Equals, mods: Control, action: IncreaseFontSize }
#- { key: Plus, mods: Control, action: IncreaseFontSize }
#- { key: NumpadAdd, mods: Control, action: IncreaseFontSize }
#- { key: Minus, mods: Control, action: DecreaseFontSize }
#- { key: NumpadSubtract, mods: Control, action: DecreaseFontSize }
# (Windows only)
#- { key: Return, mods: Alt, action: ToggleFullscreen }
# (macOS only)
#- { key: K, mods: Command, mode: ~Vi, chars: "\x0c" }
#- { key: Key0, mods: Command, action: ResetFontSize }
#- { key: Equals, mods: Command, action: IncreaseFontSize }
#- { key: Add, mods: Command, action: IncreaseFontSize }
#- { key: Minus, mods: Command, action: DecreaseFontSize }
#- { key: K, mods: Command, action: ClearHistory }
#- { key: V, mods: Command, action: Paste }
#- { key: C, mods: Command, action: Copy }
#- { key: C, mods: Command, mode: Vi, action: ClearSelection }
#- { key: H, mods: Command, action: Hide }
#- { key: M, mods: Command, action: Minimize }
#- { key: Q, mods: Command, action: Quit }
#- { key: W, mods: Command, action: Quit }
#- { key: N, mods: Command, action: SpawnNewInstance }
#- { key: F, mods: Command|Control, action: ToggleFullscreen }
#- { key: F, mods: Command, action: SearchForward }
#- { key: B, mods: Command, action: SearchBackward }
#- { key: K, mods: Command, mode: ~Vi, chars: "\x0c" }
#- { key: Key0, mods: Command, action: ResetFontSize }
#- { key: Equals, mods: Command, action: IncreaseFontSize }
#- { key: Plus, mods: Command, action: IncreaseFontSize }
#- { key: NumpadAdd, mods: Command, action: IncreaseFontSize }
#- { key: Minus, mods: Command, action: DecreaseFontSize }
#- { key: NumpadSubtract, mods: Command, action: DecreaseFontSize }
#- { key: K, mods: Command, action: ClearHistory }
#- { key: V, mods: Command, action: Paste }
#- { key: C, mods: Command, action: Copy }
#- { key: C, mods: Command, mode: Vi, action: ClearSelection }
#- { key: H, mods: Command, action: Hide }
#- { key: M, mods: Command, action: Minimize }
#- { key: Q, mods: Command, action: Quit }
#- { key: W, mods: Command, action: Quit }
#- { key: N, mods: Command, action: SpawnNewInstance }
#- { key: F, mods: Command|Control, action: ToggleFullscreen }
#- { key: F, mods: Command, action: SearchForward }
#- { key: B, mods: Command, action: SearchBackward }
#debug:
# Display the time it takes to redraw each frame.

View file

@ -21,9 +21,9 @@ fnv = "1"
serde = { version = "1", features = ["derive"] }
serde_yaml = "0.8"
serde_json = "1"
glutin = { version = "0.24.0", features = ["serde"] }
glutin = { version = "0.25.0", features = ["serde"] }
notify = "4"
parking_lot = "0.10.2"
parking_lot = "0.11.0"
crossfont = { version = "0.1.0", features = ["force_system_fontconfig"] }
urlocator = "0.1.3"
copypasta = { version = "0.7.0", default-features = false }
@ -48,7 +48,7 @@ dirs = "2.0.2"
[target.'cfg(not(any(target_os="windows", target_os="macos")))'.dependencies]
x11-dl = "2"
wayland-client = { version = "0.27.0", features = ["dlopen"] }
wayland-client = { version = "0.28.0", features = ["dlopen"] }
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.7", features = ["impl-default", "wincon"]}

View file

@ -494,9 +494,10 @@ fn common_keybindings() -> Vec<KeyBinding> {
Insert, ModifiersState::SHIFT, ~TermMode::VI; Action::PasteSelection;
Key0, ModifiersState::CTRL; Action::ResetFontSize;
Equals, ModifiersState::CTRL; Action::IncreaseFontSize;
Add, ModifiersState::CTRL; Action::IncreaseFontSize;
Subtract, ModifiersState::CTRL; Action::DecreaseFontSize;
Minus, ModifiersState::CTRL; Action::DecreaseFontSize;
Plus, ModifiersState::CTRL; Action::IncreaseFontSize;
NumpadAdd, ModifiersState::CTRL; Action::IncreaseFontSize;
Minus, ModifiersState::CTRL; Action::DecreaseFontSize;
NumpadSubtract, ModifiersState::CTRL; Action::DecreaseFontSize;
)
}
@ -521,8 +522,10 @@ pub fn platform_key_bindings() -> Vec<KeyBinding> {
KeyBinding;
Key0, ModifiersState::LOGO; Action::ResetFontSize;
Equals, ModifiersState::LOGO; Action::IncreaseFontSize;
Add, ModifiersState::LOGO; Action::IncreaseFontSize;
Minus, ModifiersState::LOGO; Action::DecreaseFontSize;
Plus, ModifiersState::LOGO; Action::IncreaseFontSize;
NumpadAdd, ModifiersState::LOGO; Action::IncreaseFontSize;
Minus, ModifiersState::LOGO; Action::DecreaseFontSize;
NumpadSubtract, ModifiersState::LOGO; Action::DecreaseFontSize;
Insert, ModifiersState::SHIFT, ~TermMode::VI; Action::Esc("\x1b[2;2~".into());
K, ModifiersState::LOGO, ~TermMode::VI; Action::Esc("\x0c".into());
V, ModifiersState::LOGO, ~TermMode::VI; Action::Paste;

View file

@ -1,5 +1,6 @@
use std::os::raw::c_ulong;
use glutin::window::Fullscreen;
use log::error;
use serde::{Deserialize, Deserializer};
use serde_yaml::Value;
@ -98,6 +99,20 @@ impl WindowConfig {
let padding_y = (f32::from(self.padding.y) * dpr as f32).floor();
(padding_x, padding_y)
}
#[inline]
pub fn fullscreen(&self) -> Option<Fullscreen> {
if self.startup_mode == StartupMode::Fullscreen {
Some(Fullscreen::Borderless(None))
} else {
None
}
}
#[inline]
pub fn maximized(&self) -> bool {
self.startup_mode == StartupMode::Maximized
}
}
impl Default for WindowConfig {

View file

@ -31,7 +31,9 @@ use alacritty_terminal::term::{RenderableCell, SizeInfo, Term, TermMode};
use alacritty_terminal::term::{MIN_COLS, MIN_SCREEN_LINES};
use crate::config::font::Font;
use crate::config::window::{Dimensions, StartupMode};
use crate::config::window::Dimensions;
#[cfg(not(windows))]
use crate::config::window::StartupMode;
use crate::config::Config;
use crate::event::{Mouse, SearchState};
use crate::message_bar::{MessageBuffer, MessageType};
@ -275,12 +277,12 @@ impl Display {
}
#[allow(clippy::single_match)]
#[cfg(not(windows))]
match config.ui_config.window.startup_mode {
StartupMode::Fullscreen => window.set_fullscreen(true),
#[cfg(target_os = "macos")]
StartupMode::SimpleFullscreen => window.set_simple_fullscreen(true),
#[cfg(not(any(target_os = "macos", windows)))]
StartupMode::Maximized => window.set_maximized(true),
#[cfg(not(target_os = "macos"))]
StartupMode::Maximized if is_x11 => window.set_maximized(true),
_ => (),
}

View file

@ -1,26 +1,30 @@
use glutin::platform::unix::{ButtonState, Theme as WaylandTheme};
use glutin::platform::unix::{ARGBColor, Button, ButtonState, Element, Theme as WaylandTheme};
use alacritty_terminal::config::Colors;
use alacritty_terminal::term::color::{Rgb, DIM_FACTOR};
use alacritty_terminal::term::color::Rgb;
const INACTIVE_OPACITY: u8 = 127;
#[derive(Debug, Clone)]
pub struct AlacrittyWaylandTheme {
pub background: Rgb,
pub foreground: Rgb,
pub dim_foreground: Rgb,
pub hovered_close_icon: Rgb,
pub hovered_maximize_icon: Rgb,
pub hovered_minimize_icon: Rgb,
pub background: ARGBColor,
pub foreground: 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;
let hovered_maximize_icon = colors.normal().green;
let hovered_minimize_icon = colors.normal().yellow;
let foreground = colors.primary.foreground;
let background = colors.primary.background;
let dim_foreground = colors.primary.dim_foreground.unwrap_or(foreground * DIM_FACTOR);
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,
@ -31,52 +35,46 @@ impl AlacrittyWaylandTheme {
hovered_maximize_icon,
}
}
fn color_icon_color(&self, color: Rgb, status: ButtonState) -> [u8; 4] {
match status {
ButtonState::Hovered => [0xff, color.r, color.g, color.b],
ButtonState::Idle => [0xff, self.foreground.r, self.foreground.g, self.foreground.b],
ButtonState::Disabled => {
[0xff, self.dim_foreground.r, self.dim_foreground.g, self.dim_foreground.b]
},
}
}
}
impl WaylandTheme for AlacrittyWaylandTheme {
fn primary_color(&self, _window_active: bool) -> [u8; 4] {
[0xff, self.background.r, self.background.g, self.background.b]
}
fn secondary_color(&self, window_active: bool) -> [u8; 4] {
if window_active {
[0xff, self.foreground.r, self.foreground.g, self.foreground.b]
} else {
[0xff, self.dim_foreground.r, self.dim_foreground.g, self.dim_foreground.b]
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 close_button_color(&self, _status: ButtonState) -> [u8; 4] {
[0x00, self.background.r, self.background.g, self.background.b]
}
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;
}
fn close_button_icon_color(&self, status: ButtonState) -> [u8; 4] {
self.color_icon_color(self.hovered_close_icon, status)
}
fn maximize_button_color(&self, _status: ButtonState) -> [u8; 4] {
[0x00, self.background.r, self.background.g, self.background.b]
}
fn maximize_button_icon_color(&self, status: ButtonState) -> [u8; 4] {
self.color_icon_color(self.hovered_maximize_icon, status)
}
fn minimize_button_color(&self, _status: ButtonState) -> [u8; 4] {
[0x00, self.background.r, self.background.g, self.background.b]
}
fn minimize_button_icon_color(&self, status: ButtonState) -> [u8; 4] {
self.color_icon_color(self.hovered_minimize_icon, status)
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 }
}
}

View file

@ -36,7 +36,7 @@ use winapi::shared::minwindef::WORD;
use alacritty_terminal::index::Point;
use alacritty_terminal::term::SizeInfo;
use crate::config::window::{Decorations, StartupMode, WindowConfig};
use crate::config::window::{Decorations, WindowConfig};
use crate::config::Config;
use crate::gl;
@ -259,7 +259,8 @@ impl Window {
.with_visible(false)
.with_transparent(true)
.with_decorations(window_config.decorations != Decorations::None)
.with_maximized(window_config.startup_mode == StartupMode::Maximized)
.with_maximized(window_config.maximized())
.with_fullscreen(window_config.fullscreen())
.with_window_icon(icon.ok())
// X11.
.with_class(class.instance.clone(), class.general.clone())
@ -282,7 +283,8 @@ impl Window {
.with_visible(false)
.with_decorations(window_config.decorations != Decorations::None)
.with_transparent(true)
.with_maximized(window_config.startup_mode == StartupMode::Maximized)
.with_maximized(window_config.maximized())
.with_fullscreen(window_config.fullscreen())
.with_window_icon(icon.ok())
}
@ -292,7 +294,8 @@ impl Window {
.with_title(title)
.with_visible(false)
.with_transparent(true)
.with_maximized(window_config.startup_mode == StartupMode::Maximized);
.with_maximized(window_config.maximized())
.with_fullscreen(window_config.fullscreen());
match window_config.decorations {
Decorations::Full => window,
@ -360,8 +363,7 @@ impl Window {
pub fn set_fullscreen(&mut self, fullscreen: bool) {
if fullscreen {
let current_monitor = self.window().current_monitor();
self.window().set_fullscreen(Some(Fullscreen::Borderless(current_monitor)));
self.window().set_fullscreen(Some(Fullscreen::Borderless(None)));
} else {
self.window().set_fullscreen(None);
}

View file

@ -11,7 +11,7 @@ edition = "2018"
[dependencies]
libc = "0.2"
bitflags = "1"
parking_lot = "0.10.2"
parking_lot = "0.11.0"
serde = { version = "1", features = ["derive"] }
serde_yaml = "0.8"
vte = { git = "https://github.com/alacritty/vte", rev = "4f44023dab081f7da74fee14bc53b10ee8f96a1e", default-features = false }
@ -24,7 +24,7 @@ terminfo = "0.7.1"
regex-automata = "0.1.9"
[target.'cfg(unix)'.dependencies]
nix = "0.17.0"
nix = "0.18.0"
signal-hook = { version = "0.1", features = ["mio-support"] }
[target.'cfg(windows)'.dependencies]

View file

@ -1,5 +1,5 @@
use std::fmt::{self, Display, Formatter};
use std::ops::{Index, IndexMut, Mul};
use std::ops::{Add, Index, IndexMut, Mul};
use std::str::FromStr;
use log::trace;
@ -75,6 +75,18 @@ impl Mul<f32> for Rgb {
}
}
impl Add<Rgb> for Rgb {
type Output = Rgb;
fn add(self, rhs: Rgb) -> Rgb {
Rgb {
r: self.r.saturating_add(rhs.r),
g: self.g.saturating_add(rhs.g),
b: self.b.saturating_add(rhs.b),
}
}
}
/// Deserialize an Rgb from a hex string.
///
/// This is *not* the deserialize impl for Rgb since we want a symmetric