Errors happening to devices being added or removed shouldn't fail
silently so exit if any of that happens.
Sprinkle some debug logs for other cases as well.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
And ultimately, fail to start when there are no input devices on the
system. Patchs adds consistency to touch/pointer initialization to
return -1 in case same thing happens.
Further more, when the device is not created we can't assume to retrieve
a valid one from a libinput_device so guard against it. This takes care of
hot-plugging situations when we couldn't create the (keyboard) device,
or when removing it.
Fixes: #117, #402, #485
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
Fix an issue where the keyboard leds will go out of sync when a new
keyboard is connected.
The issue can be easily reproduced by connecting two keyboards, enabling
caps lock, and reconnecting one of the keyboards. Without the patch the
leds on both keyboards will turn off while the actual caps lock state
will stay enabled.
Signed-off-by: Samu Nuutamo <samu.nuutamo@gmail.com>
We have dedicated header for the internal parts of the logging
framework, use that for the set-up part instead of the libweston public
API header.
Further more this removes weston_vlog() from public header as well and
moves them to weston-log-internal.h file.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
The main idea is to make libweston users use the form
#include <libweston/libweston.h>
instead of the plain
#include <compositor.h>
which is prone to name conflicts. This is reflected both in the installed
files, and the internal header search paths so that Weston would use the exact
same form as an external project using libweston would.
The public headers are moved under a new top-level directory include/ to make
them clearly stand out as special (public API).
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The use case driving this change is a clone mode setup, where the user
is hotplugging or unplugging a cloned touchscreen. Even if the output
and head are force-enabled, the touch device should still follow the
connector connection status. If there is no video signal for the
touchscreen (disconnected connector), then the touch input should be
ignored as well.
When the output is force-enabled, we need to trigger
output_heads_changed from connector status changes. If the head or
output are not force-enabled, the compositor will likely attach and
detach the head as appropriate. In clone mode, the attach or detach
needs to trigger output_heads_changed directly. In other cases, it may
be handled through the output getting enabled or disabled which are
different signals.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Associating input devices with weston_outputs by the output name fails
when one output has several heads. We need to match against head names
instead of output names to be able to find all names.
This fixes touchscreen output association in shared-CRTC clone mode when
outputs or input devices appear or disappear.
Even though notify_output_create() is called only when new outputs
appear, the implementation is prepared to also remove output
associations. This will be handy in the future when this function will
handle also head detaching from an output that remains enabled.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This is easily noticed as a leaked fd on every VC switch.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
As it has been discussed in the past [1], running Weston
without any input device at launch might be beneficial for
some use cases.
Certainly, it's best for the vast majority of users (and
the project) to require an input device to be present, as
to avoid frustration and hassle, but for those brave souls
that so prefer, this patch lets them run without any input
device at all.
This introduces a simple configuration in weston.ini:
[core]
require-input=true
True is the default, so no behavioral change is introduced.
[1] https://lists.freedesktop.org/archives/wayland-devel/2015-November/025193.html
Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This clarifies what is supposed to be the libweston code.
v2: screen-share.c is already in compositor/ instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Acked-by: Benoit Gschwind <gschwind@gnu-log.net>
[Pekka: rebased]
Instead add callbacks to the drm and fbdev backends and pass that to
the input backens so that when a new device needs to be configured
that is called and the compositor can configure it.
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
default_seat and default_seat_name are not used anywhere in this file.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
We're going to need this on device removal in the future, so pull it out
into a separate function now.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
If we destroy all the devices before trying to remove keyboard focus
we'll segfault because we destroyed the keyboard.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Keyboards and pointers aren't freed when devices are removed, so we should
really be testing keyboard_device_count and pointer_device_count in most
cases, not the actual pointers. Otherwise we end up with different
behaviour after removing a device than we had before it was inserted.
This commit renames the touch/keyboard/pointer pointers and adds helper
functions to get them that hide this complexity and return NULL when
*_device_count is 0.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Break device_removed() out into its own function like device_added().
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Removed duplicate definitions of the container_of() macro and
refactored sources to use the single implementation.
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 an output is unnamed and devices are in seats, the strcmp will crash.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Set the default logging level from libinput to INFO. This matches better
the behaviour of the old input backend, and prints the found input
devices into Weston's log.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
No functional changes, just adjusting for API changes in libinput:
- libinput_destroy() replaced by libinput_unref()
- log functions now take a libinput context, userdata is gone
- udev seat creation is now libinput_udev_create_context() and
libinput_udev_assign_seat()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Only accept specific literal values from the environment variable
WESTON_LIBINPUT_LOG_PRIORITY... "debug", "info", or "error".
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Make sure that we don't map a device to an invalid output pointer and
intead remap devices when an output is created.
v2: fix the error with libinput too.
Commit 17bccaed intended to make the events coming from a touchscreen
paired with an unplugged output to be discarded, while an unpaired one
would just choose a different output. However, the logic was inverted
causing the opposite to happen.
Later in commit 161c6c56, the default behavior was changed to map an
output to a default output if the one specified via udev is not
present. This change is reverted by this patch.
v2: undo the change from commit 161c6c56.
v3: deal with libinput too.
Most zalloc calls in weston are checked, this fixes a handful that were
being ignored. As found by `grep -EIsr "[^x]zalloc\(" . -A1`
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
If more than one input device maps to the new output, then we need
to map all devices to that output... not just the first device.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77576
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
If an input device wants to map to an output that does not
exist, then just map it to the first output.
Also, if a device is mapped to an output that gets unplugged then
it gets default mapped to the first output in the output destroy
listener. However, the original output destroy listener needs to
be removed before adding the new listener for the first output,
otherwise the list gets corrupted.
Later if the other output is plugged back in, we remap the device
to it. In that case, we should remove the destroy listener for
the first output.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77341
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Look for WESTON_LIBINPUT_LOG_PRIORITY environment variable. If
it exists then use it to set the libinput log priority.
Otherwise, don't set the priority and get whatever libinput's
default priority is.
Setting WESTON_LIBINPUT_LOG_PRIORITY=0 allows us to log which
input devices are detected at Weston startup and makes it a
little more consistent with Weston's original evdev input setup
log messages... and useful for debugging and testing.
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
While disable by default, passing --enable-libinput-backend to
./configure switches the input backend in weston's drm, fbdev and rpi
compositing backends to use libinput instead of udev-seat.c, evdev.c and
friends.
When enabled, weston now also depends on libinput >= 0.1.0.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>