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>
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>
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>
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>
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>
... 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>
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>
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>
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>
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>
... 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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)
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Place it with the other weston_seat functions.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
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>