Commit graph

73 commits

Author SHA1 Message Date
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
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
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
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
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
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
Kristian Høgsberg
ca9ef609b6 compositor: Fold the log prototypes into compositor.h and drop log.h
We're trying to keep the API exposed by the core compositor in compositor.h
2013-11-10 17:51:30 +01:00
Pekka Paalanen
701024fd90 evdev: query position ranges for MT, too
For a true multi-touch input device, the code ended up using
uninitialised fields of evdev_input_device::abs.

Fix it by querying the corresponding MT ranges.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-11-10 17:51:29 +01:00
Daniel Stone
19b5a3707a evdev: Release weston_seat with underlying evdev device
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00
Daniel Stone
9d67bb202a evdev: Don't ignore multitouch touchscreens
Most touchscreen drivers provide ABS_X and BTN_TOUCH for legacy
single-touch emulation modes, but this isn't mandatory.  Make sure we
don't ignore touchscreens with provide multitouch events with the new
API only.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00
Daniel Stone
f749baab42 notify_key: Add update_state argument
If update_state is true, then notify_key will continue to call
xkb_key_update_state to update the local state mask, as before this
commit.  Otherwise, it will rely on the compositor to manually update
the state itself, for nested compositors.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00
Daniel Stone
8e3bdd91bf Split notify_keyboard_focus into in/out variants
Since the two functions had nothing in common but the local variables.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00
Martin Minarik
07a21a261d Replace fprintf() by weston_log() 2013-11-10 17:51:29 +01:00
Daniel Stone
404488e8bd Brown-paper bag fix for LED
The O_RDWR change got lost in a rebase, and as Peter suggested as well,
make sure to set EVDEV_KEYBOARD if the device has EV_LED.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00
Daniel Stone
37f83e2666 Add keymap argument to weston_seat_init_keyboard
This allows backends to generate their own keymaps and pass them in for
use rather than always forcing a single global keymap, which is
particularly useful for nested compositors.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00
Daniel Stone
619215f6ce Split weston_seat_init up into pointer/keyboard/touch
So we don't unnecessarily advertise interfaces the seat doesn't support.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00
Daniel Stone
36dbbb086c Convert notify_axis to wl_fixed_t
In preparation for the rest of the axis code changing.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00
Daniel Stone
5e29a12788 Use enum wl_keyboard_key_state instead of integer
Instead of using a uint32_t for state everywhere (except on the wire,
where that's still the call signature), use the new
wl_keyboard_key_state enum, and explicit comparisons.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00
Daniel Stone
95b8738f31 Use enum wl_pointer_button_state instead of integer
Instead of using a uint32_t for state everywhere (except on the wire,
where that's still the call signature), use the new
wl_pointer_button_state enum, and explicit comparisons.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00
Daniel Stone
a6cd4965e9 evdev: Add LED update hook
Simply pushes the updated LEDs through to all keyboard attached to the
seat.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00
Daniel Stone
63f2af5574 evdev: Add device capabilities
Does what it says on the box: lists whether or not the device supports
key, absolute, relative or touch classes.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00
Daniel Stone
b48e8a51cb Rename evdev_input_device::type to pending_events
Since that's what it actually is, rather than a description of the
device as such.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-11-10 17:51:29 +01:00