tests: link tests against libtoytoolkit

We want to use toytoolkit in tests

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
tests: remove static definitions of xzalloc

It is in libtoytoolkit and it collides

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
tests: rename shm_listener to wl_shm_listener

The name collides with the shm_listener from toytoolkit

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
tests: add toytoolkit into struct client

Allow store information about toytoolkit widget in client.
Now we'll be able to get client behave as a toytoolkit client.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
tests: use wl_* objects instead of test structs

When storing client state i. e. focus, we use our structs.
For example when we got pointer focus, we store into pointer->focus
the type 'struct surface'. We did it via user data in wl_* object,
but toytoolkit has its own data in the objects and storing and reading
them as our structures results in reading "garbage".
Solution: store wl_* objects instead - we don't need anything more.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
tests-helper: distil the functionality from handlers

Split out the real code from event handlers (like pointer_handle_motion,
etc.) and put it into standalone function. We'll use it in follow-up
patch where we will register handlers for toytoolkit clients and we'll
use the new functions so that the code won't be duplicated.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
clients: add display_get_input function

We have display_get_output func, but we need sometimes to get
the input too.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
clients: add getters for wayland input objects

Add getters for wl_{pointer, keyboard, touch} from struct input

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
add toytoolkit_client_create
tests: do attach only with normal surfaces

When we call move_client on toytoolkit client when intializing, then the
wl_buffer is NULL and we don't want that. Actually, toytoolkit clients
don't need attaching and commiting the surface at all, because it has
been already done.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
tests: test if client was populated properly

Since we are populating our client from globals that we get
from toytoolkit, check if we have everyting.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
window: add display_dispatch

Split display_run into two functions - display_run and display_dispatch.
display_dispatch is the part that actually does something and
display_run just calls it in a loop. Now we can dispatch toytoolkit
events in tests (display_run is blocking, so we couldn't use that)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
add get_geometry & geometry request/event
tests: make client_roundtrip universal

Make client_roundtrip a function instead of macro and
make it work with both - normal clients and toytoolkit clients.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
weston-test: use real time instead of magic number

Pass time from weston_compositor_get_time() into notify_{motion, button}
etc. Until now the time was hardcoded to 100 and with toytoolkit clients
it causes problems, because toytoolkit checks the time.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
add toytoolkit test