xwm: find a seat for all the surface's views

This allows to move or resize a xwayland client by acting on all
its views.
compositor: Return a user-defined exit code

Currently, once we've reached our main's wl_display_run(), we always
return ret=EXIT_SUCCESS when weston terminates through wl_display_terminate.

This patch makes it possible to specify another return value by setting
prior to terminating Weston. This is useful for automated tests that want
to report test failures to the overlying testing infrastructure.

Signed-off-by: Frederic Plourde <frederic.plourde@collabora.co.uk>
[Pekka: fixed some tabs.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
compositor: do not overwrite error exit code

If there are several things that cause an exit, keep the error code from
the first one, not the last one. The latter ones could be just fallout
from the first.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Revert "input: don't send to clients key events eaten by bindings"

This reverts commit 5c11fc6fb7d9b1bccd50fc982c0798c9e09a2a04.

According to two input specialists, this was the wrong way:
http://lists.freedesktop.org/archives/wayland-devel/2014-November/018287.html

Cc: Peter Hutterer <peter.hutterer@who-t.net>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Giulio Camuffo <giuliocamuffo@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
protocol: Fix some typos in protocol files

Signed-off-by: Seedo Eldho Paul <seedoeldhopaul@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
toytoolkit: rename tile_mask to render_shadow

This function is used and clearly designed only for drawing the shadows.
Rename it so that it has name after what it does and also move some
common code into the function.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
cairo-util: fix shadows for small clients

If the client is small (< 128 pixels in any ward),
then the shadows overlap and create dark lines behind clients.
This is a problem mosly with pop-up menues. The lines become observable
when the menu has less than three items. The other case is when
the client doesn't restrict its size when resizing (try
'weston-eventdemo --max-width=1 --max-height=1' for example)

This fixes a part of the bug:
https://bugs.freedesktop.org/show_bug.cgi?id=78511

v2:
  - rework computing of the size of corners
  - rewrite some comments
  - rename tile_mask to render_shadow (in separate patch)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
backends: refactor transform string parsing

Most of the backends do their own parsing of transform strings, so let's
put that all in the same place (compositor.c/h)

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.