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>
The Cairo documentation tells us to always call cairo_device_flush()
before using other rendering APIs on the cairo surface, especially where
the Cairo device shares state with us (that is, EGL and GL state in this
case).
Add a call to cairo_device_flush() into display_acquire_window_surface(),
which the toytoolkit offers for switching to native (GL) rendering.
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>
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>
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>
Currently, the way to destroy a window in a response to an event (e.g.
button click), is to put a task into the deferred list with
display_defer(). The task will then call window_destroy() from outside
event handling code.
As events are handled, it is possible that the deferred list contains
also the redraw task for this window. As the execution order of these
tasks is unknown (redrawing a freed window is a bug) and redrawing
something that goes away immediately is not useful, the redraw task must
be removed on window_destroy().
'struct input' contains pointers to windows currently in focus for that
input device. These pointers must also be cleared on window_destroy().
This fixes a use-after-free bug for the unlock dialog in desktop-shell
(future commit).
As an irrelevant minor cleanup, window::grab_device member is not used
anywhere, and is removed.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
I may have missed something, but - since the Wayland compositor
already picks a platform backend, opens a connection and initializes the
backend specific display data structure it doesn't make sense
to let egl pick a platform. If it picks a different one the
display specific data structure will most likely not match.
Thus determine the platform in the Wayland rendering backend by setting
the EGL_PLATFORM env variable.
For the client any other platform than 'wayland' doesn't seem to make
sense.
I'm not sure if I've got the the platform ofr openfwd right.
Signed-off-by: Egbert Eich <eich@freedesktop.org>