mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 04:30:06 +01:00
lua: fix the event type/code loops - EV_MAX/ABS_MAX is inclusive
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1354>
This commit is contained in:
parent
eac44529d8
commit
4ffd8ab544
1 changed files with 3 additions and 3 deletions
|
|
@ -727,7 +727,7 @@ evdevdevice_usages(lua_State *L)
|
||||||
if (device->evdev == NULL)
|
if (device->evdev == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (unsigned int t = 0; t < EV_MAX; t++) {
|
for (unsigned int t = 0; t <= EV_MAX; t++) {
|
||||||
if (!libevdev_has_event_type(device->evdev, t))
|
if (!libevdev_has_event_type(device->evdev, t))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -756,7 +756,7 @@ evdevdevice_absinfos(lua_State *L)
|
||||||
if (device->evdev == NULL)
|
if (device->evdev == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (unsigned int code = 0; code < ABS_MAX; code++) {
|
for (unsigned int code = 0; code <= ABS_MAX; code++) {
|
||||||
const struct input_absinfo *abs =
|
const struct input_absinfo *abs =
|
||||||
libevdev_get_abs_info(device->evdev, code);
|
libevdev_get_abs_info(device->evdev, code);
|
||||||
if (!abs)
|
if (!abs)
|
||||||
|
|
@ -1133,7 +1133,7 @@ static void
|
||||||
libinput_lua_init_evdev_global(lua_State *L, int sandbox_table_idx)
|
libinput_lua_init_evdev_global(lua_State *L, int sandbox_table_idx)
|
||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
for (unsigned int t = 0; t < EV_MAX; t++) {
|
for (unsigned int t = 0; t <= EV_MAX; t++) {
|
||||||
const char *typename = libevdev_event_type_get_name(t);
|
const char *typename = libevdev_event_type_get_name(t);
|
||||||
if (!typename)
|
if (!typename)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue