Change on_cursor_button's callbacks parameter to a table
This commit is contained in:
parent
096c470571
commit
951dcaf0a3
1 changed files with 15 additions and 6 deletions
21
kiwmi/luak.c
21
kiwmi/luak.c
|
@ -191,13 +191,22 @@ on_cursor_button_notify(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, lc->callback_ref);
|
lua_rawgeti(L, LUA_REGISTRYINDEX, lc->callback_ref);
|
||||||
|
|
||||||
lua_pushinteger(L, event->state);
|
lua_newtable(L);
|
||||||
lua_pushinteger(L, event->button);
|
|
||||||
lua_pushinteger(L, event->time_msec);
|
|
||||||
lua_pushlightuserdata(L, event->device); // TODO: make un-opaque
|
|
||||||
|
|
||||||
if (lua_pcall(L, 4, 0, 0)) {
|
lua_pushlightuserdata(L, event->device); // TODO: make un-opaque
|
||||||
wlr_log(WLR_ERROR, "%s", lua_tostring(L, 1));
|
lua_setfield(L, -2, "device");
|
||||||
|
|
||||||
|
lua_pushinteger(L, event->time_msec);
|
||||||
|
lua_setfield(L, -2, "time");
|
||||||
|
|
||||||
|
lua_pushinteger(L, event->button);
|
||||||
|
lua_setfield(L, -2, "button");
|
||||||
|
|
||||||
|
lua_pushinteger(L, event->state);
|
||||||
|
lua_setfield(L, -2, "state");
|
||||||
|
|
||||||
|
if (lua_pcall(L, 1, 0, 0)) {
|
||||||
|
wlr_log(WLR_ERROR, "%s", lua_tostring(L, -1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue