This file relied on shared/xalloc.h to include <libweston/zalloc.h>.
That would be a problem if xalloc.h stopped doing that.
Just use xzalloc().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This makes it possible to close this client without using a terminal,
especially useful on a phone.
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
wl_shell is officially deprecated so remove support for it and
instead add support for xdg-shell. With it, we've further:
- moved out the buffer handling into its own a distinct structure in
case we might want to do multi-buffer rendering
- perform a redraw after we have receiving the initial configure event,
as to draw to working area where to user can use it for receving touch
events
Additionally we are setting an appid in case one might want to use it in
tandem with kiosk-shell as to be able to place it on a
distinct/different output.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
The printf() format specifier "%m" is a glibc extension to print
the string returned by strerror(errno). While supported by other
libraries (e.g. uClibc and musl), it is not widely portable.
In Weston code the format string is often passed to a logging
function that calls other syscalls before the conversion of "%m"
takes place. If one of such syscall modifies the value in errno,
the conversion of "%m" will incorrectly report the error string
corresponding to the new value of errno.
Remove all the occurrences of the specifier "%m" in Weston code
by using directly the string returned by strerror(errno).
While there, fix some minor indentation issue.
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
To help reduce code duplication and also 'kitchen-sink' includes
the ARRAY_LENGTH macro was moved to a stand-alone file and
referenced from the sources consuming it. Other macros will be
added in subsequent passes.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Using the parent '../' path component in #include statements makes
the codebase more rigid and is redundant due to proper -I use.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
If simple-touch ran on a compositor with multiple seats, and the first
one happened to have the touch capability while the second one didn't,
the handler for seat capabilities would destroy the wl_touch device it
created on the first call for the first seat when it was called a again
for the second seat that has not touch capabilities.
Fix this problem by creating a separate struct for each seat.
https://bugs.freedesktop.org/show_bug.cgi?id=78365
Now that we use AC_SYS_LARGEFILE, we need to pull in config.h at least
whereever we use mmap(). Fixes at least the test-suite and simple-shm
on 32 bit systems.
All the clients here were missing the global_remove handler. Because
window.c did not have it, weston-desktop-shell and weston-keyboard
segfaulted on compositor exit, as they received some
wl_registry.global_remove events.
Add more or less stub global_remove handlers, so that clients do not
crash on such events. Toytoolkit and all applications would need a lot
more code to properly handle the global object removal.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
The simple clients all just call wl_display_dispatch() in a while loop
without checking the return value. Now, if the server dies or other
error occurs, we get a -1 return value instead and need to break the loop.
since it doesn't use any of them. Fixes a build failure on systems,
where (E)GL headers are in non-standard path.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This change depends on the Wayland commit
"protocol: double-buffered state for wl_surface".
Implement double-buffering of damage in the compositor as required by
the new protocol.
Ensure all Weston demo clients call wl_surface_commit() after
wl_surface_damage().
Mesa does not need a fix for this, as the patch adding
wl_surface_commit() call to Mesa already takes care of damage, too;
Mesa commit: "wayland: use wl_surface_commit()"
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Use wl_surface_commit() to commit the buffer attach, as Weston now
requires.
NOTE: GL-applications are broken until you upgrade to a version of Mesa
which does wl_surface_commit() on eglSwapBuffers(). If you have
Cairo-gl, this means all toytoolkit apps, too.
simple-shm and simple-touch OTOH will work now.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Fix the off by one error in checking whether we can draw the marker
without exceeding buffer dimensions.
Fixes a segfault.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
We had duplicated code in many places, using hardcoded paths for
temporary files into more than one path. Some cases did not bother with
O_CLOEXEC, and all hardcoded paths that might not exist.
Add an OS helper function for creating a unique anonymous file with
close-on-exec semantics. The helper uses $XDG_RUNTIME_DIR as the
directory for a file.
This patch unifies the buffer file creation in both Weston and the
clients.
As simple clients are better not linking to libshared, as it would
require e.g. Cairo, they pull the OS compatibility code directly.
Android does not have mkostemp(), so a configure test is added for it,
and a fallback used if it is not available.
Changes in v2:
remove all the alternate possible directory definitions and use
XDG_RUNTIME_DIR only, and fail is it is not set.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
wl_input_device has been both renamed and split. wl_seat is now a
virtual object representing a group of logically related input devices
with related focus.
It now only generates one event: to let clients know that it has new
capabilities. It takes requests which hand back objects for the
wl_pointer, wl_keyboard and wl_touch interfaces it exposes which all
provide the old input interface, just under different names.
This commit tracks these changes in weston and the clients, as well as
similar renames (e.g. weston_input_device -> weston_seat). Some other
changes were necessary, e.g. renaming the name for the visible mouse
sprite from 'pointer' to 'cursor' so as to not conflict.
For simplicity, every seat is always exposed with all three interfaces,
although this will change as time goes on.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
To add greater precision when working with transformed surfaces and/or
high-resolution input devices.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
There was a lot of code here to do a lot of work we didn't need to do.
If we damage a surface with a shm buffer attached, all we need to do
is to re-upload the damaged region to the texture. As for drm buffers,
we don't assume anything changes on attach and only update the
regions the client tells us to update in the damage request.
This change depens on the Wayland core commit:
"protocol: remove absolute coordinates from pointer".
Remove the absolute coordinates from pointer motion and pointer_focus
events.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>