Commit graph

320 commits

Author SHA1 Message Date
Daniel Stone 4938f93f57 tests: Remove buffer-count
buffer-count was introduced in line with a Mesa change which forced
an earlier block on frame events to try to enforce double-buffering
where available.

The Mesa change has since been reverted (Mesa commit 9ca6711faa), as
this had unpleasant interactions with buffer_age in particular, so this
test is no longer valid.

Additionally, it only worked on backends which initialised EGL (not
headless-backend, where tests generally run), which can be flaky due to
initialisation races. Not only that, but on the DRM backend, we can
legitimately enter triple-buffering due to promoting the surface to a
hardware plane, skipping GPU composition.

In light of all this, just remove the test.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2017-01-30 18:56:50 +00:00
Ucan, Emre (ADITG/SW1) fbce2f5dd9 ivi-shell: add screen_add_layers test
Test adds 3 layers in a screen's render order list.
First, it adds in the order which layers are created.
Later, test cleans the render order list,
and adds layers in reverse order.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-01-27 16:43:47 +02:00
Ucan, Emre (ADITG/SW1) 5d6aa9ba30 ivi-shell: add layer_add_surfaces test
Test adds 3 surfaces in a layer's render order list.
First, it adds in the order which surfaces are created.
Later, test cleans the render order list, and adds surfaces in reverse
order.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-01-27 16:43:47 +02:00
Yann E. MORIN 20f30e1ae9 tests: add missing include
The int32_t type is defined in stdint.h.

The musl C library is very conservative in the headers that it
internally includes, and stdint.h is not included by any other header,
unlike with glibc or uClibc, which breaks the build.

Add the missing header.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-01-23 14:12:06 +02:00
Quentin Glidic 6d3887baec
weston: Add a specific option to load XWayland
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-17 18:25:01 +01:00
Quentin Glidic 8af2beccbd
weston: Properly namespace modules entrypoint
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-17 18:24:56 +01:00
Quentin Glidic 3d7ca3b9ea
libweston: Properly namespace modules entrypoint
Use different functions so we cannot load a libweston common module in
weston directly or the other way around.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-17 18:24:53 +01:00
Quentin Glidic 82681571cf libweston: Position layers in an absolute way
Currently, layers’ order depends on the module loading order and it does
not survive runtime modifications (like shell locking/unlocking).
With this patch, modules can safely add their own layer at the expected
position in the stack, with runtime persistence.

v4 Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
[Pekka: fix three whitespace issues]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-01-17 16:50:18 +02:00
Daniel Stone 2295a62788 tests: Skip Xwayland test if binary isn't available
We know we're not going to succeed if the binary isn't installed, so
skip the test in that case.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-30 10:28:04 +00:00
Daniel Stone 9983400465 tests: Extend subsurface place_{above,below} hierarchy
Following on from b8c16c995b, extend the family tree being tested by
place_above and place_below a little, ensuring that subsurfaces can't be
placed above or below surfaces which are related to them, but aren't
their immediate parent or sibling.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-23 10:17:43 +00:00
Arnaud Vrac b8c16c995b compositor: allow using nested parent as a subsurface sibling
The parent of a subsurface can be used as a sibling in the place_below
and place_above calls. However this did not work when the parent is
nested, so fix the sibling check and add a test to check this case.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2016-11-22 12:39:11 +00:00
Emil Velikov a69b870e1d tests/buffer-count-test: teardown after the test
Might be a bit of an overkill, but still. One should cleanup after
themselves.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:29 +00:00
Quentin Glidic 2edc3d5462
libweston: Rename weston_surface::configure to ::committed
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Giulio Camuffo <giulio.camuffo@kdab.com>

Differential Revision: https://phabricator.freedesktop.org/D1246
2016-08-14 09:28:50 +02:00
Bryce Harrington 82b9f2baec Add safe_strtoint() helper
Adds a safe strtol helper function, modeled loosely after Wayland
scanner's strtouint.  This encapsulates the various quirks of strtol
behavior, and streamlines the interface to just handling base-10 numbers
with a simple true/false error indicator and a uint32_t return by
reference.

Test cases are loosely derived from an earlier patch by Imran Zaman.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-06 18:19:19 -07:00
Jussi Kukkonen 649bbce607 include stdint.h for int32_t/uint32_t
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-07-26 16:26:08 -07:00
Bryce Harrington d0716f4af5 Re-apply "config-parser: Catch negative numbers assigned to unsigned config values"
[With hexadecimal color values now handled via their own routine,
re-introduce the negative unsigned numbers fix.]

strtoul() has a side effect that when given a string representing a
negative number, it treats it as a high value hexadecimal.  IOW,
strtoul("-42", &val) sets val to 0xffffffd6.  This could potentially
result in unintended surprise behaviors.

Catch this by using strtol() and then manually check for the negative
value.  This logic is modelled after Wayland's strtouint().

Note that this change unfortunately reduces the range of parseable
numbers from [0,UINT_MAX] to [0,INT_MAX].  The current users of
weston_config_section_get_uint() are anticipating numbers far smaller
than either of these limits, so the change is believed to have no impact
in practice.

Also add a test case for negative numbers that catches this error
condition.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-26 16:21:20 -07:00
Bryce Harrington e776f2a4d9 config-parser: Add weston_config_section_get_color
Previously weston_config_section_get_uint was serving dual purpose for
parsing both unsigned decimal integer values (ids, counts, seconds,
etc.)  and hexadecimal values (colors), by relying on strtoul's
auto-detection mechanism.

However, this usage is unable to catch certain kinds of error
conditions, such as specifying a negative number where an unsigned
should be used.  And for colors in particular, it would misparse hex
values if the leading 0x was omitted.  E.g. "background-color=99999999"
would render a near-black background (effectively 0x05f5e0ff) instead of
medium grey, and "background-color=ffffffff" would be treated as an
error rather than white.  "background-color=0x01234567",
"background-color=01234567", and "background-color=1234567" each
resulted in the value being parsed as hexadecimal, octal, and decimal
respectively, resulting in colors 0x01234567, 0x00053977, and 0x0012d687
being displayed.

This new routine forces hexadecimal to be used in all cases when parsing
color values, so "0x01234567" and "01234567" result in the same color
value, "99999999" is grey, and "ffffffff" is white.  It also requires
exactly 8 or 10 digits (other lengths likely indicate typos), or the
value "0" (black).

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-26 15:57:14 -07:00
Bryce Harrington 03793e3998 Revert "config-parser: Catch negative numbers assigned to unsigned config values"
The reduction in range limits does have an effect for color values,
which are expressed as hexadecimal values from 0x00000000 to
0xFFFFFFFF.  By limiting the range to INT_MAX, color values of
0x80000000 and up are in fact lost.

This reverts commit 6351fb08c2.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
2016-07-13 14:40:28 -07:00
Bryce Harrington 6351fb08c2 config-parser: Catch negative numbers assigned to unsigned config values
strtoul() has a side effect that when given a string representing a
negative number, it returns a negated version as the value, and does not
flag an error.  IOW, strtoul("-42", &val) sets val to 42.  This could
potentially result in unintended surprise behaviors, such as if one were
to inadvertantly set a config param to -1 expecting that to disable it,
but with the result of setting the param to 1 instead.

Catch this by using strtol() and then manually check for the negative
value.  This logic is modelled after Wayland's strtouint().

Note that this change unfortunately reduces the range of parseable
numbers from [0,UINT_MAX] to [0,INT_MAX].  The current users of
weston_config_section_get_uint() are anticipating numbers far smaller
than either of these limits, so the change is believed to have no impact
in practice.

Also add a test case for negative numbers that catches this error
condition.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-12 15:50:05 -07:00
Bryce Harrington cbc053781e config-parser: Improve error checks for strtol/strtoul calls
Check errno, which is set of over/underflow, out of range, etc.  Also
check for empty strings (the usages covered in this patch already also
cover the case where there are non-digits present).  Set errno to 0
before making the strto*l call in case of pre-existing errors
(i.e. ENOTTY when running under the testsuite).

This follows the error checking style used in Wayland
(c.f. wayland-client.c and scanner.c).

In tests, also check errno, and add testcases for parsing '0'.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-08 11:10:38 -07:00
Armin Krezović d0cf441134 tests: update for manual surface/view mapping
This is a follow up for weston-test to manually
set mapped status for views/surfaces it controls

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-07-01 15:29:26 +03:00
Pekka Paalanen 827b5d225d compositor: add plugin-registry
Implement a simple register and lookup for function tables. This is
intended for plugins to expose APIs to other plugins.

It has been very hard to arrange a plugin to be able to call into
another plugin without modifying Weston core to explicitly support each
case. This patch fixes that.

The tests all pass.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2016-07-01 14:10:26 +03:00
Bryce Harrington 260c2ffd97 input: Rename weston_surface_activate to weston_seat_set_keyboard_focus
The name suggests that it activates surfaces, but the code says it
rather just assigns keyboard focus.  Rename it for clarity, and so the
original function name could be used for something more appropriate
later.  Switch order of parameters since keyboard focus is a property of
the seat.  Update all callers as appropriate.

Change was asked for by pq, May 26, 2016:

 "This should be called weston_seat_set_keyboard_focus(seat, surface).
 Keyboard focus is a property of the seat."

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-06-30 13:15:33 +03:00
Pekka Paalanen a5bb91dcdc tests: implement visualize_image_difference()
Useful for pointing out where the image comparisons fail.

Internal-screenshot-test is modified to save the visualization if the
test fails.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-06-29 12:41:31 +03:00
Pekka Paalanen 365c1296fa tests: make screenshooting return a buffer
Screenshooting does not involve creating a wl_surface, so using struct
surface is superfluous.

Return a struct buffer instead. It could have been just a
pixman_image_t, but setting up proper destruction would be a bit more
work. Should not hurt to keep the wl_buffer around until the user is
ready to free the image.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-06-29 12:41:31 +03:00
Pekka Paalanen fd10ef0f63 tests: convert image saver to pixman
This rewrites write_surface_as_png() into write_image_as_png(), which
operates on a pixman_image_t instead of a struct surface.

This is part of the migration to use pixman_image_t everywhere without
superfluous parameters/members.

Now the image saving handles more than just ARGB32 format, presumably.
At least it does not assume everything is always ARGB32.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-06-29 12:41:31 +03:00
Pekka Paalanen 289fdeb019 tests: convert reference image loader to pixman
This rewrites load_surface_from_png() to load_image_from_png(), to
return a pixman_image_t instead of a struct surface.

A loaded image has no need for wl_buffer or wl_surface or any of the
associated attributes. This is part of unifying to make everything use
pixman_image_t.

cairo_surface_flush() is added, because Cairo documentation for
cairo_image_surface_get_data() says you have to flush after drawing,
before using the data. It is unclear if loading a PNG counts as drawing,
so stay on the safe side.

load_image_from_png() now pays attention to the pixel format returned by
Cairo, which seems to come out as CAIRO_FORMAT_RGB24 in
internal-screenshot-test, not as CAIRO_FORMAT_ARGB32 as expected. I do
not know if Cairo actually guarantees the x8/a8 channel to be 0xff for
RGB24, but better to not trust it. Therefore the image is explicitly
converted to a8r8g8b8 as needed. This also adds support for loading A8
and RGB16_565 images, provided that Cairo delivers them.

The cairo surface is now wrapped directly into a pixman_image_t. If the
pixel format conversion is not needed, this eliminates a copy of the
image data. The Cairo surface will get automatically destroyed with the
Pixman image.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-06-29 12:41:31 +03:00
Pekka Paalanen 47d68dae59 tests: rewrite check_surfaces_*() API
check_surfaces_geometry() is removed as it was not used by anything, and
unlikely would be.

check_surfaces_equal() is merged into check_surfaces_match_in_clip(),
passing a NULL clip means to compare whole images.

check_surfaces_match_in_clip() is converted to work on pixman_image_t
instead of struct surface. The function is only concerned about
comparing images in memory, and does not care about a wl_buffer or a
wl_surface.

The verbosity of image comparisons is greatly reduced. An image mismatch
no longer prints a flood of raw pixel values. This will be replaced
later with a function writing out an error image instead.

Degenerate comparisons are no longer accepted, be that clip outside
images or zero area. Those are an indication of a programmer error.

The pixel format assumptions are made more visible in the code.

A new internal helper image_check_get_roi() computes and verifies the
area to be compared. Image iterator helper makes it simpler to write
manual pixel-poking loops.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-06-29 12:41:31 +03:00
Pekka Paalanen 2be0c98122 tests: let create_shm_buffer() handle any format
Change create_shm_buffer() to handle any pixel format known to Pixman.
Presumably in the future we might want to test e.g. RGB565 content with
screenshot tests.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-06-29 12:41:31 +03:00
Pekka Paalanen 11f263307a tests: make create_shm_buffer() static
No users remain outside the file. This will allow to fix the assumptions
in the function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-06-29 12:41:31 +03:00
Pekka Paalanen 41d5231f03 tests: ivi_layout-test to use create_shm_buffer_a8r8g8b8()
This removes the uses of create_shm_buffer() from this test.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-06-29 12:41:31 +03:00
Pekka Paalanen 95e2872e9c tests: internal-screenshot-test to use create_shm_buffer_a8r8g8b8()
This removes the uses of create_shm_buffer() from this test.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-06-29 12:41:31 +03:00
Pekka Paalanen 7789acd186 tests: event-test to use create_shm_buffer_a8r8g8b8()
This removes the uses of create_shm_buffer() from this test.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-06-29 12:39:30 +03:00
Pekka Paalanen 924cd948ee tests: introduce struct buffer for client-helper
We are growing more tests that need to handle buffers, both just images
and wl_buffers. Particularly the screenshooting facility needs these.
Currently everything is in struct surface, which contains more than we
need. It is a bit messy.

Create a new struct buffer to encapsulate the image representation, the
wl_buffer, and enough information to tear it all down (munmap) so we
don't have to leak everything. Some tests might start doing things in
loops, and leaking would accumulate.

Instead of inventing our own image representation, use pixman_image_t.
It is a well-tested library worth using, and we already rely on it in
other places.

This makes the tests depend on Pixman, which requires the fix for
building buffer-count, which would otherwise not find pixman.h.

The new create_shm_buffer_a8r8g8b8() creates an image with an explicit
format, and pixman_image_t keeps track of it. And stride and size and
data. This implementation is still a little hacky due to calling
create_shm_buffer().

A very new thing is buffer_destroy(). Previously we didn't really free
any buffers. It is not a problem when the process will exit soon anyway,
but it may become a problem if tests start iterating things.

Manual memset() on a image is converted to a pixman action, just to show
how to do it properly with pixman.

Stride and pixel format assumptions still linger all around, but those
are for another patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-06-29 12:39:30 +03:00
Ucan, Emre (ADITG/SW1) 37d25bb1e0 ivi-shell: implement surface_on_many_layer test
A surface can be added to many layers.
This test is implemented to test this use-case
and the correct behaviour of get_layers_under_surface
API.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-06-29 11:32:23 +03:00
Pekka Paalanen 0f1cac54af tests: print the command line to log
weston-tests-env is a beast to handle, when you would like to start
weston manually for a test you wan to start inside gdb. This patch
causes the full command line to be printed to the automake test logs, so
you can copy it from there and run it by hand.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-06-23 18:15:43 +03:00
Pekka Paalanen e651bb021e tests: fix the cursor race in internal-screenshot
This fix also depends on "compositor-headless: do not create a seat".

If we lose the race against weston-desktop-shell setting cursors, which
is very rare, we get a cursor image in the screenshot, causing the test
to fail. This is now fixed by moving the (remaining) cursor out of the
way.

Arguably we should have better solutions for this, but that is another
story. This is a stop-gap measure we can copy also in new
screenshooting tests.

v2: Remove the example code for how to trigger the race, and rewrite the
big comment.

Cc: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-06-23 18:04:19 +03:00
Pekka Paalanen b5e3ea218b Rename src/ to libweston/
This clarifies what is supposed to be the libweston code.

v2: screen-share.c is already in compositor/ instead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Acked-by: Benoit Gschwind <gschwind@gnu-log.net>
[Pekka: rebased]
2016-06-23 17:44:54 +03:00
Pekka Paalanen 58f98c99f5 Move weston source to compositor/
This is the start of separating weston-the-compositor source files from
libweston source files.

This is moving all the files related to the 'weston' binary. Also the
CMS and systemd plugins are moved.

xwayland plugin is not moved, because it will be turned into a
libweston feature.

To avoid breaking the build, #includes for weston.h are fixed to use
compositor/weston.h. This serves as a reminder that such files may need
further attention: moving to the right directory, or maybe using the
proper -I flags instead.

v2: Move also screen-share.c, and add a note about weston-launch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Acked-by: Benoit Gschwind <gschwind@gnu-log.net>
[Pekka: rebased]
2016-06-23 17:44:54 +03:00
Pekka Paalanen 315bf8c5da tests: check kbd init in the plugin
Check that the keyboard init in weston-test.so plugin succeeds.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-06-23 14:48:38 +03:00
Pekka Paalanen 82d95a6dc5 tests: add wp_viewporter tests
These tests poke the viewporter interface to ensure proper behaviour
from client perspective, without testing the rendering result.

These cases are covered:
- create viewport twice
- source rectangle invalid value errors, and unset
- destination size invalid value errors, and unset
- source causing non-integer destination size
- source inside/outside of buffer with transform, scale
- source outside NULL buffer, then getting real buffer
- source outside NULL buffer with inherited NULL
- set_source, set_destination, and destroy after the wl_surface is
  destroyed

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-09 11:17:16 +03:00
Giulio Camuffo fba27fbef2 Move the functions launching clients to main.c
They belong in the compositor rather than libweston since they
set signals handlers, and a library should not do that behind its
user's back. Besides, they were using functions in main.c already
so they were not usable by other compositors.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-06-03 13:16:39 +03:00
Pekka Paalanen fd01ba055d tests: check for NULL surface in keyboard and pointer handlers
When a test destroys a wl_surface, it is still possible to get events
referring to the destroyed surface. The surface in such cases will be
NULL.

Handle NULL surface gracefully in keyboard and pointer enter/leave
handlers. Touch-down handler is already NULL-safe.

This fixes a SEGV in a test I am writing for wp_viewport.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-04-22 10:45:09 +03:00
Ucan, Emre (ADITG/SW1) c49aa5acad ivi-shell: rework configure_surface notification
The add_notification_configure_surface API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to
add_listener_configure_surface.

This change has several advantages:
1. Code cleanup
2. No dynamic memory allocation. Listeners are allocated
   by controller plugins
3. Remove API is not needed. Controller plugins can easily
   remove the listener link.

The remove API is removed too:
- ivi_layout_remove_notification_configure_surface

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-05 11:53:48 +03:00
Ucan, Emre (ADITG/SW1) 67f0aa8767 ivi-shell: rework remove_surface notification
The add_notification_remove_surface API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to add_listener_remove_surface.

This change has several advantages:
1. Code cleanup
2. No dynamic memory allocation. Listeners are allocated
   by controller plugins
3. Remove API is not needed. Controller plugins can easily
   remove the listener link.

The remove API is removed too:
- ivi_layout_remove_notification_remove_surface

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-05 11:53:48 +03:00
Ucan, Emre (ADITG/SW1) 562f2ecb0c ivi-shell: rework remove_layer notification
The add_notification_remove_layer API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to add_listener_remove_layer.

This change has several advantages:
1. Code cleanup
2. No dynamic memory allocation. Listeners are allocated
   by controller plugins
3. Remove API is not needed. Controller plugins can easily
   remove the listener link.

The remove API is removed too:
- ivi_layout_remove_notification_remove_layer

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-05 11:53:48 +03:00
Ucan, Emre (ADITG/SW1) c98f2cf16b ivi-shell: rework create_layer_notification
The add_notification_layer_surface API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to add_listener_layer_surface.

This change has several advantages:
1. Code cleanup
2. No dynamic memory allocation. Listeners are allocated
   by controller plugins
3. Remove API is not needed. Controller plugins can easily
   remove the listener link.

The remove API is removed too:
- ivi_layout_remove_notification_create_layer

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-05 11:53:48 +03:00
Ucan, Emre (ADITG/SW1) 970f831588 ivi-shell: rework create_surface notification
The add_notification_create_surface API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to
add_listener_create_surface.

This change has several advantages:
1. Code cleanup
2. No dynamic memory allocation. Listeners are allocated
   by controller plugins
3. Remove API is not needed. Controller plugins can easily
   remove the listener link.

The remove API is removed too:
- ivi_layout_remove_notification_create_surface

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-05 11:53:48 +03:00
Ucan, Emre (ADITG/SW1) 3750d1b270 ivi-shell: rework layer_add_notification API
The layer_add_notification API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to layer_add_listener.

This change has several advantages:
1. Code cleanup
2. No dynamic memory allocation. Listeners are allocated
   by controller plugins
3. Remove API is not needed. Controller plugins can easily
   remove the listener link.

This patch also remove two APIs which are not needed:
- ivi_layout_layer_remove_notification
- ivi_layout_layer_remove_notification_by_callback

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-05 11:53:48 +03:00
Ucan, Emre (ADITG/SW1) 706cb5aa7c ivi-shell: rework surface_add_notification API
The surface_add_notification API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to surface_add_listener.

This change has several advantages:
1. Code cleanup
2. No dynamic memory allocation. Listeners are allocated
   by controller plugins
3. Remove API is not needed. Controller plugins can easily
   remove the listener link.

This patch also remove two APIs which are not needed:
- ivi_layout_surface_remove_notification
- ivi_layout_surface_remove_notification_by_callback

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-05 11:53:48 +03:00