summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Willmon <kylewillmon@gmail.com>2023-10-27 12:35:11 -0500
committerGitHub <noreply@github.com>2023-10-27 17:35:11 +0000
commit308b331cbcedc11e1e89f6553a7cd9419cda6144 (patch)
tree8fb72473bcbcc1f05b6cccf8c874edb672c81e9b
parentd65357b213fb450c6ef4fa9d4fc09307cfe5f6fb (diff)
downloadalacritty-308b331cbcedc11e1e89f6553a7cd9419cda6144.tar.gz
alacritty-308b331cbcedc11e1e89f6553a7cd9419cda6144.zip
Avoid maximizing window when creating new tab
This patch ignores the startup mode when creating a new tab on macOS to avoid maximizing an existing window. Co-authored-by: Christian Duerr <contact@christianduerr.com>
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty/src/display/mod.rs13
-rw-r--r--alacritty/src/window_context.rs23
3 files changed, 22 insertions, 15 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c88cf9dd..2fbf97fc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -62,6 +62,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Blocking paste freezing alacritty on Wayland
- `Command` modifier persisting after `Cmd + Tab` on macOS
- Crash on exit when using NVIDIA binary drivers on Wayland
+- `window.startup_mode` applied to window again when creating new tab
### Removed
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
index efd41c04..7380e8c3 100644
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -392,6 +392,7 @@ impl Display {
window: Window,
gl_context: NotCurrentContext,
config: &UiConfig,
+ _tabbed: bool,
) -> Result<Display, Error> {
let raw_window_handle = window.raw_window_handle();
@@ -476,11 +477,13 @@ impl Display {
#[allow(clippy::single_match)]
#[cfg(not(windows))]
- match config.window.startup_mode {
- #[cfg(target_os = "macos")]
- StartupMode::SimpleFullscreen => window.set_simple_fullscreen(true),
- StartupMode::Maximized if !is_wayland => window.set_maximized(true),
- _ => (),
+ if !_tabbed {
+ match config.window.startup_mode {
+ #[cfg(target_os = "macos")]
+ StartupMode::SimpleFullscreen => window.set_simple_fullscreen(true),
+ StartupMode::Maximized if !is_wayland => window.set_maximized(true),
+ _ => (),
+ }
}
let hint_state = HintState::new(config.hints.alphabet());
diff --git a/alacritty/src/window_context.rs b/alacritty/src/window_context.rs
index 055c5688..5c017cab 100644
--- a/alacritty/src/window_context.rs
+++ b/alacritty/src/window_context.rs
@@ -11,7 +11,6 @@ use std::sync::Arc;
use crossfont::Size;
use glutin::config::GetGlConfig;
-use glutin::context::NotCurrentContext;
use glutin::display::GetGlDisplay;
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
use glutin::platform::x11::X11GlConfigExt;
@@ -117,7 +116,9 @@ impl WindowContext {
let gl_context =
renderer::platform::create_gl_context(&gl_display, &gl_config, raw_window_handle)?;
- Self::new(window, gl_context, config, options, proxy)
+ let display = Display::new(window, gl_context, &config, false)?;
+
+ Self::new(display, config, options, proxy)
}
/// Create additional context with the graphics platform other windows are using.
@@ -155,13 +156,20 @@ impl WindowContext {
Some(raw_window_handle),
)?;
- Self::new(window, gl_context, config, options, proxy)
+ // Check if new window will be opened as a tab.
+ #[cfg(target_os = "macos")]
+ let tabbed = options.window_tabbing_id.is_some();
+ #[cfg(not(target_os = "macos"))]
+ let tabbed = false;
+
+ let display = Display::new(window, gl_context, &config, tabbed)?;
+
+ Self::new(display, config, options, proxy)
}
/// Create a new terminal window context.
fn new(
- window: Window,
- context: NotCurrentContext,
+ display: Display,
config: Rc<UiConfig>,
options: WindowOptions,
proxy: EventLoopProxy<Event>,
@@ -171,11 +179,6 @@ impl WindowContext {
let preserve_title = options.window_identity.title.is_some();
- // Create a display.
- //
- // The display manages a window and can draw the terminal.
- let display = Display::new(window, context, &config)?;
-
info!(
"PTY dimensions: {:?} x {:?}",
display.size_info.screen_lines(),