make mouse button event behavior conform to docs

before, when a mouse button was held down, we'd send a single _MOUSE_L
and _MOUSE_L_DOWN event and that's it. now we properly send a single
_MOUSE_L_DOWN event and _MOUSE_L events for as long as the button is
held down. similar for the right mouse button
develop
myk002 2022-11-21 17:35:14 -08:00
parent edfaf5f9f2
commit e2218d0429
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 6 additions and 6 deletions

@ -156,21 +156,21 @@ void DFHack::Lua::PushInterfaceKeys(lua_State *L,
if (df::global::enabler) { if (df::global::enabler) {
if (df::global::enabler->mouse_lbut_down) { if (df::global::enabler->mouse_lbut_down) {
lua_pushboolean(L, true); lua_pushboolean(L, true);
lua_setfield(L, -2, "_MOUSE_L"); lua_setfield(L, -2, "_MOUSE_L_DOWN");
} }
if (df::global::enabler->mouse_rbut_down) { if (df::global::enabler->mouse_rbut_down) {
lua_pushboolean(L, true); lua_pushboolean(L, true);
lua_setfield(L, -2, "_MOUSE_R"); lua_setfield(L, -2, "_MOUSE_R_DOWN");
} }
if (df::global::enabler->mouse_lbut) { if (df::global::enabler->mouse_lbut) {
lua_pushboolean(L, true); lua_pushboolean(L, true);
lua_setfield(L, -2, "_MOUSE_L_DOWN"); lua_setfield(L, -2, "_MOUSE_L");
df::global::enabler->mouse_lbut = 0; df::global::enabler->mouse_lbut_down = 0;
} }
if (df::global::enabler->mouse_rbut) { if (df::global::enabler->mouse_rbut) {
lua_pushboolean(L, true); lua_pushboolean(L, true);
lua_setfield(L, -2, "_MOUSE_R_DOWN"); lua_setfield(L, -2, "_MOUSE_R");
df::global::enabler->mouse_rbut = 0; df::global::enabler->mouse_rbut_down = 0;
} }
} }
} }