summaryrefslogtreecommitdiff
path: root/test/input.c
AgeCommit message (Collapse)AuthorFilesLines
2012-03-21Introduce a consistent coding styleKeith Packard1-199/+246
This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-02-03Namespace list api to reduce conflicts with similar system headersAlan Coopersmith1-6/+6
Rename functions/macros from list_* to xorg_list_* Rename struct from struct list to struct xorg_list. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> In-sed-I-trust: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-22test: fix grab mode value tests for new XIGrabModeTouchPeter Hutterer1-4/+13
This test checks that last-valid-mode + 1 returns a BadValue. With the addition of XIGrabModeTouch, that value has changed - sync it up again. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13input: replace GRABTYPE_* with the InputLevel enumsPeter Hutterer1-65/+65
They achieve the same thing, re-use the more generic InputLevel so we can convert to/fro easier. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09dix: switch the syncEvent queue to a struct listPeter Hutterer1-0/+67
No effective functionality change, just cleanup to make this code slightly more sane. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-10-21test: Add unit test for mieqJeremy Huddleston1-0/+69
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-21test: Silence some debug lines from the input unit testsJeremy Huddleston1-6/+9
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-19Merge remote-tracking branch 'whot/for-keith'Keith Packard1-1/+14
2011-10-18dix: add valuator_mask_fetch_double()Peter Hutterer1-1/+14
Using this call simplifies callers that don't know if the mask bit is set. Before: if (valuator_mask_isset(mask, valnum)) value = valuator_mask_get_double(mask, valnum)); else value = someothervalue; Now: if (!valuator_mask_fetch_double(mask, valnum, &value)) value = someothervalue; Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-15test: fix input testDave Airlie1-11/+11
The test was memsetting the wrong thing, this fixes make check in my tinderbox. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-15dix: add utility functions for double to/fro FP1616/FP3232 conversionJeremy Huddleston1-0/+128
Co-authored-by: Jeremy Huddleston <jeremyhu@apple.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2011-09-30Input: Add smooth-scrolling support to GetPointerEventsPeter Hutterer1-0/+57
For scroll wheel support, we used to send buttons 4/5 and 6/7 for horizontal/vertical positive/negative scroll events. For touchpads, we really want more fine-grained scroll values. GetPointerEvents now accepts both old-school scroll button presses, and new-style scroll axis events, while emitting both types of events to support both old and new clients. This works with the new XIScrollClass to mark axes as scrolling axes. Drivers mark any valuators that send scroll events with SetScrollValuator. (Currently missing: the XIDeviceChangeEvent being sent when a driver changes a scroll axis at run-time. This can be added later.) Note: the SCROLL_TYPE enums are intentionally different values to the XI2 proto values to avoid copy/overlapping range bugs. Co-authored-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29Input: Add double-precision valuator_mask APIDaniel Stone1-6/+15
Add API for valuator_mask that accepts and returns doubles, rather than ints. No double API is provided for set_range at the moment. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-08-22input: make InputOption opaque, provide interface functions.Peter Hutterer1-0/+90
InputOptions is not switched to use struct list for a future patch to unify it with the XF86OptionRec. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2011-08-22Disable check of double-aligned in test/input.c on Renesas SHNobuhiro Iwamatsu1-1/+1
Renesas SH is not aligned at size of double. When structure has double value, It is aligned in 4byte (long). Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-08-22dix: add KEYBOARD_OR_FLOAT and POINTER_OR_FLOAT to GetMaster()Peter Hutterer1-0/+13
GetMaster() currently requires an attached slave device as parameter, resuling in many calls being IsFloating(dev) ? dev : GetMaster(...); Add two new parameters so GetMaster can be called unconditionally to get the right device. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-08-22test: add a test for GetMaster() behaviourPeter Hutterer1-0/+62
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-06-03test: don't test for double alignment on i386. (#36986)Peter Hutterer1-0/+3
i386 is one of the few architectures that doesn't need double alignment. X.Org Bug 36986 <http://bugs.freedesktop.org/show_bug.cgi?id=36986> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-21test: remove glib dependencyPeter Hutterer1-256/+253
The few features from the glib test suite we used can be replaced with assert and printf. This patch is a simple replacement for these two g_assert → assert g_test_message → printf g_test_init is removed and so is g_test_bug_base. g_test_run replaced with a simple return 0. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Tiago Vignatti <tiago.vignatti@nokia.com> Acked-by: Gaetan Nadon <memsize@videotron.ca>
2011-04-18Xi: fix valuator alignment in DeepCopyDeviceClasses (#36119)Peter Hutterer1-1/+23
commit 678f5396c91b3d0c7572ed579b0a4fb62b2b4655 only fixed the initialization, not the copy. After a slave device change, the valuator were out of alignment again. X.Org Bug 36119 <http://bugs.freedesktop.org/show_bug.cgi?id=36119> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-02-23Merge branch 'mi-cleanup' into nextPeter Hutterer1-0/+139
2011-02-22test: write some event → XI1 conversion tests.Peter Hutterer1-0/+139
Don't test everything, but hey, life is short and I'm trying to have one. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-02-17Input: Allow EventToCore to return multiple eventsDaniel Stone1-29/+39
Some event types (notably Expose and GraphicsExpose) require multiple events, a la XI 1.x. Bring the EventToCore API in line with EventToXI's and allow it to generate multiple events. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-01-07Merge branch 'for-peter' of git://people.freedesktop.org/~daniels/xserver ↵Peter Hutterer1-18/+11
into for-keith
2011-01-07input: add valuator_mask_free() to free a valuator mask.Peter Hutterer1-1/+2
Expecting the caller to free the mask requires us to keep it in a single memory block (which may be an issue lateron), aside from leaving the API asymetrical. Provide valuator_mask_free() to free the memory and reset the mask pointer to NULL. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Fernando Carrijo <fcarrijo@freedesktop.org> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-01-06Test: Input: Add helper function for failing EventToCoreDaniel Stone1-18/+11
We have quite a few tests which involve checking that EventToCore fails for specific events, so refactor them into a separate function. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-11-26include: let BitIsOn() return a boolean value.Peter Hutterer1-0/+16
Simply returning the mask bit breaks checks like BitIsOn(mask, 0) != BitIsOn(mask, 1); as used in 048e93593e3f7a99a7d2a219e1ce2bdc9d407807. 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-24test: reduce range of byte-padding macro tests.Peter Hutterer1-17/+54
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-24test: compare byte padding macros against the expected bytes.Peter Hutterer1-0/+3
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-11Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into ↵Peter Hutterer1-0/+2
input-api Conflicts: dix/getevents.c hw/xfree86/common/xf86Xinput.h Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-25test: valuator_mode tests.Peter Hutterer1-0/+33
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22input: remove "mode" field from ValuatorClassRec.Peter Hutterer1-1/+1
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-22test: input - set valuators mask for event to core conversionChase Douglas1-0/+2
Commit de8be07cc0a8163b6ef04455706fd5ca2cebe587 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-22test: valuator_mask tests.Peter Hutterer1-0/+77
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-06-11xfree86: Match devices based on USB IDDan Nicholson1-0/+12
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-11xfree86: Match devices based on PnP IDDan Nicholson1-0/+12
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-05-28test: fix up InputAttributes helper function test.Peter Hutterer1-1/+8
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-25dix: add helper functions to duplicate and free InputAttributes.Peter Hutterer1-0/+102
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-01-27dix: EventToCore needs to copy the root window too.Peter Hutterer1-1/+3
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>
2009-11-25Xi: when deleting all properties, reset property handler to NULL.Peter Hutterer1-0/+54
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-07-30test: fix build by including eventstr.hPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-22input: remove XI2 keysym grabs, use keycode grabs instead.Peter Hutterer1-2/+2
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-14include: introduce byte counting functions.Peter Hutterer1-0/+39
This patch adds the following three functions: bits_to_bytes(bits) - the number of bytes needed to hold 'bits' bytes_to_int32(bytes) - the number of 4-byte units to hold 'bytes' pad_to_int32(bytes) - the closest multiple of 4 equal to or larger than 'bytes'. All three operations are common in protocol processing and currently the server has ((foo + 7)/8 + 3)/4 operations all over the place. A common set of functions reduce the error rate of these (albeit simple) calculations and improve readability of the code. The functions do not check for overflow. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-29test: fix build error introduced by XINPUT_ABI 7Peter Hutterer1-2/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-05Revert "test: check from INT_MIN to INT_MAX for core type conversion"Peter Hutterer1-30/+26
This patch requires extra special casing to check if the linker supports the -wrap option. Patches to do so will follow, in the meantime, revert this commit. It shouldn't have been pushed in the first place anyway. This reverts commit d979f443946011158b6a183582728a6899c33b85. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-04test: check from INT_MIN to INT_MAX for core type conversionPeter Hutterer1-26/+30
ErrorF is link-wrapped to reduce the run-time of the test. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-04test: adjust event_to_core_conversion test for new ProximityIn/Out behaviourPeter Hutterer1-2/+8
Both types now return BadMatch. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-02test: add grab matching tests.Peter Hutterer1-0/+363
2009-06-01input: Add grabtype to GrabParameters.Peter Hutterer1-0/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-01test: Add GetSelectedEvents request to struct size tests.Peter Hutterer1-0/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>