macOS: When closing a top-level window only switch focus to the previous kitty window if it is on the same workspace

Fixes #1379
Fixes #1383
This commit is contained in:
Kovid Goyal
2019-02-16 13:21:52 +05:30
parent 8de4dd334b
commit 7fd4ec50c9
3 changed files with 18 additions and 4 deletions

View File

@@ -372,8 +372,8 @@ cocoa_focus_window(void *w) {
int
cocoa_get_workspace_id(void *w) {
NSWindow *window = (NSWindow*)w;
int ans = 0;
CGSGetWindowWorkspace(_CGSDefaultConnection(), [window windowNumber], &ans);
int ans = -1;
if (window) CGSGetWindowWorkspace(_CGSDefaultConnection(), [window windowNumber], &ans);
return ans;
}