target_input(3)
๐ target_input(3) โ the Arcan Lua API, bestie edition โจ
okay so this is target_input, straight out of the Arcan Lua API โ she's a little function with a big job and honestly? iconic. ๐
โจ NAME โจ
target_input โ basically "hey, forward this input data to a frameserver for me" ๐ซถ
๐ธ SYNOPSIS ๐ธ
resbool
target_input( tgtvid, inputtbl )
๐ DESCRIPTION ๐
okay so here's the vibe: this function takes a properly formatted inputtbl and repackages it into an event structure, which then gets added to the event queue of the frameserver specified by tgtvid. that's it, that's the whole plot. ๐
she returns true if and only if the event was properly formatted and could be successfully added to the incoming event queue of the frameserver. no cap โ both conditions, or you get nothing. ๐ค
so a properly formatted table has these fields:
universal: (devid, subid, kind) โ and the optional gang: (pts, gesture, label).
devidandsubidexist to distinguish between different devices and subaxes or buttons โจkindtells you the type of the input, and lowkey it decides how the whole table gets interpretedptsis the optional, implementation-defined relative 64-bit timestamp in milisecond resolution โฑ๏ธgestureis an optional boolean flag โ it indicates whether the event is a result from abstract gesture analysis or not, and it alters the client interpretation oflabel๐
๐ฆ if gesture is set
then the contents of label should match one of these, exactly:
'touch', 'dbltouch', 'click', 'dblclick', 'drag', 'swipe',
'fling', 'press', 'release', 'drag', 'drop', 'openpinch', 'closepinch',
'rotate'
(yes 'drag' is in there twice โ we don't make the rules, we just report them faithfully ๐)
๐ if gesture is not set/true
then the contents of label should match a previously frameserver-provided labelhint, or โ in the context of a game โ the more abstract ' PLAYER n _BUTTON m' or ' PLAYER n _AXIS m'. ๐ฎ
๐
if kind is touch
the required additional fields are:
pressure(0..1, linear scale)size(px)x(px)y(px)
๐ง if kind is analog
the required additional fields are:
relative(true/false)samples(indexed table of up to 4int16_tranged values)
these values are all the same for generic analog sources, such as game device axes. ๐น๏ธ
still in analog land, the possible additional fields are:
mouse(true/false) โ indicates whether the samples come from a cursor-type device or not. if so, the interpretation of sample values is more complicated, because there's a large variability in how underlying device layers provide their samples ๐ญ
and here's the tea on ordering:
- if
relativeis set totrue, the order is (rel_x,abs_x,rel_y,abs_y) - otherwise the order is (
abs_x,rel_x,rel_y,abs_y)
the reason for this is that the relative indicator shows the primary origin of the samples, while the other is a result of some state estimator and can therefore be less accurate. all permutations of relative, absolute, two samples or four samples need to be accounted for ๐ซ
you can also indicate that the input device is no longer active on the segment by setting the leave field to true. this is important for clients that have explicit enter/leave semantics per device โ typically bridges to other windowing systems. ๐
๐ฅ if kind is digital
the required additional fields are:
active(true/false) โ whether the button is in a pressed state or not
and the possible additional fields are:
translated(true/false)
and if translated is set, the required additional fields are:
keysym(value should match the SDL 1.2 table of symnames)modifiers(16 bit bitfield)*utf8*(single unicode character as utf-8)number(undescript field, typically used to carry on device or OS specific code)
๐๏ธ if kind is eyes
the required additional fields are, deep breath:
blink_left,blink_right(true/false) โ if the eye lids are closed or notgaze_x1,gaze_y1(float) โ screen coordinates for first gaze pointgaze_x2,gaze_y2(float) โ screen coordinates for second gaze pointpresent(true/false) โ if the user is by the screen or nothead_x,head_y,head_z(float) โ head position relative to the trackerhead_rx,head_ry,head_rz(float) โ euler-angle for head
(eye tracking in a manpage, we love to see it ๐ง)
โญ NOTES โญ
- instead of preparing these tables manually, it's recommended to inplace modify those you get from the
applname_inputevent handler ๐ - arguments are flexible โ a table argument will be used as the input table, a number argument will be used as the frameserver vid reference โจ
- the
kindfield can also be supplied as a bool, to cut down on costly string compares โ by using the kind type (analog,digital,touch) as a boolean key set totrue. and the same applies to (translated,mouse). efficiency queen ๐ - mouse events do not necessarily translate into an event on the event-queue โ the engine may choose to use a memory mapped interface. this depends on the
devid(0 for accelerated cursor). ๐
โ ๏ธ note note note: mouse events can vanish into a memory mapped interface instead of the event queue, and that devid is the thing that decides. don't come for me, it's literally what it says.
๐ซถ SEE ALSO ๐ซถ
and that's the page, bestie! ๐ this lil' gem is brought to you by the targetcontrol source, rocking an October 2026 date โ so go forth, forward that input, and slay โจ๐๐
๐ฆ where this page comes from
- nixos 26.05: arcan 0.7.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms