@@ -244,6 +244,9 @@ local function write_ecodes_class(path)
244244 " " ,
245245 generated_from ,
246246 " " ,
247+ " ---" ,
248+ " ---Linux input event codes." ,
249+ " ---" ,
247250 " -- stylua: ignore" ,
248251 " ---@class evdev.ecodes" ,
249252 fmt (" local M = %s" , stringify (ecodes )),
@@ -253,6 +256,22 @@ local function write_ecodes_class(path)
253256 writefile (path , concat (text , " \n " ), " \n " )
254257end
255258
259+ -- stylua: ignore
260+ local descriptions = {
261+ ABS = " Absolute axis codes (e.g. joysticks, touchscreens, tablets)." ,
262+ BTN = " Button codes (e.g. mouse buttons, joysticks, gamepads)." ,
263+ EV = " Event types (e.g. key press, relative movement, absolute position, synchronization)." ,
264+ INPUT_PROP = " Input device property flags (e.g. direct touch, semi-mt, pointer)." ,
265+ KEY = " Keyboard key codes." ,
266+ LED = " LED status indicator codes (e.g. num lock, caps lock, scroll lock)." ,
267+ MSC = " Miscellaneous event codes that do not fit into other types." ,
268+ REL = " Relative axis codes (e.g. mouse movement, scroll wheels)." ,
269+ REP = " Autorepeat configuration event codes." ,
270+ SND = " Sound output event codes (e.g. system bell, sound tones)." ,
271+ SW = " Binary switch state codes (e.g. lid closed, tablet mode)." ,
272+ SYN = " Synchronization event codes used to group events or signal device status changes." ,
273+ }
274+
256275local function write_ecodes_enums (path )
257276 local text = {
258277 " ---@meta _" ,
@@ -263,6 +282,9 @@ local function write_ecodes_enums(path)
263282 for prefix , ecodes in spairs (ecodes_by_prefix ) do
264283 if prefixes [prefix ] then
265284 text [# text + 1 ] = " "
285+ text [# text + 1 ] = " ---"
286+ text [# text + 1 ] = fmt (" ---%s" , descriptions [prefix ] or (prefix .. " codes." ))
287+ text [# text + 1 ] = " ---"
266288 text [# text + 1 ] = " -- stylua: ignore"
267289 text [# text + 1 ] = fmt (" ---@enum evdev.ecodes.%s" , prefix :lower ())
268290 text [# text + 1 ] = fmt (" local %s = %s" , prefix , stringify (ecodes ))
0 commit comments