1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 13:21:38 +03:00

macos: fix an issue where new windows created cocoa tabs

To reproduce the problem, maximize wezterm, then press CMD-N.

This commit tells the window not to use cocoa native tabs and
instead really create a new window when we ask it to create
a new window.

closes: #254
This commit is contained in:
Wez Furlong 2020-10-12 17:17:34 -07:00
parent ad6197e4bc
commit c8d59dffb6
2 changed files with 17 additions and 0 deletions

View File

@ -40,6 +40,10 @@ brief notes about them may accumulate here.
* Halved the memory usage requirements per Cell in the common
case (saving 32 bytes per cell), which gives more headroom for
users with large scrollback.
* macOS: Fix issue where new windows would open as Cocoa tabs
when wezterm was maximized.
* macOS: Fix issue where wezterm wouldn't adjust to DPI changes
when dragging across monitors or the screen resolution changed
### 20200909-002054-4c9af461

View File

@ -313,6 +313,9 @@ impl Window {
),
);
// Prevent Cocoa native tabs from being used
let _: () = msg_send![*window, setTabbingMode:2 /* NSWindowTabbingModeDisallowed */];
window.setReleasedWhenClosed_(NO);
// window.cascadeTopLeftFromPoint_(NSPoint::new(20.0, 20.0));
window.center();
@ -956,6 +959,11 @@ impl WindowView {
YES
}
// Don't use Cocoa native window tabbing
extern "C" fn allow_automatic_tabbing(_this: &Object, _sel: Sel) -> BOOL {
NO
}
extern "C" fn window_will_close(this: &mut Object, _sel: Sel, _id: id) {
if let Some(this) = Self::get_this(this) {
// Advise the window of its impending death
@ -1335,6 +1343,11 @@ impl WindowView {
Self::is_flipped as extern "C" fn(&Object, Sel) -> BOOL,
);
cls.add_method(
sel!(allowsAutomaticWindowTabbing),
Self::allow_automatic_tabbing as extern "C" fn(&Object, Sel) -> BOOL,
);
cls.add_method(
sel!(windowDidResize:),
Self::did_resize as extern "C" fn(&mut Object, Sel, id),