This reverts commit fc6ccb868f.
We still need root permissions for drmDrop/SetMaster. Without
integration with ConsoleKit or systemd we also don't have access
to /dev/dri/cardX in the case where we open a new VT.
When we destroy a surface, we damage the surface below so that the area
exposed by the disappearing surface will be repainted. However, if that
surface also is destroyed, the damage information is lost and we fail to
repaint that area.
This commit introduces weston_surface_flush_damage(), which flushes the
surface damage the the surface below when a surface is destroyed. When
multiple surfaces are destroyed at the same time, the damage now accumulates
and sinks down through the surface stack as it should.
If we don't cancel the repaint, we end up pointlessly redrawing the output.
What's worse is that pageflipping to the new buffer eventually fails and
we miss the finish_frame callback, leaving the compositor stuck when we
re-enter the vt.
When we later upload the cursor image with glTexImage2D(), that will unbind
the image just fine. No need for a NULL upload. Except that that doesn't
currently happen with mesa drivers, but the NULL upload is redundant either
way.
Weston initialises to faded-out state, which means all outputs are just
black, even if they render fine.
Previously the fade-in was triggered probably by some random input
event, since Weston was not guaranteed to wake up. Especially with the
drm backend, and the usual problem of not having permissions to input
devices, Weston would not fade in at all and appear broken.
Force Weston to fade in right after initialisation. This show that at
least rendering works, if it does not respond to any input.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
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.
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>
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 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>
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>
Move idle_time variable to struct wlsc_compositor, so that a shell
plugin can change it. Also store the original value from the command
line.
Add "duration" option to the desktop-shell screensaver config. This is
the time the screensaver will be visible, after idle timeout triggers
another time and blanks the screen.
Now you can have different delays to lock the screen, and switch off the
screen while a screensaver is running.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add WLSC_COMPOSITOR_IDLE state to the possible compositor internal
states, and fix the drm backend to restore the previous state instead of
forcing ACTIVE.
Normally, the compositor only uses the ACTIVE and SLEEPING states. The
IDLE state is another active state, reserved for the shell, when the
shell wants to have unlock() calls on activity, but the compositor cannot
be SLEEPING.
Use the IDLE state to fix exposing the unlock dialog while a screensaver
is animating. Without this fix, is it impossible to activate the unlock
dialog without waiting for a second idle timeout that really puts the
compositor into SLEEPING.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Reorder code in fade_frame() to that if shell->lock() calls
wlsc_compositor_wake(), the fade animation will run again.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
One less syscall and error path to check, and feels like a cleaner approach.
The commit adds two lines, but that's because we actually handle the
potential error now.
The signal mask is inherited over fork() and exec(), we need to
explicitly reset it.
This allows the children to receive the signals the compositor itself
has blocked, for example SIGINT and SIGTERM.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
shell.c and tablet-shell.c had almost the same code for forking their
special shell client. Generalise this code and put it into
wlsc_client_launch() in compositor.c.
Improve error cleanup and reporting in wlsc_client_launch().
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>