Commit graph

5578 commits

Author SHA1 Message Date
Jonas Ådahl 94e2e2d39f compositor: Keep track of what views were activated by clicking
Adds a weston_view_activate() that can be passed an additional active
flag WESTON_ACTIVATE_CLICKED, that the shell passes when a view was
activated by clicking.

This allows shell-independent components implement heuristics depending
on how a view was activated.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-26 17:21:15 +08:00
Jonas Ådahl 4361b4ea3f desktop-shell: Pass a flag bitmask instead of bool to activate()
Although it currently only has one available flag, but that'll change.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-26 17:21:15 +08:00
Jonas Ådahl 1fa6dedb82 desktop-shell: Make activate() take a view instead of surface
In preparation for further refactorings.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-26 17:21:15 +08:00
Jonas Ådahl 90c90b205f desktop-shell: Change switcher to track views
Preparation for future refactorings.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-26 17:21:15 +08:00
Jonas Ådahl 7bfb113dbe desktop-shell: Track the black surface by its view
In preparation for further refactoring.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-07-26 17:21:15 +08:00
Jonas Ådahl ef8e1c31e3 input: Activate view no matter the keyboard focus
Activate a view even though it effectively may already be active.
Without this, in later patches, it won't be possibe to track what view
was activated by clicking last, as a view which surface already had
keyboard focus, won't be activated.

To keep avoiding sending xdg_surface.configure events, only change the
keyboard focus if the focus actually changed.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-07-26 17:21:15 +08:00
Emil Velikov a884024eea automake: add missing git-version.h dependency
compositor/main.c depends on the header, while the dependency isn't
specified. Thus depending on the order of how things are build we could
get a build failure.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-07-22 16:16:19 +01:00
Emil Velikov 4ad45caa75 automake: list the the builddir include before the srcdir
Otherwise we'll pick up the stale (in-tree) generated source(s) over the
fresh (out-of-tree) ones.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-07-22 16:16:16 +01:00
Emil Velikov 07448943e5 shared/platform.h: remove the local EGL platform (re)definitions
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:29:19 +01:00
Emil Velikov 3fd0802cbd gl-renderer: remove local EGL platform (re)definitions
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:29:19 +01:00
Emil Velikov 706e689f47 weston-egl-ext.h: add EGL platform definitions
Will allow us to consolidate the multiple definitions through the tree.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:29:18 +01:00
Emil Velikov 025ad93833 clients/simple-egl: use weston_check_egl_extension over strstr
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:29:17 +01:00
Emil Velikov ce5b614c80 clients/nested: use weston_check_egl_extension over strstr
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:29:04 +01:00
Emil Velikov d0fcdc955e shared/platform.h: use weston_check_egl_extension over strstr
The later can give false positives.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:28:45 +01:00
Emil Velikov f0c3a1c112 gl-renderer: move check_extension() to shared/
... prefixing it with a "weston_". This way we can reuse it across the
board, instead of the current strstr. The latter of which can give us
false positives, thus it will be resolved with next commit(s).

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:28:32 +01:00
Emil Velikov cbcf545fd9 libweston: don't install shared/platform.h
The header contains a set of extension check (helpers), which do not
provide any compositor related functionality and are not required for
using libweston.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:24:05 +01:00
Emil Velikov 10772dba04 shared/platform.h: add missing stdbool.h include
Required by the bool type, used through the header.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:23:27 +01:00
Emil Velikov bd6c41319d simple-egl: remove incomplete EGL_EXT_buffer_age definition
A more complete alternative is already provided by the weston-egl-ext.h
header. The latter of which we already include.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:23:22 +01:00
Emil Velikov 3dd22d9511 gl-renderer: remove EGL_EXT_image_dma_buf_import guards
We provide a (workaround) definition in weston-egl-ext.h, thus we don't
need any guards.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:23:19 +01:00
Emil Velikov b56c5b48ce weston-egl-ext.h: add GL_EXT_unpack_subimage definitions
... and use it in gl-renderer.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:23:14 +01:00
Emil Velikov af5bd5da63 weston-egl-ext.h: add EGL_MESA_configless_context definitions
... and use it in gl-renderer.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:23:12 +01:00
Emil Velikov 0725cf17f9 weston-egl-ext.h: add EGL_EXT_swap_buffers_with_damage definitions
... and use it from simple-egl and gl-renderer.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:23:10 +01:00
Emil Velikov 885a9fe4d9 client/nested: reuse weston-egl-ext.h declarations
Rather than introducing a local copy of the
EGL_WL_create_wayland_buffer_from_image (re)definition, just use the
local header.

This also gives us access to EGL_WL_bind_wayland_display which is also
used in the client, yet the C file is missing a fall-back definition.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:21:46 +01: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 a8d987d93c systemd: Also force base-10 for the strtol() call
This call is used to parse a time value expressed in usec's, which is
always decimal.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-07-12 19:03:01 -07:00
Bryce Harrington 375759e636 Require base-10 for strtol() calls
The third arg to strtol() specifies the base to assume for the number.
When 0 is passed, as is currently done in option-parser.c, hexadecimal
and octal numbers are permitted and automatically detected and
converted.

This change is an expansion of f6051cbab8
to cover the remaining strtol() calls in Weston, where the routine is
being used to read fds and pids - which are always expressed in base-10.
It also changes the calls in config-parser, used by
weston_config_section_get_int(), which in turn is being used to read
scales, sizes, times, rates, and delays; these are all expressed in
base-10 numbers only.

The benefit of limiting this to base-10 is to eliminate surprises when
parsing numbers from the command line.  Also, by making the code
consistent with other usages of strtol, it may make it possible to
factor out the common code in the future.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-12 18:46:13 -07:00
Bryce Harrington 1dbdc0bd8a Include space in 'if ('
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-12 18:45:41 -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 5ba41ebd65 rdp: Check for non-digits and errno in strtol call
Improve error checking for situations like RDP_FD=42foo, or where the
provided number is out of range.

Suggestion by Yong Bakos.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-07-12 14:24:50 -07:00
Emmanuel Gil Peyrot 7fc000c826 Remove a wrong closing “extern "C"” in shared/xalloc.c
Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-07-11 13:22:37 -07:00
Bryce Harrington bac72b29f8 rdp: Check for non-numeric value in RDP_FD env var
strtoul(nptr, endptr, ...) will set *endptr to nptr in the case of where
no digits were read from the string, and return 0.  Running with
RDP_FD=foo would thus result in fd=0 being specified to
freerdp_peer_new(), which is unlikely to be the user's intent.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-07-08 18:54:28 -07:00
Bryce Harrington 9c09fe70c7 multi-resource: Check for no digits in time description
strtoul(nptr, endptr, ...) will set *endptr to nptr in the case of where
no digits were read from the string.  E.g. "foo:bar" should trigger an
error, instead of being read as "0:0" and allowed through.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-07-08 18:05:56 -07:00
Bryce Harrington f6051cbab8 option-parser: Require integer option string values to be base-10
The third arg to strtol() specifies the base to assume for the number.
When 0 is passed, as is currently done in option-parser.c, hexadecimal
and octal numbers are permitted and automatically detected and
converted.

In weston and the weston clients and tests using option-parser.c, the
options are all things that can be expected to be specified in base 10:
widths, heights, counts, scales, font sizes, ports, ttys, connectors,
etc.  The subsurfaces client uses two modes, limited to values 0 and 1
only.  The zuc testsuite has a --random parameter for specifying a seed,
which is the only option where using hexadecimal or octal numbers might
conceivably happen.

The benefit of limiting this to base-10 is to eliminate surprises when
parsing numbers from the command line.  Also, by making the code
consistent with other usages of strtol/strtoul, it may make it possible
to factor out the common code in the future.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-07-08 17:44:10 -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
Bryce Harrington e4cb3c2ce2 README: Fix grammar for 'an X*' 2016-07-07 10:53:17 -07:00
Bryce Harrington ba63fae1e6 dmabuf: Fix grammar in a comment
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-07 10:50:23 -07:00
Bryce Harrington 1e6c0fbad1 xwayland: Grammar fixes
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-07 10:50:20 -07:00
Bryce Harrington cff0b1d80f xwayland: Cleanup error message on spawn failure Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-07 10:48:34 -07:00
Bryce Harrington 9335ca5c02 xwayland: Include missing config.h
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-07 10:48:19 -07:00
Bryce Harrington 585eef3437 README: Fix punctuation errors
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-07-06 14:50:38 -07:00
Emil Velikov 2d01e9138e README: minor the libweston ABI/API documentation
v2: Elaborate what is meant with "major ABI versions" (Pekka).

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> (v1)
2016-07-05 18:00:31 +03:00
Emil Velikov 99ac6232fa README: clarify libweston purpose/goals.
v2: Rewrap, add a couple of missing words (Pekka).
v3: Use alternative wording (Yong).

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-07-05 18:00:17 +03:00
Armin Krezović ad27693127 compositor-x11: Flush xcb connection from x11_output_destroy()
Current code flushes the connection when it receives
a delete window request. This means that a destroyed
window will remain available when X11 output gets
removed differently (ie, from a testing module).

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-07-04 13:11:29 +03:00
Armin Krezović 0da12b8b8d compositor: Switch to new surface/view mapped checks
This patch makes use of new flags which were introduced
by previous patches to check if a surface/view is mapped

v2:

- Rebased to apply on git master
- Added comments with link to discussion about proposed
  changes for weston_{surface,view}_is_mapped()

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
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
Armin Krezović 50ff4bf308 ivi-shell: update for manual surface/view mapping
This is a follow up for ivi-shell to manually
set mapped status for views/surfaces it controls

v2:

- Updated for changes in git master

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
Armin Krezović b1a48e665b fullscreen-shell: update for manual surface/view mapping
This is a follow up for fullscreen-shell to manually
set mapped status for views/surfaces it controls

v2:

- Add manual mapping to fs_output_apply_pending()

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
Armin Krezović 4663aca2e2 desktop-shell: update for manual surface/view mapping
This is a follow up for desktop-shell to manually
set mapped status for views/surfaces it controls

v2:

- Add manual mapping to shell_fade_create_surface()
  and shell_ensure_fullscreen_black_view()

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
Armin Krezović f8486c33b4 compositor: Untangle surface/view is_mapped from output assignments
Currently, weston assumes a surface/view is mapped if
it has an output assigned. In a zero outputs scenario,
this isn't really desirable.

This patch introduces a new flag to weston_surface and
weston_view, which has to be set manually to indicate
that a surface/view is mapped.

v2:

- Remove usage of new flags from
  weston_{view,surface}_is_mapped at this point. They
  will be added after all the implicit mappings have
  been introduced
- Unmap a surface before unmapping a view so the input
  foci is cleaned up properly
- Remove implicit view mapping from view_list_add
- Cosmetic fixes

v3:

- Rebased to apply on git master

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-07-01 15:23:50 +03:00
Giulio Camuffo 9c764df043 xwayland: make the plugin usable by libweston compositors
This patch follows a similar approach taken to detach the backends from
weston. But instead of passing a configuration struct when loading the
plugin, we use the plugin API registry to register an API, and to get it
in the compositor side.  This API allows to spawn the Xwayland process
in the compositor side, and to deal with signal handling.  A new
function is added in compositor.c to load and init the xwayland.so
plugin.

Also make sure to re-arm the SIGUSR1 when the X server quits.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
[Pekka: moved xwayland/weston-xwayland.c -> compositor/xwayland.c]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-07-01 14:34:33 +03:00