summaryrefslogtreecommitdiff
path: root/dix/eventconvert.c
AgeCommit message (Collapse)AuthorFilesLines
2012-03-21Introduce a consistent coding styleKeith Packard1-370/+424
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-01-06dix: Set XITouchEmulatingPointer on events from the touch sequence emulating ↵Carlos Garnacho1-0/+4
pointer events The internal flag is kept around, merely translated to XITouchEmulatingPointer when creating the XI2 events that will be delivered to the client. Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-19Hook up the ownership eventsPeter Hutterer1-0/+27
This patch applies most of the protocol conversions and the internal event type for ownership events. Note that ownership events are generated by the DIX only, they do not pass through the event queue. Co-authored-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-16Xi: process raw touch eventsPeter Hutterer1-0/+12
No-one can generated them yet, but if they could, we'd be processing them like there was no tomorrow. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-16Hook up TouchBegin/Update/End eventsPeter Hutterer1-2/+22
The are the same as device events internally but require the touch ID separately from the detail.button field (the protocol uses the detail field for the touch id). For simpler integration of pointer emulation we need to set the detail.button field while keeping the touchid around. Add the three new touch event types to the various places in the server where they need to be handled. The actual handling of the events is somewhat more complicated in most places. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-10Change GetXI2/XI/CoreType to just take a type argumentPeter Hutterer1-8/+8
Avoids the dummy-event dance if we have an event type and need to get the matching XI2 type. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-10-25Use new FP1616/FP3232 conversion functionsPeter Hutterer1-10/+4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-25dix: add ScrollInfo to DeviceChangedEventsPeter Hutterer1-0/+53
3304bbff9b4ed63f1a47410a5320a136420ba2c6 added smooth scrolling support for pointer events and for XIQueryDevice but didn't add the matching parts to XIDeviceChangedEvents. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-10dix: copy the source ID into the RawEvent (#34240)Peter Hutterer1-0/+1
X.Org Bug 34240 <http://bugs.freedesktop.org/show_bug.cgi?id=34240> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-09-30Input: Fix frac calculation on [Raw]DeviceEvent conversionMax Schwarz1-4/+6
(1UL << 32) evaluates to 0 (at least here), so do the fraction calculation in two steps as in libXi. Fractions on xXIRawEvent were not multiplied at all, which also gave 0 as result. Signed-off-by: Max Schwarz <Max@x-quadraht.de> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29Input: Make DeviceEvent use doubles internallyDaniel Stone1-2/+3
Change the DeviceEvent InternalEvent to use doubles for its valuators, instead of data and data_frac. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29Input: Make RawDeviceEvent use doubles internallyDaniel Stone1-5/+8
Change RawDeviceEvent to use doubles for valuators internally, rather than data(_raw) and data(_raw)_frac. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29Input: Add flags to RawDeviceEventDaniel Stone1-0/+1
Add a flags member which will be copied wholesale into the resultant xXIRawEvent. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29Input: Add flags to DeviceEventDaniel Stone1-0/+1
Add a flags member which will be copied wholesale into the resultant xXIDeviceEvent. 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> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-11dix: replace unneded goto with break.Peter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-04-07Fix unset valuator handling for XI 1.x valuator events againChase Douglas1-9/+5
Set the valuator values for unset masked absolute valuators in the internal device event. This ensures the values will always be correct in getValuatorEvents even if the device has been removed. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-04Don't report old relative values in getValuatorEventsChase Douglas1-1/+3
Relative valuator values should not be reported in any future events. If a relative valuator value is not set in an internal event, set the value to 0 for XI 1.x valuator events sent over the wire. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Simon Thum <simon.thum@gmx.de> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-04Handle non continuous valuator data in getValuatorEventsChase Douglas1-4/+7
This allows for masked valuators to be handled properly in XI 1.x events. Any unset valuators in the device event are set to the last known value when transmitted on the wire through XI 1.x valuator events. Fixes https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/736500 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>
2011-03-29Clean up getValuatorEvents using array loop logicChase Douglas1-14/+6
Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-09input: warning fixesAdam Jackson1-0/+3
eventconvert.c:287:9: warning: enumeration value 'ET_Enter' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_Leave' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_FocusIn' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_FocusOut' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_DeviceChanged' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_Hierarchy' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_DGAEvent' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_RawKeyPress' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_RawKeyRelease' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_RawButtonPress' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_RawButtonRelease' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_RawMotion' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_XQuartz' not handled in switch eventconvert.c:287:9: warning: enumeration value 'ET_Internal' not handled in switch From the code it appears these are can't happens, so if they ever do, BadImplementation seems entirely appropriate. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-23Merge branch 'mi-cleanup' into nextPeter Hutterer1-2/+14
2011-02-22dix: a valuator number of 0 is valid (#34510)Peter Hutterer1-2/+14
For all but motion and proximity events, having no valuators is ok. Regression from 1.9, keyboard events are not converted to protocol events. X.Org Bug 34510 <http://bugs.freedesktop.org/show_bug.cgi?id=34510> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Tested-by: Timo Aaltonen <timo.aaltonen@canonical.com>
2011-02-17Input: Allow EventToCore to return multiple eventsDaniel Stone1-9/+30
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>
2010-12-07dix: don't stop processing valuators when the mode changes.Peter Hutterer1-8/+0
XI 1.x events still contain absolute coordinates anyway. By the time we get to the InternalEvent to XI event conversion, the valuators are already absolute. Stopping because of a different mode on a valuator is not necessary. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-11-24dix: when converting to XI 1.x events, use the first_valuator's device modePeter Hutterer1-6/+8
Don't stop processing events when a valuator's mode doesn't match the 0th valuator's mode. Instead, start with the first_valuator in the event and keep stacking them on until the first valuator with a different mode is hit. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-11-24dix: when comparing axis modes, compare the bits, not the bytes.Peter Hutterer1-1/+1
The DeviceEvent's mode field is a set of bits for each valuator, not bytes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-10-22Add support for per-axis valuator modes (Relative/Absolute)Chase Douglas1-1/+13
The XI2 protocol supports per-axis modes, but the server so far does not. This change adds support in the server. A complication is the fact that XI1 does not support per-axis modes. The solution provided here is to set a per-device mode that defines the mode of at least the first two valuators (X and Y). Note that initializing the first two axes to a different mode than the device mode will fail. For XI1 events, any axes following the first two that have the same mode will be sent to clients, up to the first axis that has a different mode. Thus, if a device has relative, then absolute, then relative mode axes, only the first block of relative axes will be sent over XI1. Since the XI2 protocol supports per-axis modes, all axes are sent to the client. Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2010-09-01dix: don't create core motion events for non-x/y valuators.Peter Hutterer1-0/+9
Devices that send motion events with valuators other than x/y get core motion events with unchanged x/y coordinates. This confuses some applications. If the DeviceEvent does not have the x/y valuators set, return BadMatch on core conversion, thus skipping the event altogether. Reported-by: Bartosz Brachaczek <b.brachaczek@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Bartosz Brachaczek <b.brachaczek@gmail.com>
2010-05-13Replace X-allocation functions with their C89 counterpartsMikhail Gusarov1-4/+4
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-01-27dix: EventToCore needs to copy the root window too.Peter Hutterer1-0/+1
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-27Revert "dix: EventToCore needs to copy the root window too."Keith Packard1-1/+0
This reverts commit 0f2d297dedeff8bd227df4c498cc668b0e902344. Peter provided an updated patch which fixes the tests.
2010-01-25dix: EventToCore needs to copy the root window too.Peter Hutterer1-0/+1
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-09-24dix: report XI1 axis values correctly if first_valuator != 0Thomas Jaeger1-6/+6
Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-22input: don't use typecasts to access members of InternalEvent.Peter Hutterer1-5/+5
To avoid confusion, the member names are now postfixed with _event. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-04dix: hide the sequenceNumber key repeat hack behind two functions.Peter Hutterer1-4/+32
Just in case we figure out a better way to do it in the future. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-04input: allow for detectable autorepeat.Daniel Stone1-0/+7
For core and XI1 events, store the key_repeat flag in the sequence number until TryClientEvents. The sequenceNumber is unset until TryClientEvents. [Also thrown in, some random indentation changes. Thanks] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17dix: rework DeviceChangedEvents a bit.Peter Hutterer1-4/+4
DCEs are now processed when sent throught the master device, not when sent through the slave device. This includes a removal of some un-used (or partly used) fields in the DCE itself to something more self-explanatory. TODO: if a device has events queued and its attachment is changed, the DCE is silently dropped now. Instead, it should be generated as soon as the first event after the attachment is sent. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17dix: use the XI2 defines for class types.Peter Hutterer1-3/+3
Doesn't matter really, they have the same values anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17input: move DeviceChangedEvent conversion into eventconvert.cPeter Hutterer1-24/+121
The version in eventconvert.c was half broken and for some reason we ended up with a second version in exevents.c (which works). Move it over to where it belongs and call EventToXI2 instad of having a custom function for it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13dix: re-name internal eventToClassesChanged to eventToDeviceChangedPeter Hutterer1-3/+3
DeviceClassesChangedEvents (where this name comes from) have been replaced with DeviceChangedEvents. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13test: add XI2 eventconversion test for raw events.Peter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30input: switch internal event types to enums.Peter Hutterer1-1/+10
Use enum EventType instead of ints. This requires a load of default cases in various switch statements to silence compiler warnings. Reported-by: Aaron Plattner Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30include: untangle events.h from the SDK headers.Peter Hutterer1-1/+1
InternalEvents shouldn't be used anywhere outside the X server itself. Split up into events.h for opaque typedefs for the events needed by various headers and eventstr.h for the actual struct definitions. eventstr.h must only be included by code that requires internal events and is not part of the SDK. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-15dix: use sizeof(FP3232) instead of 2 * sizeof(int32_t).Peter Hutterer1-2/+2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-15Update to type-specific raw events - require inputproto 1.9.99.14.Peter Hutterer1-5/+20
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-14dix: switch to byte-counting functions.Peter Hutterer1-5/+5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-12input: include effective modifiers in device events.Peter Hutterer1-0/+2
Require inputproto 1.9.99.13 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-17Xi: namespace XI2 files.Peter Hutterer1-1/+1
Some files (notably those merged with MPX before XI2 came along) didn't use a 'xi' prefix. This patch changes all of them to meaningful names. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-03dix: set the device state for XI valuator events.Peter Hutterer1-0/+12
Valuator events need to include the device's state, while other device events need to include the state of the core devices. Reported-by: Thomas Jaeger Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-03dix: EventToCore must return BadMatch for proximity events.Peter Hutterer1-2/+2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>