diff --git a/Cargo.toml b/Cargo.toml index 51978785d..b73ed3448 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,7 @@ freetype = "~0.4" open = "1.2" structopt = "0.2" foreign-types = "0.3" +winit = "0.18" [target.'cfg(unix)'.dependencies] harfbuzz-sys = "~0.3" diff --git a/src/gliumwindows.rs b/src/gliumwindows.rs index 99a7b0382..40d273566 100644 --- a/src/gliumwindows.rs +++ b/src/gliumwindows.rs @@ -20,6 +20,8 @@ use term::KeyModifiers; use term::{self, Terminal}; use term::{MouseButton, MouseEventKind}; use termwiz::hyperlink::Hyperlink; +#[cfg(target_os = "macos")] +use winit::os::macos::WindowExt; struct Host { event_loop: Rc, @@ -27,7 +29,7 @@ struct Host { pty: MasterPty, clipboard: Clipboard, window_position: Option, - /// is is_some, holds position to be restored after exiting + /// if is_some, holds position to be restored after exiting /// fullscreen mode. is_fullscreen: Option, } @@ -90,6 +92,14 @@ impl term::TerminalHost for Host { fn toggle_full_screen(&mut self) { let window = self.display.gl_window(); if let Some(pos) = self.is_fullscreen.take() { + // Use simple fullscreen mode on macos, as wez personally + // prefers the faster transition to/from this mode than + // the Lion+ slow transition to a new Space. This could + // be made into a config option if someone really wanted + // that behavior. + #[cfg(target_os = "macos")] + window.set_simple_fullscreen(false); + #[cfg(not(target_os = "macos"))] window.set_fullscreen(None); window.set_position(pos); } else { @@ -97,6 +107,10 @@ impl term::TerminalHost for Host { // appears to only return the initial position of the window // on Linux. self.is_fullscreen = self.window_position.take(); + + #[cfg(target_os = "macos")] + window.set_simple_fullscreen(true); + #[cfg(not(target_os = "macos"))] window.set_fullscreen(Some(window.get_current_monitor())); } } diff --git a/term/src/terminalstate.rs b/term/src/terminalstate.rs index 9f9fad30a..93166c125 100644 --- a/term/src/terminalstate.rs +++ b/term/src/terminalstate.rs @@ -748,7 +748,7 @@ impl TerminalState { } let to_send = match (key, ctrl, alt, shift, self.application_cursor_keys) { - (Char('\n'), _, ALT, ..) => { + (Enter, _, ALT, ..) | (Char('\r'), _, ALT, ..) | (Char('\n'), _, ALT, ..) => { host.toggle_full_screen(); return Ok(()); }