scanner: Use an enum to determine the type of thing we're writing out

Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
scanner: Make emit_structs more explicit

"is_interface" is a really terrible name for the client or server
variants, and instead of checking whether we were passed the requests or
the events, just pass an argument through.

Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
tests: make event-loop-test more explicit

Check value set in handler against an explicit value instead of:
  assert(value);

also add one assert() for non-NULL value.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
event-loop: make signalfd non-blocking

When we add more that one source to a signal, then wayland will
block in wl_event_loop_dispatch. This is due to the attampt to read
from signal's fd each time the source is dispatched.

  wl_event_loop_add_signal(loop, SIGINT, ...);
  wl_event_loop_add_signal(loop, SIGINT, ...);

  /* raise signal .. */

  /* we got two fd's ready, both for the one SIGINT */
  epoll_wait(...) = 2

  [ for (i == 0) ]
      source1->dispatch() --> read(fd1);
  [ for (i == 1) ]
      source2->dispatch() --> read(fd2); /* blocking! */

Reading from fd2 will block, because we got only one signal,
and it was read from fd1.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>