Skip to content

Commit 0d39816

Browse files
committed
further fixup mouse exit event handling
1 parent 36bbbc6 commit 0d39816

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/event.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,17 @@ static void event_mouse_exited(void* context) {
209209
wid,
210210
&window );
211211

212-
if (bar_item
213-
&& bar_item->update_mask & UPDATE_EXITED_GLOBAL
214-
&& bar_manager_get_popup_by_point(&g_bar_manager, point)
215-
== &bar_item->popup) {
216-
return;
212+
if (!bar_item || !(bar_item->update_mask & UPDATE_EXITED_GLOBAL)
213+
|| (bar_manager_get_bar_by_point(&g_bar_manager, point)
214+
&& bar_manager_get_popup_by_point(&g_bar_manager, point)
215+
!= &bar_item->popup)) {
216+
CGRect window_rect = window ? window->frame : CGRectNull;
217+
window_rect.origin = window ? window->origin : CGPointZero;
218+
window_rect = CGRectInset(window_rect, 1, 1);
219+
if (!CGRectContainsPoint(window_rect, point)) {
220+
bar_manager_handle_mouse_exited(&g_bar_manager, bar_item);
221+
}
217222
}
218-
bar_manager_handle_mouse_exited(&g_bar_manager, bar_item);
219223
}
220224

221225
#define SCROLL_TIMEOUT 150000000

0 commit comments

Comments
 (0)