cosmetic: replace boolean function return values with bool

For functions that test if something is true/valid and return a 1
or 0, it makes sense to switch to bool.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
data_device : change version while initializing data_device_manager interface and data_device interface

[Pekka Paalanen: split long lines, dropped MIN().]

Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
window : compare version and call appropriate destructor

[Pekka Paalanen: removed trailing space, split long line.]

Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
compositor: Fix weston_subsurface_is_synchronized() return value.

Commit 280e7dd918f1717c7d677676384a9cd991097741 introduced a bug in the
return value of weston_subsurface_is_synchronized().

Signed-off-by: Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
compositor: Refactor weston_output_mode_switch()

This breaks weston_output_mode_switch() into 3 functions:
weston_output_mode_set_native()
weston_output_mode_switch_to_temporary()
weston_output_mode_switch_to_native()

Differences from previous behaviour:
SET_NATIVE didn't set current_scale (now it does)
SET_TEMPORARY could set mode and scale independently - now it can't.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Pekka Paalanen <pekka.paalanen@collabora.co.uk>
input: allow to destroy bindings in their handler

use wl_list_for_each_safe to iterate on the bindings list when
firing them, this way a binding can safely be destroyed in its
function handler.

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
xwayland: fix fullscreening

set_fullscreen has been sending configure before changing the state
and xwayland windows added border to the fullscreen size.

This fixes the bug:
https://bugs.freedesktop.org/show_bug.cgi?id=83502

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
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>
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>
tests: simplify move_client and make it more generic

Move client right in the move_client funciton. This allows the surface
use its own configure function, so from now the client can be any
weston surface (xdg, wl_shell, ..)
tests: link tests against libtoytoolkit

We want to use toytoolkit in tests. This patch also
removes colisions of symbols defined in libtoytoolkit
with symbols defined in tests (xzalloc, shm_listener)

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>
clients: add missing getters for input objects

We need get wayland objects from toytoolkit display
(there aleary are display_get_output, input_get_seat, ...),
so that we can use them in the tests. This patch adds:

  display_get_input()
  input_get_wl_pointer()
  input_get_wl_keyboard()
  input_get_wl_touch()

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

In tests we need to know about the decoration size. Moreover
it's a small clean-up.

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>
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>
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