evdev: Continue updating axes internally when tool leaves proximity

Axis changes are now still processed by libinput regardless of whether or not
the tool is in proximity, however we refrain from reporting them unless the tool
is in proximity. This stops bad distance events from being reported without
needing a huge mess of conditional statements in sanitize_axes(). The tool is
now counted as back in proximity when a tool update is received instead of when
an axis update is received.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
evdev: remove parantheses around tablet_(un)set_status

Having parantheses around tablet_has_status() is completely appropriate, but not
for setting/unsetting a status. There's no legitimate reason we'd ever be
checking the return value of tablet_(un)set_status() since it already stores
it's result in a variable. As such, having it expand with parantheses around it
means that if it's accidentally used in a conditional instead of
tablet_has_status() our compiler won't throw any sort of warning. And the subtle
differences between tablet_has_status() and tablet_set_status() are very easy to
miss when trying to debug this. Removing the parantheses causes gcc to warn if
the function is used as a conditional unintentionally.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
tablet: check the button range before we use it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
tablet: rename flags to mask

This is a simple button mask, use that naming.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
tablet: use "int32_t", not "signed"

stdint is a lot nicer, and safer once we're in the habit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
evdev: Clear pressure axis when tool loses contact with the tablet

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
tablet: print invalid evdev types/codes as string for debugging purposes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
evdev: Add tablet_mark_all_axes_changed()

Occasionally all the axes that are valid for a device need to be marked as
updated for the caller's sake.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
evdev: Update all axes when the tool comes back into proximity

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
tablet: warn about tablets that have no X/Y resolution set

This would be a kernel bug if it ever happens. Unfortunately, current uinput
can't set the resolution so we can't just fail, otherwise we can't have any
tablet tests. So just log the error, fix it up and continue from there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
tablet: force a distance resolution of 1

If the resolution is 0, we don't have a meaningful resolution. Use 1 instead
so we can use the resolution in future calculations instead of having to worry
about NaN.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tablet: convert the distance axis to mm

As we say in the documentation, provide the actual distance in mm

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tablet: provide x/y by default in mm off the top/left corner

Given that tablets may not have the same x/y resolution, raw values are mostly
meaningless and likely to be handled the wrong way. Providing x/y in mm is the
only constant, meaningful value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tablet: add a function to get the size of a tablet device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>