Skip to content

Commit

Permalink
#2075 fix caching issue when using focus_follows_mouse to focus a mon…
Browse files Browse the repository at this point in the history
…itor with no windows
  • Loading branch information
koekeishiya committed Feb 4, 2024
1 parent 1a14dc1 commit a52f0f7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- Using caching issue when using focus_follows_mouse to switch focus between monitors with no windows [#2075](https:/koekeishiya/yabai/issues/2075)

## [6.0.9] - 2024-02-04
### Changed
Expand Down
7 changes: 4 additions & 3 deletions src/display_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static AXUIElementRef display_manager_find_element_at_point(CGPoint point)

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
void display_manager_focus_display_with_point(uint32_t did, CGPoint point, bool update_cursor_position)
int display_manager_focus_display_with_point(uint32_t did, CGPoint point, bool update_cursor_position)
{
int element_connection;
ProcessSerialNumber element_psn;
Expand All @@ -308,14 +308,15 @@ void display_manager_focus_display_with_point(uint32_t did, CGPoint point, bool
SLSGetConnectionPSN(element_connection, &element_psn);
window_manager_focus_window_with_raise(&element_psn, element_id, element_ref);
CFRelease(element_ref);
goto out;
return element_id;

err_ref:
CFRelease(element_ref);
click:
CGPostMouseEvent(point, update_cursor_position, 1, true);
CGPostMouseEvent(point, update_cursor_position, 1, false);
out:;

return 0;
}
#pragma clang diagnostic pop

Expand Down
2 changes: 1 addition & 1 deletion src/display_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ bool display_manager_active_display_is_animating(void);
bool display_manager_display_is_animating(uint32_t did);
int display_manager_active_display_count(void);
uint32_t *display_manager_active_display_list(int *count);
void display_manager_focus_display_with_point(uint32_t did, CGPoint point, bool update_cursor_position);
int display_manager_focus_display_with_point(uint32_t did, CGPoint point, bool update_cursor_position);
void display_manager_focus_display(uint32_t did, uint64_t sid);
bool display_manager_begin(struct display_manager *dm);

Expand Down
3 changes: 2 additions & 1 deletion src/event_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,8 @@ static EVENT_HANDLER(MOUSE_MOVED)
CGRect menu = display_manager_menu_bar_rect(cursor_did);
if (cgrect_contains_point(menu, point)) goto out;

display_manager_focus_display_with_point(cursor_did, point, false);
int wid = display_manager_focus_display_with_point(cursor_did, point, false);
g_mouse_state.ffm_window_id = wid;
}

out:
Expand Down

0 comments on commit a52f0f7

Please sign in to comment.