diff --git a/CHANGELOG.md b/CHANGELOG.md index 781c85e2..51072cbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Backspace deleting characters while IME is open on macOS - Handling of OpenType variable fonts - Expansion of block-selection on partially selected full-width glyphs +- Minimize action only works with decorations on macOS +- Window permanently vanishing after hiding on macOS +- Modifier key combinations like `Ctrl + Q` not generating characters on macOS ### Removed diff --git a/Cargo.lock b/Cargo.lock index 5c4fc5e6..25e30246 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -33,7 +33,7 @@ dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "font 0.1.0", "gl_generator 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glutin 0.22.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.22.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -442,7 +442,7 @@ dependencies = [ [[package]] name = "dispatch" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -699,7 +699,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "glutin" -version = "0.22.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -720,7 +720,7 @@ dependencies = [ "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-client 0.23.6 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winit 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winit 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2221,7 +2221,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winit" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2230,7 +2230,7 @@ dependencies = [ "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-video-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "dispatch 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dispatch 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "instant 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2391,7 +2391,7 @@ dependencies = [ "checksum deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4" "checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" "checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" -"checksum dispatch 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e93ca78226c51902d7aa8c12c988338aadd9e85ed9c6be8aaac39192ff3605" +"checksum dispatch 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" "checksum dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" "checksum downcast-rs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "52ba6eb47c2131e784a38b726eb54c1e1484904f013e576a25354d0124161af6" "checksum dtoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3" @@ -2420,7 +2420,7 @@ dependencies = [ "checksum gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ca98bbde17256e02d17336a6bdb5a50f7d0ccacee502e191d3e3d0ec2f96f84a" "checksum gl_generator 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum glutin 0.22.1 (registry+https://github.com/rust-lang/crates.io-index)" = "639246c8838b02a83b9339bd87da3714e73e52ecfaa758e15d761eb77b2290b5" +"checksum glutin 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf22d4e90c55d9be9f2ad52410e7a2c0d7e9c99d93a13df73a672e7ef4e8c7f7" "checksum glutin_egl_sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "772edef3b28b8ad41e4ea202748e65eefe8e5ffd1f4535f1219793dbb20b3d4c" "checksum glutin_emscripten_sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80de4146df76e8a6c32b03007bc764ff3249dcaeb4f675d68a06caf1bac363f1" "checksum glutin_gles2_sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07e853d96bebcb8e53e445225c3009758c6f5960d44f2543245f6f07b567dae0" @@ -2599,7 +2599,7 @@ dependencies = [ "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum winit 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ba128780050481f453bec2a115b916dbc6ae79c303dee9bad8b9080bdccd4f5" +"checksum winit 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "65a5c1a5ef76ac31cc97ad29489acdbed2178f3fc12ca00ee6cb11d60adb5a3a" "checksum winpty-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dade7ecea144b3578a02925f93900f32370abfb8768630883971f4ef716b568" "checksum winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml index 759ad8c2..e18e5d68 100644 --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -18,7 +18,7 @@ fnv = "1" serde = { version = "1", features = ["derive"] } serde_yaml = "0.8" serde_json = "1" -glutin = { version = "0.22.0", features = ["serde"] } +glutin = { version = "0.23.0", features = ["serde"] } notify = "4" libc = "0.2" unicode-width = "0.1" diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index bfadbaec..cd4f82a1 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -12,7 +12,7 @@ use std::time::Instant; use glutin::dpi::PhysicalSize; use glutin::event::{ElementState, Event as GlutinEvent, ModifiersState, MouseButton, WindowEvent}; -use glutin::event_loop::{ControlFlow, EventLoop, EventLoopProxy}; +use glutin::event_loop::{ControlFlow, EventLoop, EventLoopProxy, EventLoopWindowTarget}; use glutin::platform::desktop::EventLoopExtDesktop; use log::{debug, info, warn}; use serde_json as json; @@ -67,6 +67,7 @@ pub struct ActionContext<'a, N, T> { pub message_buffer: &'a mut MessageBuffer, pub display_update_pending: &'a mut DisplayUpdate, pub config: &'a mut Config, + pub event_loop: &'a EventLoopWindowTarget, font_size: &'a mut Size, } @@ -249,6 +250,10 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext for ActionCon fn config(&self) -> &Config { self.config } + + fn event_loop(&self) -> &EventLoopWindowTarget { + self.event_loop + } } pub enum ClickState { @@ -346,7 +351,7 @@ impl Processor { { let mut event_queue = Vec::new(); - event_loop.run_return(|event, _event_loop, control_flow| { + event_loop.run_return(|event, event_loop, control_flow| { if self.config.debug.print_events { info!("glutin event: {:?}", event); } @@ -407,6 +412,7 @@ impl Processor { window: &mut self.display.window, font_size: &mut self.font_size, config: &mut self.config, + event_loop, }; let mut processor = input::Processor::new(context, &self.display.urls, &self.display.highlighted_url); diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index b0953cd6..bb89417e 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -24,15 +24,19 @@ use std::cmp::Ordering; use std::marker::PhantomData; use std::time::Instant; +use log::{debug, trace, warn}; + use glutin::event::{ ElementState, KeyboardInput, ModifiersState, MouseButton, MouseScrollDelta, TouchPhase, }; +use glutin::event_loop::EventLoopWindowTarget; +#[cfg(target_os = "macos")] +use glutin::platform::macos::EventLoopWindowTargetExtMacOS; use glutin::window::CursorIcon; -use log::{debug, trace, warn}; use alacritty_terminal::ansi::{ClearMode, Handler}; use alacritty_terminal::clipboard::ClipboardType; -use alacritty_terminal::event::EventListener; +use alacritty_terminal::event::{Event, EventListener}; use alacritty_terminal::grid::Scroll; use alacritty_terminal::index::{Column, Line, Point, Side}; use alacritty_terminal::message_bar::{self, Message}; @@ -88,6 +92,7 @@ pub trait ActionContext { fn pop_message(&mut self); fn message(&self) -> Option<&Message>; fn config(&self) -> &Config; + fn event_loop(&self) -> &EventLoopWindowTarget; } trait Execute { @@ -133,6 +138,9 @@ impl Execute for Action { Action::ToggleFullscreen => ctx.window_mut().toggle_fullscreen(), #[cfg(target_os = "macos")] Action::ToggleSimpleFullscreen => ctx.window_mut().toggle_simple_fullscreen(), + #[cfg(target_os = "macos")] + Action::Hide => ctx.event_loop().hide_application(), + #[cfg(not(target_os = "macos"))] Action::Hide => ctx.window().set_visible(false), Action::Minimize => ctx.window().set_minimized(true), Action::Quit => ctx.terminal_mut().exit(), @@ -766,6 +774,7 @@ mod tests { use glutin::event::{ ElementState, Event, ModifiersState, MouseButton, VirtualKeyCode, WindowEvent, }; + use glutin::event_loop::EventLoopWindowTarget; use alacritty_terminal::clipboard::{Clipboard, ClipboardType}; use alacritty_terminal::event::{Event as TerminalEvent, EventListener}; @@ -910,6 +919,10 @@ mod tests { fn config(&self) -> &Config { self.config } + + fn event_loop(&self) -> &EventLoopWindowTarget { + unimplemented!(); + } } macro_rules! test_clickstate {