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>
Screensavers become visible the first time only after the compositor has
gone to sleep state. Therefore, to see screensaver in the start, wake up
the compositor. After a second idle timeout, the compositor will stay
sleeping.
We could also not apply this patch. It would mean the screensavers would
be visible only with the unlock dialog, and not become visible
automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Implement the basics of screensaver surface management. Exec'ing and
killing the screensaver client is punted for later.
When a surface registered as a screensaver is mapped, it stays hidden
if the screen is not locked, or it is added to the compositor visible
surfaces list if the screen is locked.
The map() is restructured to set initial position first, and stacking
next. This allows SHELL_SURFACE_SCREENSAVER share positioning with
SHELL_SURFACE_FULLSCREEN, while show_screensaver() does its own
wlsc_surface_configure() call.
Also fix centering to the given fullscreen output, not the first output.
Another bug fix: previously configure() would call
wlsc_surface_configure() unconditionally, which assigns an output to
the surface. While the compositor is locked, if an application resizes
its window, we hit configure() and assign an output while the surface is
not in compositor->surface_list. This leads to invalid memory access on
the next call to wlsc_surface_damage_below(). Fix this by not calling
wlsc_surface_configure() for surfaces that are not visible.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
So far nothing prevented a client for registering a surface as one type
and then as another type. With some special types, this would lead to
corrupted wl_lists.
Add a function, that either resets the surface type or posts an error to
the client. In case of an error, the set type operation must be aborted.
Change the type name SHELL_SURFACE_NORMAL to SHELL_SURFACE_NONE, as
there is nothing normal in the "none" type which just means uninitialised.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Create instances from outputs, and register the surfaces as
screensavers. Support multiple "Mode" instances.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add output_configure_handler as a display property. This exposes only
configured outputs, that is the current mode info is already received,
to applications.
The handler is also called for mode changes on an existing output. This
simplifies the implementation in toytoolkit as we can defer the handler
calls from wl_output binding time to when we receive the current mode.
We do not need separate handlers for "new output" and "mode changed". A
plain "new output" handler would be problematic as the current mode is
not known yet.
Also add delete_handler hook for outputs, but that will never be called
for now, as the protocol lacks a way to signal output disconnections.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.
When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.
The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
when a motion is being performed on ts device, only one axis can be sent
through the evdev bytestream whereas the other could be omitted. For instance:
-------------- SYN_REPORT ------------
type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 22208
type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 631
type 3 (EV_ABS), code 0 (ABS_X), value 22208
-------------- SYN_REPORT ------------
on such case we'd have to send the compositor the old value of Y. Commit
f547bd36 introduced this bug cause it was sending zeroed coordinate and not
the old one.
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
We do not handle errors of gbm-buffer-creation and drm-mode-setting in
create_output_for_connectors. Correctly catch these now and free memory on error
to avoid memory leaks.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We currently simply return -1 on error in create_output_for_connector. This
correctly frees the output and all modes when we fail to avoid memory leaks.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We need to correctly free every connector we retrieve. We currently loose them
if they are not connected.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
In the wl_shell_surface migration, I forgot to correct one cast in
shell_surface_set_transient(). 'parent_resource' is not a (struct
wlsc_surface *) but (struct shell_surface *).
This bug corrupts a wlsc_surface::output field, which later (in my
experiments) leads to a segmentation fault in surface_frame().
Fix the casts.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Eventually we will want more functionality in the shared library and we
will rename it at that point. Perhaps we'll name it libnih, but for now
let's stick with libconfig-parser.
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>
Add an option to the desktop-shell ini file that defines whether screen
locking is used or not.
Useful for testing screensaver interactions without a lock surface.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Rename CONFIG_KEY_BOOL to CONFIG_KEY_BOOLEAN, just like
CONFIG_KEY_INTEGER is not CONFIG_KEY_INT, for consistency.
Document the types expected for the void* and name the enum in the
header, so it is clear what config_key::type means.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Create a new directory for convenience librariers that can be shared
between compositor components and clients.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
As of commit "client: unset WAYLAND_SOCKET env variable",
58bb064afa3bfc706e3b30dd170804235aa272ea, in the Wayland core, the
Wayland library will unset the environment variable automatically.
No need to explicitly unset it again here.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
(!x < 0) is always false and doesn't make sense here. Looks like a typo so
remove the negation.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Do not allow multiple wl_shell_surface objects to be created for a
wl_surface object.
Multiple shell_surface objects would confuse the compositor as they
contain separate instances of the shell-private data.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Leftovers from an intermediate patch set, the proper function name is
shell_get_shell_surface. Cosmetic change.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Since it is the desktop-shell plugin in the compositor that offers both
wl_shell global interface and wl_shell_surface interface, those are not
available on the tablet-shell plugin.
The tablet-shell client uses the toytoolkit, so toytoolkit must work
somehow even without wl_shell.
Turn all operations in toytoolkit that would require wl_shell or
wl_shell_surface into no-ops.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
get_shell_surface() returns NULL, if the client has not created or has
destroyed the wl_shell_surface object.
All but one use of get_shell_surface() just retrieve the surface type,
so just fall back to SHELL_SURFACE_NORMAL there.
Resize hot-key binding really needs the wl_shell_surface object, as that
is the only way to send configure events. For surfaces without a
wl_shell_surface, simply do not resize them.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Remove shell_priv member from wlsc_surface, and replace it by a search
through the wl_surface destroy_listener_list.
This technique avoids any "extension" members in the wlsc_surface
structure.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Change desktop-shell protocol to use wl_shell_surface instead of
wl_surface.
Adapt the desktop-shell client and the shell plugin.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Protocol changes in Wayland core introduced a new interface
wl_shell_surface, and moved all wl_shell surface methods into it. Adapt
the compositor and its Wayland backend, shell plugin, and all clients to
the new interface.
Depends on the Wayland core commit "protocol: introduce wl_shell_surface"
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
When a window destroyed, if any input had the window in keyboard
focus, the keyboard focus is reset to NULL. A new keyboard focus is set
only, if the user clicks something. If the user presses a key instead of
clicking, the key press event is sent to the client which has NULL
keyboard focus, triggering a segfault in window_handle_key().
Fix the segfault by ignoring the key event, if there is no target
window.
I triggered this segfault by clicking the unlock dialog away, and then
pressing a key.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Fix two bugs:
- if there are no backgrounds at all, the background pointer would have
been bogus. Lead to a segfault.
- if the hidden_surface_list is empty, wl_list_insert_list() would
corrupt the list. Lead to a hang in pick_surface().
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>