From db903503df024a3f5066937fbe0272be88226738 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Tue, 11 Jul 2023 02:22:14 +0000 Subject: Update to the new winit keyboard API The main highlight of this update is that alacritty will now use new keyboard API from the winit, which resolves a lot of issues around key bindings, such as ability to bind dead keys. It also fixes long standing issues with the virtual key code bindings and make bindings in general more predictable. It also makes our default Vi key bindings fully working. Given that alacritty was using `VirtualKey` directly in the bindings from the winit, and winit simply removed the enum, we've added internal conversions to minimize the fallout, but new way to specify the bindings should be more intuitive. Other part of this update fixes some forward compatibility bugs with the Wayland backend, given that wayland-rs 0.30 is fully forward compatible. The update also fixes weird Maximized startup issues on GNOME Wayland, however they were present on any sane compositor. Fixes #6842. Fixes #6455. Fixes #6184. Fixes #5684. Fixes #3574. Fixes #3460. Fixes #1336. Fixes #892. Fixes #458. Fixes #55. --- alacritty/src/display/mod.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'alacritty/src/display/mod.rs') diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs index 98dd04ad..c992e9cc 100644 --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -15,9 +15,10 @@ use glutin::surface::{Rect as DamageRect, Surface, SwapInterval, WindowSurface}; use log::{debug, info}; use parking_lot::MutexGuard; +use raw_window_handle::RawWindowHandle; use serde::{Deserialize, Serialize}; use winit::dpi::PhysicalSize; -use winit::event::ModifiersState; +use winit::keyboard::ModifiersState; use winit::window::CursorIcon; use crossfont::{self, Rasterize, Rasterizer}; @@ -393,10 +394,7 @@ impl Display { gl_context: NotCurrentContext, config: &UiConfig, ) -> Result { - #[cfg(any(not(feature = "wayland"), target_os = "macos", windows))] - let is_wayland = false; - #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] - let is_wayland = window.wayland_surface().is_some(); + let is_wayland = matches!(window.raw_window_handle(), RawWindowHandle::Wayland(_)); let scale_factor = window.scale_factor as f32; let rasterizer = Rasterizer::new(scale_factor)?; @@ -1048,7 +1046,7 @@ impl Display { // highlighted hint could be disrupted by the old preview. dirty = self.hint_mouse_point.map_or(false, |p| p.line != point.line); self.hint_mouse_point = Some(point); - self.window.set_mouse_cursor(CursorIcon::Hand); + self.window.set_mouse_cursor(CursorIcon::Pointer); } else if self.highlighted_hint.is_some() { self.hint_mouse_point = None; if term.mode().intersects(TermMode::MOUSE_MODE) && !term.mode().contains(TermMode::VI) { -- cgit