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>
This patch adds a new command line option which can be
used to tell headless backend not to create any
virtual outputs.
This will be used for output hotplug emulation, where
weston will start with no outputs available, and the
virtual output will be created at runtime.
v2:
- Use bool instead of int for the indicator flag
- Move final newspace to a separate line in command
line options
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Write the command line to the log to aid debugging. It needs to be
copied before parsing, because parsing mutates argv.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
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]
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
Free many things we were leaking before:
- input device
- EGL resources
- xcb event source
- X Display
Fixes lots of Valgrind leaks.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Nothing was freeing the allocation from screenshooter_create().
Add enough boilerplate, that we can free it. Fixes a Valgrind leak.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
The two pixman regions of struct wlsc_surface were not being freed
properly.
Fixes some Valgrind errors.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add a function for destroying all objects allocated in
wlsc_input_device_init().
This patch depends on "server: add wl_input_device_fini()" commit in the
Wayland core.
Compositor backends could now call wlsc_input_device_fini() to fix some
memory leaks.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Free idle_source, shm, and vertices and indices arrays on compositor
shutdown.
Fixes some Valgrind errors.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
After the compositor exits the main loop in wl_display_run(), set the
compositor state to SLEEPING. This prevents scheduling repaints, that
will never be executed.
A repaint is scheduled by calling wl_event_loop_add_idle(), which
creates an idle event source. Normally the idle event source object is
destroyed after it has been executed. However, in the shutdown case we
never dispatch events again, and the object is leaked.
This leak is triggered by shell.c destructor, which destroys the
desktop-shell client. Destroying a client ends up calling
wlsc_compositor_schedule_repaint() while destroying the client
resources, especially surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
If the compositor is shutting down while the desktop_shell still exists,
we leaked some resources by not destroying the client record.
Call wl_client_destroy() on the desktop_shell client, if it exists
during shutdown. Fixes some Valgrind errors.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
wlsc_binding_destroy() was not being called at all. Fix the leaks by
introducing a function that destroys a whole list of bindings, instead
of individually saving an extra pointer to the binding object and
calling wlsc_binding_destroy() separately on each.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Some of the local pixman region objects were not being properly
destroyed before returning from the function. Destroy them, fixes
some Valgrind errors.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add a new wlsc_shell API function for destroying the shell plugin
object. Helps to reduce Valgrind reports.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This is the other direction. The selection bridge will grab the X11
CLIPBOARD selection on behalf of the Wayland client when it sets the
Wayland selection. Right now only UTF-8 text is supported, but the
data types offered will be taken from the Wayland data source.
We need to store all touchpoint positions so that if we just get an
ABS_MT_POSITION_X or Y event, we can pull the other coordinate from the
cache. And we need this across invocations of evdev_input_device_data(),
so the accumulator approach doesn't work.
Instead, we go back to the approach of storing all this state in the
evdev device struct and we might as well just move the rel and abs state
there too.
This adds ABS_MT_* support for direct touch devices and notifies
the compositor. The compositor has a stub for now.
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
fade_output() is strange in that it manufactures a wlsc_surface object
by hand, and then calls wlsc_surface_draw() on it.
Valgrind complained, that wlsc_surface_draw() accesses uninitialised
data: wlsc_surface::alpha. fade_output() forgets to set it.
Initialise surface.alpha in fade_output(). Specifically, set it to
compositor->current_alpha to deliberatly avoid the gluniform1f() call in
wlsc_surface_draw().
fade_output() binds a different GL shader program than
wlsc_surface_draw() expects. This program does not have a uniform called
"alpha", and the uniform location given in glUniform1f() is not for
this program anyway. A hint of that is the runtime error:
Mesa: User error: GL_INVALID_OPERATION in glUniform(type mismatch)
Fixing this seems to get rid of half a thousand of Valgrind errors, and
of course the Mesa user error.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Not sure why we get these, but it happens for Alt-click to move a window
(metacity binding) and messes up the idle inhibit counter.
FocusOut event as a result of ungrabbing doesn't really make sense and
fortunately we can safely ignore them.
Besides the new header file, there's also a change in the main evdev creation
procedure for a more suggestive name (evdev_input_add_devices ->
evdev_input_create). There's no real functional changes in this commit.
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
I caught this when an evdev device fd was trying to trigger the main event
loop, which was already free'd and causing an invalid read.
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Was causing an invalid read when the output is in fact destroyed. That's only
visible (segfault on my machine) on drm compositor because it's the only
backend trying to finish correct the compositor.
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>