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>
Windows are supposed to be destroyed by the application explicitly.
Deferred tasks are not supposed to be added after returning from
display_run().
Destroy remaining wl objects (except input related will be in a
following patch).
Close the epoll fd.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Make resizor quit when you press Esc key.
Call the toytoolkit cleanup functions, properly destroy window, display
and frame callback.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add a function to destroy the 'struct display', supposedly with all
contained resources, that are not explicitly created by the application.
The implementation at this time is incomplete. It does clean up the
following:
- xkb structure is freed (needs new libxkbcommon from git)
- EGL resources are freed
- wl_display is flushed and destroyed
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add a function, that schedules the display_run() event loop to break
out.
When display_exit() is called, processing continues as usual, until
currently waiting events and deferred tasks have been processed, and
sent requests are flushed. Then, display_run() will return.
This enables toytoolkit apps to handle their exit instead of just being
killed or call exit().
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Destroy all wl objects and call EGL cleanup functions. Reduces leaks
reported by Valgrind considerably, though not to zero.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Implement proper destructors that call the wayland destroy functions.
With this and the "client: fix a strdup memory leak" patch in Wayland
core, simple-shm now runs Valgrind-clean (memcheck).
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add signal handler for SIGINT to simple-egl and simple-shm, so they can
be exited voluntarily, without killing them. Later we can add clean-up
code and destructors, and check with valgrind for leaks and errors.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.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>