Skip to content

Commit

Permalink
#505 fix focus issue when sending the last window of one display to a…
Browse files Browse the repository at this point in the history
…nother display
  • Loading branch information
koekeishiya committed May 9, 2020
1 parent b0836e4 commit 82afc44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Update scripting addition for macOS 10.15.5 Beta (19F72f) [#501](https:/koekeishiya/yabai/issues/501)
- Allow calling `space --label` without an argument to intentionally remove a previously assigned label [#514](https:/koekeishiya/yabai/issues/514)
- Fixed an issue where a window moved across displays using *mouse action move* would be invisible [#506](https:/koekeishiya/yabai/issues/506)
- Fixed an issue where the last window on a display would not properly update the focused window of the original display upon move, causing selectors to not work as expected [#505](https:/koekeishiya/yabai/issues/505)

## [3.0.0] - 2020-05-01
### Removed
Expand Down
21 changes: 11 additions & 10 deletions src/window_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,10 +1101,9 @@ enum window_op_error window_manager_warp_window(struct space_manager *sm, struct
if (a_view->sid != b_view->sid) {
window_manager_remove_managed_window(wm, a->id);
window_manager_add_managed_window(wm, a, b_view);
space_manager_move_window_to_space(b_view->sid, a);

if (wm->focused_window_id == a->id) {
struct window *next = window_manager_find_window_on_space_by_rank(wm, a_view->sid, 1);
struct window *next = window_manager_find_window_on_space_by_rank(wm, a_view->sid, 2);
if (next) {
window_manager_focus_window_with_raise(&next->application->psn, next->id, next->ref);
} else {
Expand All @@ -1115,6 +1114,8 @@ enum window_op_error window_manager_warp_window(struct space_manager *sm, struct
_SLPSSetFrontProcessWithOptions(&g_process_manager.finder_psn, 0, kCPSNoWindows);
}
}

space_manager_move_window_to_space(b_view->sid, a);
}

space_manager_tile_window_on_space_with_insertion_point(sm, a, b_view->sid, b->id);
Expand Down Expand Up @@ -1214,15 +1215,8 @@ void window_manager_send_window_to_space(struct space_manager *sm, struct window
window_manager_purify_window(wm, window);
}

space_manager_move_window_to_space(dst_sid, window);

if (window_manager_should_manage_window(window) && !window->is_minimized) {
struct view *view = space_manager_tile_window_on_space(sm, window, dst_sid);
window_manager_add_managed_window(wm, window, view);
}

if ((space_is_visible(src_sid) && (moved_by_rule || wm->focused_window_id == window->id))) {
struct window *next = window_manager_find_window_on_space_by_rank(wm, src_sid, 1);
struct window *next = window_manager_find_window_on_space_by_rank(wm, src_sid, 2);
if (next) {
window_manager_focus_window_with_raise(&next->application->psn, next->id, next->ref);
} else {
Expand All @@ -1233,6 +1227,13 @@ void window_manager_send_window_to_space(struct space_manager *sm, struct window
_SLPSSetFrontProcessWithOptions(&g_process_manager.finder_psn, 0, kCPSNoWindows);
}
}

space_manager_move_window_to_space(dst_sid, window);

if (window_manager_should_manage_window(window) && !window->is_minimized) {
struct view *view = space_manager_tile_window_on_space(sm, window, dst_sid);
window_manager_add_managed_window(wm, window, view);
}
}

enum window_op_error window_manager_apply_grid(struct space_manager *sm, struct window_manager *wm, struct window *window, unsigned r, unsigned c, unsigned x, unsigned y, unsigned w, unsigned h)
Expand Down

0 comments on commit 82afc44

Please sign in to comment.