diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2020-02-07 16:44:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-07 16:44:11 +0300 |
commit | db9e8d4b975285947c61189cf9564753531ebf5a (patch) | |
tree | ab3ee253497efd8fd5846a06cea9796fd04185f0 /alacritty/src | |
parent | 6832b86aa7a9adb386394e1caaf373e65297be4e (diff) | |
download | r-alacritty-db9e8d4b975285947c61189cf9564753531ebf5a.tar.gz r-alacritty-db9e8d4b975285947c61189cf9564753531ebf5a.tar.bz2 r-alacritty-db9e8d4b975285947c61189cf9564753531ebf5a.zip |
Update glutin to v0.23.0
Fixes #3191.
Fixes #3150.
Fixes #1465.
Fixes #1359.
Diffstat (limited to 'alacritty/src')
-rw-r--r-- | alacritty/src/event.rs | 10 | ||||
-rw-r--r-- | alacritty/src/input.rs | 17 |
2 files changed, 23 insertions, 4 deletions
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<Event>, font_size: &'a mut Size, } @@ -249,6 +250,10 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon fn config(&self) -> &Config { self.config } + + fn event_loop(&self) -> &EventLoopWindowTarget<Event> { + self.event_loop + } } pub enum ClickState { @@ -346,7 +351,7 @@ impl<N: Notify + OnResize> Processor<N> { { 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<N: Notify + OnResize> Processor<N> { 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<T: EventListener> { fn pop_message(&mut self); fn message(&self) -> Option<&Message>; fn config(&self) -> &Config; + fn event_loop(&self) -> &EventLoopWindowTarget<Event>; } trait Execute<T: EventListener> { @@ -133,6 +138,9 @@ impl<T: EventListener> Execute<T> 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<TerminalEvent> { + unimplemented!(); + } } macro_rules! test_clickstate { |