Commit graph

182 commits

Author SHA1 Message Date
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
Jonas Ådahl
bb25b2ad29 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>
2013-11-10 17:51:28 +01:00
Jonas Ådahl
812e1e2bdc 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>
2013-11-10 17:51:28 +01:00
Daniel Stone
93c5aa06d5 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>
2013-11-10 17:51:28 +01:00
Jonas Ådahl
def34d026d evdev: Use wl_fixed_t for relative motions
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-10 17:51:28 +01:00
Kristian Høgsberg
3ffaf3d79b 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.
2013-11-10 17:51:28 +01:00
Jonas Ådahl
d9f387fdf7 evdev: Convert wl_fixed_t to int before using internally
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-10 17:51:28 +01:00
Kristian Høgsberg
46b3b7e0fc Follow wayland change to serial numbers 2013-11-10 17:51:28 +01:00
Kristian Høgsberg
b5e48ee43f 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.
2013-11-10 17:51:28 +01:00
Benjamin Franzke
38bb7a001b 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.
2013-11-10 17:51:28 +01:00
Benjamin Franzke
5cc1e3263a 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.
2013-11-10 17:51:28 +01:00
Jonas Ådahl
bab10c0812 Properly dispose event sources and event loops
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-10 17:51:28 +01:00
Tiago Vignatti
9dae619646 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>
2013-11-10 17:51:28 +01:00
Scott Moreau
8fb6507f54 Hook up axis events. 2013-11-10 17:51:28 +01:00
Ander Conselvan de Oliveira
8046633edf 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.
2013-11-10 17:51:27 +01:00
Tiago Vignatti
bdb628857b 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>
2013-11-10 17:51:27 +01:00
Kristian Høgsberg
dfc66d4662 compositor: Move input devices to their own event loop
First step towards only handling input at repaint time.
2013-11-10 17:51:27 +01:00
Kristian Høgsberg
0f0dd81107 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.
2013-11-10 17:51:27 +01:00
Benjamin Franzke
f7968296c6 weston: Drop priviledges early, and seteuid when needed 2013-11-10 17:51:27 +01:00
Tiago Vignatti
67b11f7a8d 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>
2013-11-10 17:51:27 +01:00
Kristian Høgsberg
bcac853c53 evdev: Drop noisy debug messages on vt swtich 2013-11-10 17:51:27 +01:00
Olivier Le Thanh Duong
cbba717b20 evdev: Correct warning on missing input device 2013-11-10 17:51:27 +01:00
Pekka Paalanen
36392fbd24 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>
2013-11-10 17:51:27 +01:00
Kristian Høgsberg
837e433973 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.
2013-11-10 17:51:27 +01:00
Renamed from compositor/evdev.c (Browse further)