When we're selecting our renderer, use the enum rather than two
mutually-exclusive booleans to not use the no-op renderer.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Add an 'auto' or unspecified renderer type, so we can use enum
weston_renderer_type during the configuration stage, where the target
renderer may be unspecified or unknown.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Similar to the backend type, also expose the renderer type enum as ABI.
This makes it possible to implement a more consistent config API, as
opposed to every backend hand-rolling its own use-the-other-one bool.
The enums are explicitly numbered to avoid 0, so 0 can be used as a
'not-specified' sentinel value to allow backwards compatibility with the
old config interfaces.
Signed-off-by: Daniel Stone <daniels@collabora.com>
unreachable() is used to hint to the compiler that a certain branch
cannot ever be reached. The implementation is taken from Mesa.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Instead of passing --shell=foo-shell.so, just pass --shell=foo, whilst
accepting the old form for compatibility.
Whilst we're at it, document the --shell argument in the manpage and
README.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This fixes a problem that can be seen with Firefox running under xwayland.
- Start it (or another client that remembers its size and maximized state),
- resize it
- maximize it
- exit it
- restart it
- unmaximize it
The size will be changed to a default size and not the previous unmaximized
size.
To fix this, save the unmaximized height and width like we do for the
fullscreen case.
Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
libweston contains weston_config and weston_shell_utils utilities
functions so include these in the sphinx documentation as well.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This doesn't really belong into shell-utils, so better move it out to
shared/config-parser. Renamed to weston_config_get_binding_modifier
to maintain the same namespace.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Allow C++ access from within C code and add macros to avoid
multiple inclusion of the header. Also, install the header for other
users of libweston to actually make use of it.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
These shell utils functions are potentially useful to other shells as
well, so make them widely available.
Renamed all functions to weston_shell_utils namespace.
No functional change, copied ad litteram.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
We've passed the paint node deeply enough that we can now use the cached
matrix in it to save some calculations.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Rename it as well.
By passing the paint node we'll have access to the cached buffer to output
matrix later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This fixes up fullscreen-shell as with commit 'libweston: Update view
transforms more often' we no longer trigger output repaints making the
RPD backend (mostly) unsable.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reorder the sections into what people care about: what is it, how do I
build it, how do I run it, where are the docs for when I want to do
more?
The libweston section has been substantially rewritten to trim the
details down to what is accurate and relevant, and the introduction has
accordingly been updated to reflect the reality of Weston as a project
today.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Not only are Sphinx and Breathe clearly not placeholders by this point,
but no-one really cares about the development history, just what it
means to them, i.e. how to use it.
Signed-off-by: Daniel Stone <daniels@collabora.com>
To the extent that it's accurate, it's already obvious. Packagers have
figured out how to package it anyway.
Signed-off-by: Daniel Stone <daniels@collabora.com>
No need to itemise every environment around; it's common enough these
days that people can work it out.
Signed-off-by: Daniel Stone <daniels@collabora.com>
We were storing the output description into the name field, which was
harmless but did cause a leak.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When the pointer is confined and we are handling motion, we need
up-to-date view transforms in order to respect the confinement. So
update view transforms in such case.
This fixes an issue in which we'd try to transform views with dirty
transforms in weston_pointer_clamp_event_to_region(), hitting an assert.
This is a leftover of d611ab24 "libweston: Update view transforms more
often".
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
When the output is moved, move its per-framebuffer accumulated damage
with it. The alternative would be to track accumulated damage in the
local output coordinate system, but that would require translating back
into global coordinates for repaint_output.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Use parse_simple_mode() to allow configuring the VNC framebuffer size
with a mode property in weston.ini, like this:
[output]
name=vnc
mode=1280x720
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
To make it reusable, extract parse_simple_mode() from
wet_configure_windowed_output_from_config().
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Currently linux-dmabuf.h implicitly depends on libweston.h being
included before it. Instead of adding missing includes for bool,
dev_t, struct timespec, struct weston_compositor,
struct weston_drm_format_array, struct wl_array, and struct wl_list,
just include libweston.h.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
The main surface commit includes the xdg surface commit. Here, the
accumulated surface size is validated. All subsurfaces must be comitted
first to ensure that the corrent current values are used.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Use the gl-renderer border code shared with headless-backend. We can
drop all this open-coded stuff.
In the output disable path, make sure to call this only when gl-renderer
is used. It will also reset the border state in gl-renderer, which is
harmless here, and it's necessary in the resize path.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Move this code from headless-backend to a helper library, so it can be
shared with wayland-backend.
gl-renderer.h was missing #pragma once, which made the build fail.
Unfortunately gl-borders needs gl-renderer.h which will attempt to
include EGL headers if gl-renderer is enabled in the build, so we must
get the EGL build flags too, just for the headers.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Refactor this code into two backend-agnostic functions, that in the next
step can be moved into code shared between backends.
Pure refactoring, no changes.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
GL-renderer keeps the pointer for the border image data for later use.
When we destroy our cairo_surface, that data gets freed. Therefore,
reset the pointer stored by GL-renderer too, to ensure use-after-free
cannot happen.
This is not really necessary in this particular case, because the
renderer output is destroyed immediately after, so there is no chance of
UAF.
However, this is needed for code sharing purposes. Wayland-backend will
do exactly this when an output is resized. To share this code with
wayland-backend, we also need to reset the pointers. It's harmless and
more correct in the output disable path.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Replace a bunch of copied code with a loop over a simple array. This
makes the code easier to read, and allows further refactoring.
This is pure refactoring, no changes to results or behavior.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Make sure dep_egl is always a valid dependency object, even if not
found. Ensure it is not found when not wanted, to avoid linking when
found but not wanted.
Using a not-found dependency in Meson is defined to be a safe no-op, so
use that to simplify the backend dependencies.
libweston/meson.build already errors out if renderer-gl is enabled and
EGL is not found, so the same checks can be removed from the backends.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Now that struct weston_head contains a pointer to the backend owning
the head, choose to call the same backend's create_output callback.
This will be necessary to support loading multiple backends
simultaneously.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Compositor code can use opaque pointer comparison to determine whether
a head belongs to a given backend. Store a backend pointer in struct
weston_head to enable the compositor to select the correct backend
specific output configuration code.
This also allows to use the backend pointer instead of the opaque
backend_id pointer to check whether a head belongs to a backend, so
replace the checks in all to_xyz_head() functions and drop backend_id.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
No output is created at this point. Even if an output existed,
it should be relased when the head ist destroyed.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>