compositor: Use uint32_t for the msecs value consistently
terminal: Don't output @ for ASCII NUL

Fixes visual bell in screen.
compositor: Accumulate damage per plane

When we analyze and accumulate damage prior to repainting, we need to
accumulate damage per plane, so that whatever damage a surface
contributes is accumulated in the plane that it's assigned to.  Before,
we would always accumulate damge in the primary plane, which caused
repaints in the primary plane whenever a surface in a sprite or
framebuffer was damaged.  Eliminating this repaint is a big win for
cases where we pageflip to a client surface or use a sprite overlay.

This also prepares for fixing the missing cursor updates, since we
now track damage to the cursor surface in a dedicated sprite plane.
compositor-drm: Split cursor handling into prepare and set

Like how we handle overlays, we split drm_output_set_cursor() into
drm_output_prepare_cursor_surface() that will assign the hw cursor to
a suitable surface and drm_output_set_cursor() that will do the actual
work of updating cursor contents and moving it.  This is more in line
with how we handle everything else, and lets us update cursor contents
based on changes to the cursor plane damage.

This works when the cursor content changes but also accumulates
damage when the cursor changes output.  In that case we move the
cursor surface to the cursor plane in the new output and
weston_surface_move_to_plane() will generate the damage that triggers
download of sprite contents there.
terminal: Don't crash on non-ascii chars

isalpha() and isdigit() don't like huge values.
Noticed with ascii-art in the shell prompt.
spring: Avoid looping if time appears to be going backwards

Since the time values are unsigned integers we can check whether the msec is
smaller than spring->timestamp by checking if the subtraction overflows into a
value greater than half the maximum unsigned integer range (ie. top bit set)
evdev: rename device_removed() to evdev_input_device_destroy()

evdev_input_device_destroy() will completement the API of
evdev_input_device_create(), both being independent from udev.

Since the udev-specific device_removed() would only call
evdev_input_device_destroy() and do nothing else, device_remove() calls
are simply replaced with evdev_input_device_destroy().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
evdev: move device opening out from evdev_input_device_create

This makes the generic evdev code (i.e. the functions not relying on
udev) independent of launcher-util too. The aim is to allow re-using the
generic evdev code in the Android backend, where neither udev nor
launcher-util are available.

evdev_input_device_create() signature is changed:
- add the opened device file descriptor
- remove wl_display as unused

Also add a bit of failure logging.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
evdev: merge evdev-private.h into evdev.h

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
evdev: change evdev_seat into weston_seat in struct evdev_input_device

We are phasing out struct evdev_seat.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
evdev: make evdev_led_update independent from struct evdev_seat

in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
evdev: make evdev_notify_keyboard_focus() independent of evdev_seat

in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
evdev: pass weston_seat to evdev_input_device_create()

in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
evdev: rename evdev_seat to drm_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
evdev: expose the generic evdev API

This API does not depend on udev or launcher-util.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
evdev: move udev code into compositor-drm.c

Move all udev-related and now drm backend specific code into
compositor-drm.c.

This makes evdev.c free of udev and launcher-util, and allows it to be
used on Android.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
evdev: log input devices

Write information about found input devices into the log. Also fetch and
record the device name.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
compositor-drm: fix leak in evdev_udev_handler()

If the sysname of the udev device did not start with "event", the
function returned without unreferencing udev_device.

The function is refactored to have a common exit path that unrefs
udev_device. The return value semantics are not changed.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
compositor-drm: log input device hot-unplugs

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
compositor-drm: log enter/leave VT

All input devices are re-added during enter VT, so these messages in the
log will clarify what happened with input.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>