platform/upstream/libinput.git
10 years agoevdev: write EV_SYN input_event along with led events to device
Rolf Morel [Fri, 9 Aug 2013 14:32:17 +0000 (16:32 +0200)]
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.

10 years agoevdev: Use touch ID 0 when generating touch up event
Rusty Lynch [Fri, 9 Aug 2013 04:08:17 +0000 (21:08 -0700)]
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.

10 years agoevdev: log when a device is used as touchpad
Peter Hutterer [Wed, 7 Aug 2013 01:04:49 +0000 (11:04 +1000)]
evdev: log when a device is used as touchpad

10 years agoevdev: call evdev_device_destroy on failure
Peter Hutterer [Wed, 7 Aug 2013 01:04:48 +0000 (11:04 +1000)]
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.

10 years agoevdev: plug a potential memleak
Peter Hutterer [Wed, 7 Aug 2013 01:04:47 +0000 (11:04 +1000)]
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.

10 years agoevdev: get the current slot value from the absinfo struct or mtdev
Peter Hutterer [Wed, 7 Aug 2013 01:04:46 +0000 (11:04 +1000)]
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.

10 years agoevdev: only use mtdev for Protocol A devices
Peter Hutterer [Wed, 7 Aug 2013 01:04:45 +0000 (11:04 +1000)]
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.

10 years agoevdev: add comment why we're ignoring key value 2
Peter Hutterer [Wed, 7 Aug 2013 01:04:42 +0000 (11:04 +1000)]
evdev: add comment why we're ignoring key value 2

10 years agoevdev: prevent unterminated device name
Peter Hutterer [Wed, 7 Aug 2013 01:04:41 +0000 (11:04 +1000)]
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.

10 years agoevdev: check for ABS_MT_POSITION_X/Y to determine mt devices
Peter Hutterer [Thu, 8 Aug 2013 02:03:08 +0000 (12:03 +1000)]
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

10 years agomalloc + memset -> zalloc
Peter Hutterer [Thu, 8 Aug 2013 01:57:05 +0000 (11:57 +1000)]
malloc + memset -> zalloc

And for clients using the xmalloc helper, use xzalloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoevdev: Suport old-style single-touch touch screens
Kristian Høgsberg [Fri, 26 Jul 2013 17:43:26 +0000 (10:43 -0700)]
evdev: Suport old-style single-touch touch screens

These screens send only BTN_TOUCH and ABS_X/Y.

10 years agoevdev: Use temporary x and y coordinates when applying calibration
Kristian Høgsberg [Fri, 26 Jul 2013 17:41:43 +0000 (10:41 -0700)]
evdev: Use temporary x and y coordinates when applying calibration

Don't overwrite device->abs.x halfway through the matrix multiplication.

10 years agoevdev: Don't add output offset in evdev_process_absolute_motion()
Kristian Høgsberg [Fri, 26 Jul 2013 17:40:32 +0000 (10:40 -0700)]
evdev: Don't add output offset in evdev_process_absolute_motion()

We do that in weston_output_transform_coordinate() now.

10 years agoevdev: Use weston_output_transform_coordinate for evdev touch screens
Kristian Høgsberg [Mon, 22 Jul 2013 22:09:30 +0000 (15:09 -0700)]
evdev: Use weston_output_transform_coordinate for evdev touch screens

10 years agotouchpad: Handle two-finger click as right click for button pads
Kristian Høgsberg [Mon, 1 Jul 2013 16:48:55 +0000 (12:48 -0400)]
touchpad: Handle two-finger click as right click for button pads

10 years agoconfigure.ac: Enable AC_USE_SYSTEM_EXTENSIONS
Daniel Stone [Wed, 22 May 2013 15:03:19 +0000 (18:03 +0300)]
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]

10 years agoinput: Merge wl_seat into weston_seat
Kristian Høgsberg [Tue, 7 May 2013 03:19:49 +0000 (23:19 -0400)]
input: Merge wl_seat into weston_seat

10 years agoevdev-touchpad: Disable tap FSM by default on touchpads with button pads
Jonas Ådahl [Fri, 22 Mar 2013 07:41:42 +0000 (08:41 +0100)]
evdev-touchpad: Disable tap FSM by default on touchpads with button pads

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agocompositor: Support notifying with absolute position too
Rob Bradford [Wed, 27 Mar 2013 15:59:43 +0000 (15:59 +0000)]
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

10 years agocompositor: Change notify_motion to take relative motion events
Kristian Høgsberg [Mon, 25 Feb 2013 22:04:47 +0000 (17:04 -0500)]
compositor: Change notify_motion to take relative motion events

10 years agoevdev: Wait for SYN event before sending events over to the client
Satyeshwar Singh [Wed, 27 Feb 2013 20:26:23 +0000 (15:26 -0500)]
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

10 years agoxkb: Don't call exit on failure in weston_compositor_xkb_init()
Kristian Høgsberg [Sat, 16 Feb 2013 19:29:24 +0000 (14:29 -0500)]
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

10 years agoevdev: Apply calibration values to absolute events
Rob Bradford [Mon, 3 Dec 2012 19:44:16 +0000 (19:44 +0000)]
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.

10 years agoevdev: Include the device capabilities in the debugging
Rob Bradford [Mon, 3 Dec 2012 19:44:13 +0000 (19:44 +0000)]
evdev: Include the device capabilities in the debugging

10 years agoFix a typo.
Dima Ryazanov [Sun, 11 Nov 2012 08:29:01 +0000 (00:29 -0800)]
Fix a typo.

10 years agoevdev: Update axis notifications to follow protocol
Jonas Ådahl [Wed, 3 Oct 2012 20:56:58 +0000 (22:56 +0200)]
evdev: Update axis notifications to follow protocol

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoevdev-touchpad: Implement two finger scroll
Jonas Ådahl [Thu, 27 Sep 2012 16:40:43 +0000 (18:40 +0200)]
evdev-touchpad: Implement two finger scroll

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoevdev-touchpad: Add a finite-state machine
Jonas Ådahl [Thu, 27 Sep 2012 16:40:40 +0000 (18:40 +0200)]
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>
10 years agoevdev-touchpad: Cleanup and refactoring
Jonas Ådahl [Thu, 27 Sep 2012 16:40:39 +0000 (18:40 +0200)]
evdev-touchpad: Cleanup and refactoring

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoevdev-touchpad: Iterate over the touchpad spec table correctly
Rob Bradford [Tue, 9 Oct 2012 17:44:32 +0000 (18:44 +0100)]
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>
10 years agoevdev: Avoid unintended case drop through
Rob Bradford [Tue, 9 Oct 2012 17:44:31 +0000 (18:44 +0100)]
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>
10 years agoevdev-touchpad: Twiddle finger_state correctly
Rob Bradford [Tue, 9 Oct 2012 17:44:29 +0000 (18:44 +0100)]
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>
10 years agocompositor: Change notify_* function to take a weston_seat
Kristian Høgsberg [Fri, 10 Aug 2012 13:50:11 +0000 (09:50 -0400)]
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.

10 years agoevdev: rename evdev_input_device to evdev_device
Pekka Paalanen [Mon, 6 Aug 2012 11:57:08 +0000 (14:57 +0300)]
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>
10 years agoevdev: do not pass a list to evdev_led_update()
Pekka Paalanen [Mon, 6 Aug 2012 11:57:07 +0000 (14:57 +0300)]
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>
10 years agoevdev: kill a warning in evdev_led_update()
Pekka Paalanen [Fri, 3 Aug 2012 11:39:14 +0000 (14:39 +0300)]
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>
10 years agocompositor-drm, evdev: don't crash on missing keyboard
Pekka Paalanen [Fri, 3 Aug 2012 11:39:11 +0000 (14:39 +0300)]
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>
10 years agoevdev: log input devices
Pekka Paalanen [Fri, 3 Aug 2012 11:39:07 +0000 (14:39 +0300)]
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>
10 years agoevdev: move udev code into compositor-drm.c
Pekka Paalanen [Fri, 3 Aug 2012 17:30:30 +0000 (13:30 -0400)]
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>
10 years agoevdev: expose the generic evdev API
Pekka Paalanen [Fri, 3 Aug 2012 11:39:05 +0000 (14:39 +0300)]
evdev: expose the generic evdev API

This API does not depend on udev or launcher-util.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agoevdev: rename evdev_seat to drm_seat
Pekka Paalanen [Fri, 3 Aug 2012 11:39:04 +0000 (14:39 +0300)]
evdev: rename evdev_seat to drm_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agoevdev: pass weston_seat to evdev_input_device_create()
Pekka Paalanen [Fri, 3 Aug 2012 11:39:03 +0000 (14:39 +0300)]
evdev: pass weston_seat to evdev_input_device_create()

in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agoevdev: make evdev_notify_keyboard_focus() independent of evdev_seat
Pekka Paalanen [Fri, 3 Aug 2012 11:39:02 +0000 (14:39 +0300)]
evdev: make evdev_notify_keyboard_focus() independent of evdev_seat

in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agoevdev: make evdev_led_update independent from struct evdev_seat
Pekka Paalanen [Fri, 3 Aug 2012 11:39:01 +0000 (14:39 +0300)]
evdev: make evdev_led_update independent from struct evdev_seat

in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agoevdev: change evdev_seat into weston_seat in struct evdev_input_device
Pekka Paalanen [Fri, 3 Aug 2012 11:39:00 +0000 (14:39 +0300)]
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>
10 years agoevdev: merge evdev-private.h into evdev.h
Pekka Paalanen [Fri, 3 Aug 2012 11:38:59 +0000 (14:38 +0300)]
evdev: merge evdev-private.h into evdev.h

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agoevdev: move device opening out from evdev_input_device_create
Pekka Paalanen [Fri, 3 Aug 2012 11:38:58 +0000 (14:38 +0300)]
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>
10 years agoevdev: rename device_removed() to evdev_input_device_destroy()
Pekka Paalanen [Fri, 3 Aug 2012 11:38:57 +0000 (14:38 +0300)]
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>
10 years agocompositor: Fold the log prototypes into compositor.h and drop log.h
Kristian Høgsberg [Wed, 1 Aug 2012 04:00:57 +0000 (00:00 -0400)]
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

10 years agoevdev: query position ranges for MT, too
Pekka Paalanen [Tue, 31 Jul 2012 10:21:07 +0000 (13:21 +0300)]
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>
10 years agoevdev: Release weston_seat with underlying evdev device
Daniel Stone [Mon, 23 Jul 2012 18:54:59 +0000 (19:54 +0100)]
evdev: Release weston_seat with underlying evdev device

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
10 years agoevdev: Don't ignore multitouch touchscreens
Daniel Stone [Mon, 23 Jul 2012 18:54:57 +0000 (19:54 +0100)]
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>
10 years agonotify_key: Add update_state argument
Daniel Stone [Fri, 22 Jun 2012 12:21:37 +0000 (13:21 +0100)]
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>
10 years agoSplit notify_keyboard_focus into in/out variants
Daniel Stone [Fri, 22 Jun 2012 12:21:29 +0000 (13:21 +0100)]
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>
10 years agoReplace fprintf() by weston_log()
Martin Minarik [Thu, 7 Jun 2012 16:01:59 +0000 (18:01 +0200)]
Replace fprintf() by weston_log()

10 years agoBrown-paper bag fix for LED
Daniel Stone [Fri, 1 Jun 2012 11:13:59 +0000 (12:13 +0100)]
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>
10 years agoAdd keymap argument to weston_seat_init_keyboard
Daniel Stone [Wed, 30 May 2012 15:32:06 +0000 (16:32 +0100)]
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>
10 years agoSplit weston_seat_init up into pointer/keyboard/touch
Daniel Stone [Wed, 30 May 2012 15:32:02 +0000 (16:32 +0100)]
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>
10 years agoConvert notify_axis to wl_fixed_t
Daniel Stone [Wed, 30 May 2012 15:31:57 +0000 (16:31 +0100)]
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>
10 years agoUse enum wl_keyboard_key_state instead of integer
Daniel Stone [Wed, 30 May 2012 15:31:52 +0000 (16:31 +0100)]
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>
10 years agoUse enum wl_pointer_button_state instead of integer
Daniel Stone [Wed, 30 May 2012 15:31:51 +0000 (16:31 +0100)]
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>
10 years agoevdev: Add LED update hook
Daniel Stone [Wed, 30 May 2012 15:31:49 +0000 (16:31 +0100)]
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>
10 years agoevdev: Add device capabilities
Daniel Stone [Wed, 30 May 2012 15:31:48 +0000 (16:31 +0100)]
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>
10 years agoRename evdev_input_device::type to pending_events
Daniel Stone [Wed, 30 May 2012 15:31:47 +0000 (16:31 +0100)]
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>
10 years agoevdev: Convert device type to an enum
Daniel Stone [Wed, 30 May 2012 15:31:46 +0000 (16:31 +0100)]
evdev: Convert device type to an enum

Rather than using #defines.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
10 years agoevdev: Improve touchpad support and add motion filters
Jonas Ådahl [Thu, 17 May 2012 10:18:17 +0000 (12:18 +0200)]
evdev: Improve touchpad support and add motion filters

Touchpad related code has been rewritten and moved to its own file
accessed by evdev via the dispatch interface.

The various functionality implemented are anti-jitter (don't jumping
around), smoother motions, touch detection, pointer acceleration and
some more.

Pointer acceleration is implemented as one generic part, and one touch
specific part (a profile).

Some ideas and magic numbers comes from xserver and
xf86-input-synaptics.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoevdev: Add event process dispatching
Jonas Ådahl [Thu, 17 May 2012 10:18:16 +0000 (12:18 +0200)]
evdev: Add event process dispatching

By setting an 'evdev_dispatch' struct in 'evdev_input_device' during
device configuration the 'process' function in the associated interface
will be called with received input events. If none is set, a fallback
handler will be set instead that handle generic input functionality.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoConvert wl_input_device to wl_seat (and friends)
Daniel Stone [Wed, 16 May 2012 17:45:18 +0000 (18:45 +0100)]
Convert wl_input_device to wl_seat (and friends)

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>
10 years agoevdev: Use wl_fixed_t for relative motions
Jonas Ådahl [Thu, 10 May 2012 20:46:48 +0000 (16:46 -0400)]
evdev: Use wl_fixed_t for relative motions

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agocompositor: Use wl_fixed_t for incoming input events
Kristian Høgsberg [Wed, 9 May 2012 16:19:04 +0000 (12:19 -0400)]
compositor: Use wl_fixed_t for incoming input events

This changes notify_motion, notify_pointer_focus and notify_touch to take
wl_fixed_t types for input coordinates.

10 years agoevdev: Convert wl_fixed_t to int before using internally
Jonas Ådahl [Wed, 9 May 2012 06:46:44 +0000 (08:46 +0200)]
evdev: Convert wl_fixed_t to int before using internally

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agocompositor: move libudev.h to evdev.h
Pekka Paalanen [Fri, 30 Mar 2012 12:20:23 +0000 (15:20 +0300)]
compositor: move libudev.h to evdev.h

Compositor core does not do anything with udev, so the header is not
needed there. Move the #include into evdev.h, from where it gets used by
compositor-drm.c, too.

Also fix the fallout:
tty.c: In function 'tty_create':
tty.c:143:2: warning: implicit declaration of function 'fstat'

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agoFollow wayland change to serial numbers
Kristian Høgsberg [Thu, 12 Apr 2012 02:42:15 +0000 (22:42 -0400)]
Follow wayland change to serial numbers

10 years agoevdev: Get key state from kernel on vt enter
Kristian Høgsberg [Tue, 10 Apr 2012 04:03:30 +0000 (00:03 -0400)]
evdev: Get key state from kernel on vt enter

We need this to correctly initialize compositor key state, modifier state and
to send the right keys in the key enter event.

10 years agoevdev: Disable the udev monitor when another vt becomes active
Benjamin Franzke [Mon, 9 Apr 2012 16:14:58 +0000 (18:14 +0200)]
evdev: Disable the udev monitor when another vt becomes active

We dont want to receive hotplug events while being inactive.
When getting back active we enumerate all devices and would end up
with two sources for one device that may be hotplugged in the mean time.

10 years agoIntroduce weston-launch
Benjamin Franzke [Mon, 30 Jan 2012 13:04:04 +0000 (14:04 +0100)]
Introduce weston-launch

weston-launch starts weston and provides mechanism
for weston to set/drop drm master, open a tty,
and read input devices without being root.

Execution is allowed for local-active sessions
or users in the group weston-launch.

10 years agoProperly dispose event sources and event loops
Jonas Ådahl [Wed, 28 Mar 2012 20:36:09 +0000 (22:36 +0200)]
Properly dispose event sources and event loops

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoevdev: reuse code for device removal
Tiago Vignatti [Tue, 27 Mar 2012 18:26:01 +0000 (21:26 +0300)]
evdev: reuse code for device removal

Just like device_added, now the routines to close the compositor and vt switch
leave are using the same code to remove a device.

This patch also closes properly a mtdev device, bug spotted by Christopher
Michael.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
10 years agoHook up axis events.
Scott Moreau [Thu, 22 Mar 2012 16:47:01 +0000 (10:47 -0600)]
Hook up axis events.

10 years agoevdev: fix input lag when processing input from output repaint
Ander Conselvan de Oliveira [Tue, 20 Mar 2012 23:52:57 +0000 (19:52 -0400)]
evdev: fix input lag when processing input from output repaint

When the compositor is in a repaint cycle, input is processed only once
per frame. However, a call to evdev_input_device_data() would handle at
most 8 events at time. When there was more than 8 events pending for a
given frame, input lag would occur. This was most visible with multi
touch input.

This patch changes the evdev_input_device_data() so that it will handle
all the events available in the fd. In order to do that, the fd is put
in non-blocking mode, so that it is possible to loop on read and stop
on EAGAIN instead of blocking.

10 years agoevdev: use mtdev for multitouch devices
Tiago Vignatti [Fri, 16 Mar 2012 20:33:03 +0000 (17:33 -0300)]
evdev: use mtdev for multitouch devices

mtdev library translates all multitouch based devices to the slotted evdev
protocol. It provides an uniform interface for Weston, which eases mt
implementation when dealing with a big variety of devices.

Weston on drm now directly depends on such library.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agocompositor: Move input devices to their own event loop
Kristian Høgsberg [Mon, 5 Mar 2012 22:49:30 +0000 (17:49 -0500)]
compositor: Move input devices to their own event loop

First step towards only handling input at repaint time.

10 years agoRevert "weston: Drop priviledges early, and seteuid when needed"
Kristian Høgsberg [Tue, 24 Jan 2012 17:37:17 +0000 (12:37 -0500)]
Revert "weston: Drop priviledges early, and seteuid when needed"

This reverts commit fc6ccb868fa735ee9c6592806f381aa1262bf0b2.

We still need root permissions for drmDrop/SetMaster.  Without
integration with ConsoleKit or systemd we also don't have access
to /dev/dri/cardX in the case where we open a new VT.

10 years agoweston: Drop priviledges early, and seteuid when needed
Benjamin Franzke [Tue, 24 Jan 2012 15:37:15 +0000 (16:37 +0100)]
weston: Drop priviledges early, and seteuid when needed

10 years agoevdev: fix uninitialised pointer value
Tiago Vignatti [Fri, 20 Jan 2012 16:47:46 +0000 (18:47 +0200)]
evdev: fix uninitialised pointer value

==30224== Conditional jump or move depends on uninitialised value(s)
==30224==    at 0x40EE3A0: evdev_flush_motion (evdev.c:284)
==30224==    by 0x40EE6DC: evdev_input_device_data (evdev.c:352)
==30224==    by 0x4034710: wl_event_source_fd_dispatch (event-loop.c:76)
==30224==    by 0x4035171: wl_event_loop_dispatch (event-loop.c:462)
==30224==    by 0x4032F76: wl_display_run (wayland-server.c:785)
==30224==    by 0x8050972: main (compositor.c:2183)

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
10 years agoevdev: Drop noisy debug messages on vt swtich
Kristian Høgsberg [Mon, 16 Jan 2012 15:54:07 +0000 (10:54 -0500)]
evdev: Drop noisy debug messages on vt swtich

10 years agoevdev: Correct warning on missing input device
Olivier Le Thanh Duong [Sat, 14 Jan 2012 14:57:34 +0000 (15:57 +0100)]
evdev: Correct warning on missing input device

10 years agoevdev: warn about missing input devices
Pekka Paalanen [Thu, 5 Jan 2012 14:41:21 +0000 (16:41 +0200)]
evdev: warn about missing input devices

Usually there should be at least one input device, when Weston starts
up, or is reactivated by a VT switch. Add a nice warning, in case there
are no input devices.

This is to give a clue to users who happen to try Weston on DRM, and
do not get any response.

Add also a message to another failure case, that may lead to missing
input devices.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agoRename wayland-compositor to weston
Kristian Høgsberg [Tue, 3 Jan 2012 15:29:47 +0000 (10:29 -0500)]
Rename wayland-compositor to weston

This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.

1) Initially, we had one big repository with protocol code, sample
compositor and sample clients.  We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code.  At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message.  The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.

2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor.  Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example.  Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.

We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.

10 years agoclients: Add simple-touch client for testing touch events.
Kristian Høgsberg [Thu, 22 Dec 2011 03:54:49 +0000 (22:54 -0500)]
clients: Add simple-touch client for testing touch events.

10 years agoevdev: Store positions for all touch points in the evdev device
Kristian Høgsberg [Thu, 22 Dec 2011 03:18:36 +0000 (22:18 -0500)]
evdev: Store positions for all touch points in the evdev device

We need to store all touchpoint positions so that if we just get an
ABS_MT_POSITION_X or Y event, we can pull the other coordinate from the
cache.  And we need this across invocations of evdev_input_device_data(),
so the accumulator approach doesn't work.

Instead, we go back to the approach of storing all this state in the
evdev device struct and we might as well just move the rel and abs state
there too.

10 years agoevdev: Add ABS_MT_* support for direct touch devices
Tiago Vignatti [Wed, 21 Dec 2011 17:34:09 +0000 (19:34 +0200)]
evdev: Add ABS_MT_* support for direct touch devices

This adds ABS_MT_* support for direct touch devices and notifies
the compositor.  The compositor has a stub for now.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
10 years agoevdev: new header file for the driver
Tiago Vignatti [Sun, 18 Dec 2011 23:14:03 +0000 (01:14 +0200)]
evdev: new header file for the driver

Besides the new header file, there's also a change in the main evdev creation
procedure for a more suggestive name (evdev_input_add_devices ->
evdev_input_create). There's no real functional changes in this commit.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
10 years agocompositor-drm: remove/add evdev devices when vt switches
Tiago Vignatti [Sun, 18 Dec 2011 22:32:48 +0000 (00:32 +0200)]
compositor-drm: remove/add evdev devices when vt switches

Reported-by: Ran Benite <ran234@gmail.com>
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
10 years agocompositor-drm: destroy evdev driver properly when finishing compositor
Tiago Vignatti [Sun, 18 Dec 2011 21:52:18 +0000 (23:52 +0200)]
compositor-drm: destroy evdev driver properly when finishing compositor

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
10 years agoevdev: use a separate function for adding devices
Tiago Vignatti [Sun, 18 Dec 2011 14:47:15 +0000 (16:47 +0200)]
evdev: use a separate function for adding devices

Adds new function evdev_add_devices for adding udev devices. No
functional changes.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
10 years agoevdev: run flush_motion only when needed
Tiago Vignatti [Thu, 8 Dec 2011 11:20:46 +0000 (13:20 +0200)]
evdev: run flush_motion only when needed

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
10 years agoevdev: send old valuator inside event frame when the other is missing
Tiago Vignatti [Thu, 8 Dec 2011 10:18:16 +0000 (12:18 +0200)]
evdev: send old valuator inside event frame when the other is missing

when a motion is being performed on ts device, only one axis can be sent
through the evdev bytestream whereas the other could be omitted. For instance:

   -------------- SYN_REPORT ------------
   type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 22208
   type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 631
   type 3 (EV_ABS), code 0 (ABS_X), value 22208
   -------------- SYN_REPORT ------------

on such case we'd have to send the compositor the old value of Y. Commit
f547bd36 introduced this bug cause it was sending zeroed coordinate and not
the old one.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
10 years agoevdev: Silence warning
Kristian Høgsberg [Fri, 2 Dec 2011 11:39:02 +0000 (06:39 -0500)]
evdev: Silence warning