Commit graph

2388 commits

Author SHA1 Message Date
Armin K
b0044ab4e2 evdev-touchpad: Set some options using weston.ini
This patch adds 3 new options to weston.ini to allow
the user to change default constant_accel_factor,
min_accel_factor and max_accel_factor. If no options
are set, it falls back using defaults as it did before.

v2: create weston_config_section_get_double and use it
instead of manualy converting string to double.

v3: add default values in weston_config_get_double
instead of using conditionals.

v4: don't pass diagonal as pointer.
2013-11-10 17:51:33 +01:00
Rolf Morel
5a49ec0e83 evdev: write EV_SYN input_event along with led events to device
Other clients of an evdev device need to have the events they receive
be separated, in moment in time, from other events by an EV_SYN/
SYN_REPORT. This is the responsibility of the client who writes events
into the stream.
2013-11-10 17:51:33 +01:00
Rusty Lynch
3a65d85ad0 evdev: Use touch ID 0 when generating touch up event
device->mt.slot is uninitialized when we're not receiving the
evdev slot events.  Always use ID 0 as we do when we generate the
touch down and motion events.
2013-11-10 17:51:33 +01:00
Peter Hutterer
f22edd89cb evdev: log when a device is used as touchpad 2013-11-10 17:51:33 +01:00
Peter Hutterer
786bf52f8f evdev: call evdev_device_destroy on failure
Avoid keeping keeping what needs to be freed in sync in multiple places,
make evdev_device_destroy do the right thing instead.
2013-11-10 17:51:32 +01:00
Peter Hutterer
b23c3273bc evdev: plug a potential memleak
For touchpads, device->dispatch is set up when exiting
evdev_handle_device() and a potential source for a memleak.
This can't actually happen at the moment, as evdev_handle_device() won't
fail for touchpads after setting up the dispatch but prevent this from
happening in the future.
2013-11-10 17:51:32 +01:00
Peter Hutterer
3fe16ee03b evdev: get the current slot value from the absinfo struct or mtdev
If touches are already present on the device, absinfo has the currently
active touch slot. There's a race condition where the slot may change before
we enable the fd and we thus miss out on the ABS_MT_SLOT event. It's still
slightly more correct than assuming whatever comes next is slot 0.
2013-11-10 17:51:32 +01:00
Peter Hutterer
fe57a4e5fa evdev: only use mtdev for Protocol A devices
For Protocol B devices, mtdev merely routes the events and is not needed.
For Protocol A devices, mtdev is needed, so fail for those devices now if we
mtdev fails.
2013-11-10 17:51:32 +01:00
Peter Hutterer
3f0ee131e1 evdev: add comment why we're ignoring key value 2 2013-11-10 17:51:32 +01:00
Peter Hutterer
756785ec3e evdev: prevent unterminated device name
The kernel copies up to sizeof(devname) bytes but doesn't null-terminate the
string if the device name exceeds the size of the supplied buffer.
2013-11-10 17:51:32 +01:00
Peter Hutterer
297bac9802 evdev: check for ABS_MT_POSITION_X/Y to determine mt devices
mtdev as currently used in weston is a noop. mtdev's purpose is to convert
Protocol A devices (without ABS_MT_SLOT) to Protocol B devices (slots).
For Protocol B devices mtdev merely routes the events, so checking for
slots and then using mtdev based on that adds no functionality.

Check for ABS_MT_POSITION_X/Y instead and use that to categorise a device
as MT device. mtdev will provide us with a slotted protocol for all devices.

https://bugs.freedesktop.org/show_bug.cgi?id=54428
2013-11-10 17:51:32 +01:00
Peter Hutterer
420fbad8bb malloc + memset -> zalloc
And for clients using the xmalloc helper, use xzalloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-11-10 17:51:32 +01:00
Kristian Høgsberg
c1bb30da2f evdev: Suport old-style single-touch touch screens
These screens send only BTN_TOUCH and ABS_X/Y.
2013-11-10 17:51:32 +01:00
Kristian Høgsberg
7ff70db86d evdev: Use temporary x and y coordinates when applying calibration
Don't overwrite device->abs.x halfway through the matrix multiplication.
2013-11-10 17:51:32 +01:00
Kristian Høgsberg
95e1abf104 evdev: Don't add output offset in evdev_process_absolute_motion()
We do that in weston_output_transform_coordinate() now.
2013-11-10 17:51:32 +01:00
Kristian Høgsberg
23e4ec3e23 evdev: Use weston_output_transform_coordinate for evdev touch screens 2013-11-10 17:51:32 +01:00
Kristian Høgsberg
57334b7088 touchpad: Handle two-finger click as right click for button pads 2013-11-10 17:51:32 +01:00
Daniel Stone
17ea8f9e50 configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system.  This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.

Since this goes into config.h rather than the command line, ensure all
source is consistently including config.h before anything else,
including system libraries.  This doesn't need to be guarded by a
HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
modular transition.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>

[pq: rebased and converted more files]
2013-11-10 17:51:32 +01:00
Kristian Høgsberg
6e5928ab41 input: Merge wl_seat into weston_seat 2013-11-10 17:51:32 +01:00
Jonas Ådahl
049a7492dc evdev-touchpad: Disable tap FSM by default on touchpads with button pads
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-10 17:51:32 +01:00
Rob Bradford
23b92d9dc6 compositor: Support notifying with absolute position too
With evdev input devices that generate absolute positions we need to provide
an infrastructure in the compositor for supporting those.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=61997
2013-11-10 17:51:31 +01:00
Kristian Høgsberg
9d92a07996 compositor: Change notify_motion to take relative motion events 2013-11-10 17:51:31 +01:00
Satyeshwar Singh
b3e195bd27 evdev: Wait for SYN event before sending events over to the client
The issue was that touch::down event from the compositor to client apps
would send the previous motion events coordinates and this obviously made
the client do the wrong thing. This happened because we were not waiting
for a SYN event to come from evdev before sending down, motion or up events.

https://bugs.freedesktop.org/show_bug.cgi?id=51909
2013-11-10 17:51:31 +01:00
Kristian Høgsberg
a74a372753 xkb: Don't call exit on failure in weston_compositor_xkb_init()
This will exit without cleaning vt modes and leave the system stuck.

https://bugs.freedesktop.org/show_bug.cgi?id=60817
2013-11-10 17:51:31 +01:00
Rob Bradford
60bc3610f3 evdev: Apply calibration values to absolute events
Store a set of calibration values per device - these calibration values are
just applied to the absolute motion events.
2013-11-10 17:51:31 +01:00
Rob Bradford
24eabf8bb1 evdev: Include the device capabilities in the debugging 2013-11-10 17:51:31 +01:00
Dima Ryazanov
4135ccf315 Fix a typo. 2013-11-10 17:51:31 +01:00
Jonas Ådahl
62f9786646 evdev: Update axis notifications to follow protocol
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-10 17:51:31 +01:00
Jonas Ådahl
64545a2977 evdev-touchpad: Implement two finger scroll
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-10 17:51:31 +01:00
Jonas Ådahl
68449fc8e8 evdev-touchpad: Add a finite-state machine
The finite-state machine is so far used to implement support for tapping
and dragging.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-10 17:51:31 +01:00
Jonas Ådahl
f4706c6779 evdev-touchpad: Cleanup and refactoring
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-10 17:51:31 +01:00
Rob Bradford
28833e880f evdev-touchpad: Iterate over the touchpad spec table correctly
The original code would overrun since the calculation of the range did not
take into consideration the size of the entries in the table.

Cc:Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-11-10 17:51:31 +01:00
Rob Bradford
7e10eff8f3 evdev: Avoid unintended case drop through
e->code is in the same range for ABS_ and for REL_. As the code currently
stands and for the current values in Linux's input.h there is no risk of a
problem. However just in case it would be wise to break after evaluating the
relative events.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-11-10 17:51:31 +01:00
Rob Bradford
56b178cc00 evdev-touchpad: Twiddle finger_state correctly
The original code always set the finger_state to the appropriate bitmask
irrespective of whether the event was a press or a release. It would also blat
all members of the bitmask rather than ORing in the new bit for the event.

Cc:Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-11-10 17:51:31 +01:00
Kristian Høgsberg
c69e1fbe27 compositor: Change notify_* function to take a weston_seat
Fewer indirections and derefs, and it's also more appropriate for a
backend calling into weston core to pass a weston_seat.
2013-11-10 17:51:31 +01:00
Pekka Paalanen
1bf81b0c5b evdev: rename evdev_input_device to evdev_device
As said by krh: "Maybe we should also just call it an evdev_device
instead, shorter [and] not really ambiguous."

[krh: if my typo filled irc is going in a commit message, I'm at least going
to insert the missing words.]

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
4a75370823 evdev: do not pass a list to evdev_led_update()
evdev_led_update() does not really need the whole list of device at
once, it can be called one device at a time.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
7ef5852dff evdev: kill a warning in evdev_led_update()
evdev.c: In function 'evdev_led_update':
evdev.c:57:9: warning: ignoring return value of 'write', declared with
attribute warn_unused_result

Useless in this case.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
e427ef8cb7 compositor-drm, evdev: don't crash on missing keyboard
Weston's notify_keyboard_focus_*() assume that a keyboard is present, if
they are called. With evdev, there might not always be a keyboard.

Also clean up the variable definition in evdev_notify_keyborad_focus().
I read that function through many times and finally had to grep where
does 'all_keys' come from.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
b2d021b95e evdev: log input devices
Write information about found input devices into the log. Also fetch and
record the device name.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
50052b1d3c evdev: move udev code into compositor-drm.c
Move all udev-related and now drm backend specific code into
compositor-drm.c.

This makes evdev.c free of udev and launcher-util, and allows it to be
used on Android.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
921c8f4f33 evdev: expose the generic evdev API
This API does not depend on udev or launcher-util.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
d950781445 evdev: rename evdev_seat to drm_seat
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
8e02ad4efe evdev: pass weston_seat to evdev_input_device_create()
in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
1f6acefd70 evdev: make evdev_notify_keyboard_focus() independent of evdev_seat
in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
83d7662cbb evdev: make evdev_led_update independent from struct evdev_seat
in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
0e9fd6fa0a evdev: change evdev_seat into weston_seat in struct evdev_input_device
We are phasing out struct evdev_seat.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
216d16bece evdev: merge evdev-private.h into evdev.h
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
42a42240c9 evdev: move device opening out from evdev_input_device_create
This makes the generic evdev code (i.e. the functions not relying on
udev) independent of launcher-util too. The aim is to allow re-using the
generic evdev code in the Android backend, where neither udev nor
launcher-util are available.

evdev_input_device_create() signature is changed:
- add the opened device file descriptor
- remove wl_display as unused

Also add a bit of failure logging.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00
Pekka Paalanen
cac530ebae evdev: rename device_removed() to evdev_input_device_destroy()
evdev_input_device_destroy() will completement the API of
evdev_input_device_create(), both being independent from udev.

Since the udev-specific device_removed() would only call
evdev_input_device_destroy() and do nothing else, device_remove() calls
are simply replaced with evdev_input_device_destroy().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:30 +01:00