Skip to content

Commit ef19e4b

Browse files
committed
further fixup mouse exit event handling
1 parent ad31cb3 commit ef19e4b

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/event.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#include "event.h"
2+
#include "bar_manager.h"
3+
#include "custom_events.h"
24
#include "hotload.h"
35

46
extern struct bar_manager g_bar_manager;
@@ -197,8 +199,18 @@ static void event_mouse_exited(void* context) {
197199
popup_target->mouse_over = true;
198200
}
199201
else {
200-
popup->mouse_over = false;
201202
bar_target->mouse_over = true;
203+
if (popup) {
204+
popup->mouse_over = false;
205+
bool has_complex_mask
206+
= popup->host->update_mask & (UPDATE_MOUSE_EXITED
207+
| UPDATE_EXITED_GLOBAL);
208+
if (has_complex_mask
209+
&& bar_manager_get_item_by_point(&g_bar_manager, point, NULL)
210+
!= popup->host) {
211+
bar_manager_handle_mouse_exited(&g_bar_manager, popup->host);
212+
}
213+
}
202214
}
203215
}
204216
return;
@@ -209,14 +221,13 @@ static void event_mouse_exited(void* context) {
209221
wid,
210222
&window );
211223

212-
if (bar_item) {
213-
if (!(bar_item->update_mask & UPDATE_EXITED_GLOBAL)
214-
|| (bar_manager_get_bar_by_point(&g_bar_manager, point)
215-
&& bar_manager_get_popup_by_point(&g_bar_manager, point)
216-
!= &bar_item->popup)) {
217-
bar_manager_handle_mouse_exited(&g_bar_manager, bar_item);
218-
}
224+
if (bar_item
225+
&& bar_item->update_mask & UPDATE_EXITED_GLOBAL
226+
&& bar_manager_get_popup_by_point(&g_bar_manager, point)
227+
== &bar_item->popup) {
228+
return;
219229
}
230+
if (bar_item) bar_manager_handle_mouse_exited(&g_bar_manager, bar_item);
220231
}
221232

222233
#define SCROLL_TIMEOUT 150000000

0 commit comments

Comments
 (0)