Commit graph

17 commits

Author SHA1 Message Date
Peter Hutterer
544d4b6b74 evdev: the range between dpad and trigger-happy are keys, not buttons
Affected keys:
	KEY_ALS_TOGGLE
	KEY_BUTTONCONFIG
	KEY_TASKMANAGER
	KEY_JOURNAL
	KEY_CONTROLPANEL
	KEY_APPSELECT
	KEY_SCREENSAVER
	KEY_VOICECOMMAND
	KEY_BRIGHTNESS_MIN
	KEY_BRIGHTNESS_MAX
	KEY_KBDINPUTASSIST_PREV
	KEY_KBDINPUTASSIST_NEXT
	KEY_KBDINPUTASSIST_PREVGROUP
	KEY_KBDINPUTASSIST_NEXTGROUP
	KEY_KBDINPUTASSIST_ACCEPT
	KEY_KBDINPUTASSIST_CANCEL

https://bugs.freedesktop.org/show_bug.cgi?id=95295

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 8527242ed9)
2016-05-30 08:31:16 +10:00
Jonas Ådahl
240d669bba test: Handle 32 bit msec time overflows
The libinput_*_get_time() returns a 32 bit unsigned integer, but in the
tests we compared them to a 64 bit unsigned integer. This means that
when the 32 bit integer overflowed, we'd still compare to a
non-overflowed 64 bit integer, causing the tests to fail.

This commit fixes this by always casting the millisecond 64 bit unsigned
integer to a 32 unsigned integer, triggering the same overflow.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-11 07:53:25 +10:00
Jonas Ådahl
aa5f55149b Change to micro seconds for measuring time internally
In order to provide higher precision event time stamps, change the
internal time measuring from milliseconds to microseconds.
Microseconds are chosen because it is the most fine grained time stamp
we can get from evdev.

The API is extended with high precision getters whenever the given
information is available.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-28 17:42:32 +08:00
Peter Hutterer
bc9f16b40e COPYING: Update boilerplate from MIT X11 to MIT Expat license
To quote Bryce Harrington from [1]:
"MIT has released software under several slightly different licenses,
including the old 'X11 License' or 'MIT License'.  Some code under this
license was in fact included in X.org's Xserver in the past.  However,
X.org now prefers the MIT Expat License as the standard (which,
confusingly, is also referred to as the 'MIT License').  See
http://cgit.freedesktop.org/xorg/xserver/tree/COPYING

When Wayland started, it was Kristian Høgsberg's intent to license it
compatibly with X.org.  "I wanted Wayland to be usable (license-wise)
whereever X was usable."  But, the text of the older X11 License was
taken for Wayland, rather than X11's current standard.  This patch
corrects this by swapping in the intended text."

libinput is a fork of weston and thus inherited the original license intent
and the license boilerplate itself.

See this thread on wayland-devel here for a discussion:
http://lists.freedesktop.org/archives/wayland-devel/2015-May/022301.html

[1] http://lists.freedesktop.org/archives/wayland-devel/2015-June/022552.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
2015-06-16 14:36:04 +10:00
Peter Hutterer
9dbeb9d0f7 test: move main() into litest
This allows us to filter things based on argv before setting up tests, etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 08:45:33 +10:00
Peter Hutterer
fd301dfba2 test: add litest_is_keyboard_event() helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-07 16:17:50 +10:00
Derek Foreman
fefc31806e test: Add negative test for libinput_device_keyboard_has_key()
Ensure we get a -1 return for non-keyboard devices.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-04-27 09:45:04 +10:00
Peter Hutterer
4996076a7c Add libinput_device_keyboard_has_key()
Similar to libinput_device_pointer_has_button(), this function returns whether
a given device has a specific keycode.

This enables a caller to determine if the device is really a keyboard (check
for KEY_A-KEY_Z) or just a media key device (check for KEY_PLAY or somesuch),
depending on the context required.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-04-23 10:32:31 +10:00
Peter Hutterer
ed0f0bf494 test: fix Coverity complaints
seat_button_count
seat_key_count ... uninitialized variable

t = zalloc
s = zalloc ... dereferencing potential NULL-pointer

d->ntouches_down... side-effect in assertion

Coverity run against the 0.10.0 tag, see
https://scan.coverity.com/projects/4298

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Christian Hartmann <cornogle@googlemail.com>
2015-02-20 10:03:09 +10:00
Jonas Ådahl
8f846a41fa evdev: Release still pressed keys/buttons when removing device
When removing a device, its not guaranteed that all button or key
presses have been released, resulting in an invalid seat wide button
count.

Note that kernel devices normally will send release events when being
unplugged, but this won't happen when removing a device from the path
backend.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-18 22:41:16 +02:00
Jonas Ådahl
c8017595fc evdev: Ignore key/button release events if key was never pressed
The kernel may send a 'release' event without ever having sent a key
'pressed' event in case the key was pressed before libinput was
initiated. Ignore these events so that we always guarantee a release
event always comes after a pressed event for any given key or button.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-08-18 22:35:19 +02:00
Peter Hutterer
d03488f4a3 test: prefix custom test devices with "litest"
Follow-up from 6c4778f891

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-04 07:57:59 +10:00
Peter Hutterer
bad56cac5b Merge branch 'ref-counting-context'
Conflicts:
	src/udev-seat.c
	test/log.c
2014-06-25 10:32:42 +10:00
Jonas Ådahl
faab25c25c Make context reference counted
Instead of only allowing one owner keeping a libinput context alive,
make context reference counted, replacing libinput_destroy() with
libinput_unref() while adding another function libinput_ref().

Even though there might not be any current use cases, it doesn't mean we
should hard code this usage model in the API. The old behaviour can be
emulated by never calling libinput_ref() while replacing
libinput_destroy() with libinput_unref().

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-25 10:27:03 +10:00
Peter Hutterer
967911791f Rename KEYBOARD_KEY_STATE to KEY_STATE
e912d620d0 changed from POINTER_BUTTON_STATE to
simply BUTTON_STATE, replicate that for key events too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-23 15:23:35 +10:00
Peter Hutterer
54431242ce test: fix a couple of memleaks in the tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-23 12:43:23 +10:00
Jonas Ådahl
3f349026cf test: Test seat wide button and key count helpers
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-23 00:07:40 +02:00