Send mouseleft event when the mouse leaves the window (#928)

* Send `mouseleft` event when the mouse leaves the window

* Call `View:on_mouse_left` when the mouse leaves the `View`

Previously `View:on_mouse_left` was called only when the mouse left the
window, and it was called on every visible `View`.

Now it gets also called when the mouse "changes" `View`, and only the
last `View` the mouse was on will receive the event.
This commit is contained in:
Guldoman
2022-04-28 21:50:34 -04:00
committed by GitHub
parent ac42e6457a
commit 9de75988ba
5 changed files with 36 additions and 0 deletions
+3
View File
@@ -161,6 +161,9 @@ top:
} else if (e.window.event == SDL_WINDOWEVENT_RESTORED) {
lua_pushstring(L, "restored");
return 1;
} else if (e.window.event == SDL_WINDOWEVENT_LEAVE) {
lua_pushstring(L, "mouseleft");
return 1;
}
if (e.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
lua_pushstring(L, "focuslost");