text: Don't crash if a seat has no keyboard

A keyboard might not be present in a seat, so check that before
dereferencing keyboard related pointers.

Also, use the keyboard pointer we set to shorten the code a little bit.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
ivi-shell: Fix wrong condition to check return value of controller_module_init

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
configure: bump libwayland requirements

wl_surface role error codes were added during the 1.6.90 development to
libwayland.

Reported-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
compositor-x11: Fix some shutdown crashes

The assertion in x11_compositor_find_output() can trigger during normal
shutdown, for example, when moving the mouse while hitting a hotkey to
close the weston window.

Instead we can remove the assert(), return NULL, and discard events
we can't find a destination output for.

v2 Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
v1 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
weston_surface: Add surface-to-buffer and buffer-to-surface matrices
gl-renderer: Call glViewport after the context is made current
Use pixel coordinates for weston_output.matrix

Previously, weston_output.matrix was in GL coordinates and therefore only
really useful for the GL backend.
zoom: Use pixels instead of GL coordinates

Previously, the zoom functions used GL coordinates natively which doesn't
work with the new output matrix calculations.  This changes zoom to work in
pixel coordinates to match the new output matrix format.  This also cleans
up the math in the zoom code substantially.
pixman-renderer: Add a weston_matrix_to_pixman_transform function and
simplify the buffer-to-output matrix computation

Now that we have a buffer-to-surface matrix and the global-to-output matrix
is in pixels, we can remove a large chunk of confusing code from the pixman
renderer.  Hopefully, having this stuff in weston core will keep the pixman
renderer from gettin broken quite as often.
pixman-renderer: Use output->matrix for region transformations and enable output zoom
compositor: Move weston_matrix_transform_region to compositor.c and export it

We're going to use this to replace much of the other transform code so
it's no longer just relevant to pixman-renderer.c
compositor: add weston_matrix_transform_rect() and use it where appropriate

New function that transforms a pixman_box32_t rectangle by a matrix.

Since pixman rectangles are represented by 2 corners, non-90 degree
rotations can't be properly represented.  This function gives the
axis aligned rectangle that encloses the rotated rectangle.

We use this for matrix_transform_region() and weston_matrix_transform_rect(),
simplifying them and allowing them to work for non 90 degree rotations.
compositor: use matrix transforms for surface_to_buffer functions

Now that we have weston_matrix_transform and appropriate matrices we can
use that instead of weston_transformed_coord + scaler_surface_to_buffer.

scaler_surface_to_buffer no longer has users, so remove it.
compositor: use weston_matrix_transform_region for overlay setup
compositor: Remove weston_transformed_region

Replace all uses of weston_transform_region with
weston_matrix_transform_region, then remove the function completely.
compositor: Add a function to test if images transformed by a matrix should be bilinearly filtered

If a transformation matrix causes a scale, a rotation not a multiple of 90
degrees or a non-integer translation then textures rendered with
it would benefit from bilinear filtering.

This test is done in a lazy fashion by examining elements of the matrix
to check for a simple pattern that indicates these conditions are met.
renderers: use weston_matrix_needs_filtering to choose filter parameters in gl and pixman renderers

Note: This causes a performance drop when zoomed under pixman.  Also, pixman
has clever optimization algorithms to switch from BILINEAR to NEAREST
automatically when it detects they'll have the same result - we still do our
own test here because the pixman check misses a few opportunities when the
display is flipped.
compositor-drm: use weston_surface_to_buffer_rect instead of weston_transformed_rect

The weston_transformed_rect() call should have the same result as
weston_surface_to_buffer_rect().

Also, this mix of fixed, float, and int is difficult to follow and I don't
trust it, so just convert to fixed for the plane API at the end of the
calculation.
compositor: Remove weston_transformed_rect() and weston_transformed_coord()

The last caller of weston_transformed_rect() has been replaced so we can
remove weston_transformed_rect() - since it was the last caller of
weston_transformed_coord() we can get rid of that too.
compositor: use weston_matrix_transform for weston_output_transform_coordinate

We can greatly simplify weston_output_transform_coordinate now by simply
multiplying by the output matrix and converting the result to fixed point.