Commit Graph

72 Commits

Author SHA1 Message Date
Peter Hutterer
42dc91e32a include: let BitIsOn() return a boolean value.
Simply returning the mask bit breaks checks like
    BitIsOn(mask, 0) != BitIsOn(mask, 1);
as used in 048e93593e.

The naming of this macro suggests that it should return boolean values
anyway. This patch also adds a few simple tests for these macros to make
sure they don't accidentally break in the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pat Kane <pekane52@gmail.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-11-26 09:59:24 +10:00
Peter Hutterer
d435e1ecb8 test: reduce range of byte-padding macro tests.
Byte padding and conversion is interesting for the rage of 0-8 bytes, and
then interesting towards the end of the valid range (INT_MAX - 7 and INT_MAX
- 3).

Note: this changes the upper range for pad_to_int32() and bytes_to_int32()
from the previous (INT_MAX - 4) to (INT_MAX - 3).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2010-11-24 08:47:00 +10:00
Peter Hutterer
f49ee9074a test: compare byte padding macros against the expected bytes.
We calculate the expected bytes for each value, let's use it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2010-11-24 08:47:00 +10:00
Cyril Brulebois
c481dae0dc test: Fix missing xkbsrv.h include.
Otherwise, building fails with CFLAGS="-Wall -Werror" this way:
| protocol-common.c: In function ‘init_simple’:
| protocol-common.c:159: error: implicit declaration of function ‘XkbInitPrivates’
| protocol-common.c:159: error: nested extern declaration of ‘XkbInitPrivates’

Signed-off-by: Cyril Brulebois <kibi@debian.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-12 11:49:21 +10:00
Peter Hutterer
88cb61e1e5 Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-api
Conflicts:
	dix/getevents.c
	hw/xfree86/common/xf86Xinput.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-11 12:54:46 +10:00
Peter Hutterer
4613ce3f78 test: valuator_mode tests.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-25 10:37:52 +10:00
Peter Hutterer
dd11f734a9 input: remove "mode" field from ValuatorClassRec.
We have per-axis mode now. For those bits that still need it (XI 1.x),
assume that the first axis holds the device's mode.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 16:19:00 +10:00
Chase Douglas
290af0418f test: input - set valuators mask for event to core conversion
Commit de8be07cc0 adds a requirement to
event to core conversion that at least one of the X or Y valuators are
set in the valuator mask. This commit fixes the event conversion test to
be compliant.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-22 13:36:10 +10:00
Peter Hutterer
9696c782c8 test: valuator_mask tests.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 11:02:53 +10:00
Jeremy Huddleston
23229c7ce5 test: Fix make distcheck when not building unit tests
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-10-13 19:27:18 -07:00
Dan Nicholson
87a1507da7 xfree86: Match devices based on USB ID
Sometimes the vendor and product names aren't specific enough to target
a USB device, so expose the numeric codes in the ID. A MatchUSBID entry
has been added that supports shell pattern matching when fnmatch(3) is
available. For example:

	MatchUSBID "046d:*"

The IDs are stored in lowercase hex separated by a ':' like "lsusb" or
"lspci -n".

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-11 09:30:33 +10:00
Dan Nicholson
645679c152 xfree86: Match devices based on PnP ID
Serial input devices lack properties such as product or vendor name. This
makes matching InputClass sections difficult. Add a MatchPnPID entry to
test against the PnP ID of the device. The entry supports a shell pattern
match on platforms that support fnmatch(3). For example:

	MatchPnPID "WACf*"

A match type for non-path pattern matching, match_pattern, has been added.
The difference between this and match_path_pattern is the FNM_PATHNAME
flag in fnmatch(3).

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-11 09:30:07 +10:00
Keith Packard
8e97e5f942 If XTest is always required, then eliminate the XTest devPrivate
The internals of XTest are used by Xi and Xkb, and both Xi and Xkb are
always required, so it makes little sense to have XTest place data in
a devPrivate, especially a devPrivate which is only available when the
XTest extension is enabled.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-07 19:56:47 -07:00
Keith Packard
bc26665661 Initialize private keys in test suite
Make sure all of the private keys used by the test code are
initialized before being used.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Robert Hooker <sarvatt@ubuntu.com>
2010-06-06 21:24:04 -07:00
Peter Hutterer
151659f963 test: fix up InputAttributes helper function test.
Just some extra clarification as pointed out by Dan Nicholson,
and that memcpy should have been a memcmp.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
2010-05-28 16:49:30 +10:00
Jamey Sharp
7045486491 Ignore build products in the server's test suite.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-26 11:17:53 -07:00
Peter Hutterer
86303a338a dix: add helper functions to duplicate and free InputAttributes.
No special memory handling is used to give drivers the maximum flexibility
with the data. Drivers should be able to call realloc on the product string
if needed and perform similar operations.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-25 10:06:11 -07:00
Jamey Sharp
c6613cfc26 test/xi2: Initialize predefined atoms before XInputExtensionInit.
XInputExtensionInit calls MakeAtom, which doesn't work without the atoms
table initialized.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-14 17:33:50 -07:00
Mikhail Gusarov
3f3ff971ec Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13 00:22:37 +07:00
Keith Packard
a974c8e7cb Merge remote branch 'whot/for-keith' 2010-04-30 12:33:00 -07:00
Rami Ylimäki
262c2c9031 test: Fix linking of wrapped functions in XI2 tests.
Running "make check" will lead to build problems in
scratchbox. Building the first test that wraps dixLookupWindow fails
because symbol __real_dixLookupWindow can't be resolved. Defining
wrapping options as linker options instead of compiler options makes
everything build nicely in scratchbox.

Signed-off-by: Rami Ylimäki <ext-rami.ylimaki@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-28 15:42:43 +10:00
Tiago Vignatti
4f8dc1109d dix and others: remove unused arraySize field from ScreenInfo
Bizarre. This seems to never be used before. I left the field in ScreenInfo,
with another name. So, stop looking at it.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
2010-04-26 14:35:27 +03:00
Peter Hutterer
b4baab90c0 dix: EventToCore needs to copy the root window too.
This value isn't actually set for normal events but it saves us some work
for the record extension support.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-01-27 14:38:16 -08:00
Peter Hutterer
90e6d93cf9 test/xi2: fail if xi2 class type is garbage. (#25492)
If the keycode range exceeds the allowable length, memory gets overwritten.
Catch this case by making sure that only allowed class types are
present.

X.Org Bug 25492 <http://bugs.freedesktop.org/show_bug.cgi?id=25492>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2009-12-22 21:30:52 -08:00
Julien Cristau
b44c9be244 test/xi2: fix maximum max_keycode (bug#25492)
The number of keycodes needs to be lower than 0xFFFD so that the length
field of xXIKeyInfo doesn't overflow.

Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-12-23 11:43:21 +10:00
Peter Hutterer
1b127ab842 Xi: when deleting all properties, reset property handler to NULL.
Trying to unregister property handlers during the device closure process
leads to invalid memory accesses.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2009-11-25 10:57:07 +10:00
Gaetan Nadon
c739beb439 .gitignore: use common defaults with custom section #24239
Using common defaults will reduce errors and maintenance.
Only the very small or inexistent custom section need periodic maintenance
when the structure of the component changes. Do not edit defaults.

Reviewed-By: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2009-11-11 21:40:20 -08:00
Alan Coopersmith
4b0911565d Add platform tests for Dtrace linker magic
Replaces special handling for Xquartz DDX and scales better to handling
the multiple platforms that now have some level of Dtrace support available.

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2009-10-06 19:40:19 -07:00
Alan Coopersmith
e23bffc41b Fix build of unit tests when dtrace probes are enabled
ar loses the dtrace probe magic when building static libraries, so we
have to link with the .O files in order to resolve the dtrace probe symbols.

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-09-24 16:36:25 -07:00
Alan Coopersmith
139368f7ae Fix num_masks/length overflow test for XiSelectEvents
Have to set windowid to a valid value first, since that check
appears earlier in the code than the masks/length check.

Also have to have data[] set large enough so that reading mask
data for 0xFFFF masks doesn't overflow past the end of the array
into uninitialized data.

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-16 11:44:08 +10:00
Alan Coopersmith
13decf5efe test_convert_XIRawEvent: Don't write more data than the struct holds
sizeof(in.valuators.mask) * 8 == 40, but the valuators arrays only
holds 36 entries, so the test was smashing the stack when 36 < i < 40
(leading to core dumps on Solaris x86, since the return address was
 overwritten with an invalid pointer).

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-16 11:04:25 +10:00
Alan Coopersmith
38a61e9a7c Remove stray semi-colon in protocol-common.c
Caused Sun compilers to issue warning:
"protocol-common.c", line 141: warning: syntax error:  empty declaration

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-16 11:04:25 +10:00
Peter Hutterer
84eb4c66a4 test: add protocol testing for XIWarpPointer.
TODO: some way to check src_x/y coordinates would be good.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03 11:00:54 +10:00
Peter Hutterer
1b7858e846 test: expose the default screen to tests, some cleanup work.
Provide common #define for invalid window IDs.
Init the sprite's hotPhys, provide a common #define for the initial sprite
position.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03 11:00:49 +10:00
Peter Hutterer
377a5f655c Xi: if XISetEventMask fails, return this to the client.
The only failure point can be a BadAlloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03 08:39:27 +10:00
Peter Hutterer
b41db8fe46 Xi: fix broken swap code in XISelectEvents request processing.
The pointer advanced 12 bytes too short. Rather unfortunate if both the code
and the test have the same bug.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03 08:39:27 +10:00
Peter Hutterer
6fe235d363 test: fix request length calculation, add length tests for XISelectEvents
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03 08:39:26 +10:00
Peter Hutterer
7ab1b50c54 test: fix build after changing libxf86config.la
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03 08:39:26 +10:00
Peter Hutterer
2fba2eac0b test: add a few tests for xtest device initialization.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-27 14:24:51 +10:00
Peter Hutterer
fe430d7d3b test: add XIQueryPointer protocol tests.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24 10:08:14 +10:00
Peter Hutterer
f1c856ef90 test: fake initialization of a sprite trace and window locations
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24 10:07:06 +10:00
Peter Hutterer
7e37e7c50e test: add protocol tests for DeviceChangedEvents
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17 14:40:21 +10:00
Peter Hutterer
af38f6790c test: add event conversion tests for XIDeviceEvents 2009-08-13 11:19:36 +10:00
Peter Hutterer
8483b08152 test: add focus and enter conversion testing.
Doesn't actually convert anything, but verify the expected behaviour.
2009-08-13 11:19:35 +10:00
Peter Hutterer
59dc59a72f test: add XI2 eventconversion test for raw events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13 11:19:35 +10:00
Peter Hutterer
10d7948e03 test: fix build error introduced by new AllocDevicePair API
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13 11:19:35 +10:00
Peter Hutterer
9498113139 test: fix build by including eventstr.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 21:59:52 +10:00
Peter Hutterer
9a1bfa5664 input: remove XI2 keysym grabs, use keycode grabs instead.
Keysym grabs are tricky in the details, keycode grabs are known to work. So
for now, provide keycode grabs only.

Requires inputproto 1.9.99.15.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-22 12:12:51 +10:00
Peter Hutterer
cc575a3ba4 test: add tests for ProcXIGetClientPointer.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-14 11:43:58 +10:00
Peter Hutterer
92b0065a19 test: add ProcXISetClientPointer tests.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-14 11:41:29 +10:00