summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Don't use the protocol defines for 2.0 versioning.Peter Hutterer2011-08-121-1/+1
| | | | | | | | | Otherwise we run into the old problem again: recompiling libXi against newer inputproto headers will appear to change the version support, potentially causing errors or other misbehaviours. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
* Add XI2 library-internal array offsets to XIint.hPeter Hutterer2011-08-021-0/+15
| | | | | | | | | | | | | | | | | These defines are currently defined in XI.h and XI2.h. Their only use is as offset into a library-internal array. Add them to XIint.h to have them where they belong. These defines do not have any effect on the protocol. They are simply offsets into an array for libXi-specific version checking. The defines are added to this header for readability, given that we cannot remove them from the protocol without potentially breaking clients (who should never use these anyway, but...) means they will never get hit. Future defines for these offsets will only be added to libXi, not the protocol. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Use Data, not Data32 in XIPassiveGrabDevicePeter Hutterer2011-06-031-2/+2
| | | | | | | | | Data32 takes and iterates over an array of longs, thus skipping every 4 bytes on LP64. Here we only have arrays of ints, use the normal Data macro instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
* Silence compiler warning due to differnent event conversion procsPeter Hutterer2011-05-192-4/+11
| | | | | | | | | | | | | XExtInt.c:161:5: warning: initialization from incompatible pointer type XSndExEv.c: In function 'XSendExtensionEvent': XSndExEv.c:84:8: warning: assignment from incompatible pointer type Xlib and libXi differ in the conversion functions. libXi takes an xEvent** and a num_events parameter since it may split an event into multiple xEvents. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Silence compiler warning in XListDProp.cPeter Hutterer2011-05-191-1/+1
| | | | | | | | | | XListDProp.c: In function 'XListDeviceProperties': XListDProp.c:72:9: warning: pointer targets in passing argument 2 of '_XRead32' differ in signedness /usr/include/X11/Xlibint.h:652:13: note: expected 'long int *' but argument is of type 'Atom *' Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Remove a few unused assignments.Peter Hutterer2011-05-051-3/+0
| | | | | | | | Found by static analyzer. Reported-by: Jeremy Huddleston <jeremyhu@apple.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
* XIChangeHierarchy: Return Success early if no actual changes are requested.Peter Hutterer2011-05-051-0/+3
| | | | | | | | | | Do the same for negative num_changes. Found by static analyzer. Reported-by: Jeremy Huddleston <jeremyhu@apple.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
* Allocate enough memory for raw events + extra data.Peter Hutterer2011-05-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Necessary space was calculated, but not actually used to allocate memory. As a result, valuator data would overwrite the allocated memory. ==4166== Invalid write of size 1 ==4166== at 0x4C29F04: memcpy (mc_replace_strmem.c:497) ==4166== by 0x8F39180: ??? (in /usr/lib/libXi.so.6.1.0) ==4166== by 0x7433D48: _XCopyEventCookie (in /usr/lib/libX11.so.6.3.0) ==4166== by 0x7425166: XPeekEvent (in /usr/lib/libX11.so.6.3.0) ==4166== by 0x49C3E3: process_key (x11_be.c:1065) ==4166== by 0x49EA5C: event_key_release (x11_be.c:2201) ==4166== by 0x49DD6E: x11_be_process_events (x11_be.c:1892) ==4166== by 0x4A38F4: x11_be_main_loop (x11_be.c:4353) ==4166== by 0x4A39E1: x11_be_thread_main (x11_be.c:4385) ==4166== by 0x87549C9: start_thread (pthread_create.c:300) ==4166== by 0x8A516FC: clone (clone.S:112) ==4166== Address 0x168afe80 is 0 bytes after a block of size 96 alloc'd ==4166== at 0x4C284A8: malloc (vg_replace_malloc.c:236) ==4166== by 0x8F390BD: ??? (in /usr/lib/libXi.so.6.1.0) ==4166== by 0x7433D48: _XCopyEventCookie (in /usr/lib/libX11.so.6.3.0) ==4166== by 0x7425166: XPeekEvent (in /usr/lib/libX11.so.6.3.0) ==4166== by 0x49C3E3: process_key (x11_be.c:1065) ==4166== by 0x49EA5C: event_key_release (x11_be.c:2201) ==4166== by 0x49DD6E: x11_be_process_events (x11_be.c:1892) ==4166== by 0x4A38F4: x11_be_main_loop (x11_be.c:4353) ==4166== by 0x4A39E1: x11_be_thread_main (x11_be.c:4385) ==4166== by 0x87549C9: start_thread (pthread_create.c:300) Reported-by: Roger Cruz <roger.cruz@virtualcomputer.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
* Fix XISelectEvents on 64 bits, strict alignement architectures.Matthieu Herrb2011-05-031-1/+1
| | | | | | | | Use Data() to send the struct xXIEventMask on the wire instead of Data32() which expects a pointer to a 64bits value on LP64 architectures. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Force alignment with sizeof(Atom) for XIButtonClassInfoPeter Hutterer2011-03-171-4/+14
| | | | | | | | | | | | | | The memory layout of an XIButtonClassInfo is [struct XIButtonClassInfo][mask][labels] With the mask being currently 4-byte aligned and labels a list of Atoms. On LP64, Atoms are 8 byte, leading to unaligned access for some mask lengths. Force the alignment to be sizeof(Atom). Reported-by: Christian Weisgerber <naddy@mips.inka.de> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Christian Weisgerber <naddy@mips.inka.de> Reviewed-by: Adam Jackson <ajax@redhat.com>
* Don't discard extra data for passive grabs.Peter Hutterer2011-03-081-1/+1
| | | | | | Failed modifier data was discarded, causing assertions inside xcb. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Rename XSetCPtr.c to XISetCPtr.c.Peter Hutterer2011-03-032-2/+2
| | | | | | | XISetClientPointer is an XI2.0 call and should be named accordingly. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
* Require XI 2 for all XI 2 calls.Peter Hutterer2011-03-0313-19/+19
| | | | | | | Each XI2 call should check _XiCheckExtInit for XI version 2.0 or higher. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
* Fix typo in comment.Peter Hutterer2011-02-231-1/+1
| | | | | Reported-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix invalid read in XIGrabDevice.Peter Hutterer2011-02-231-2/+2
| | | | | | | | | | | | | | | | | | | Miscalculation of length caused Data() to memcpy too many bytes. ==2865== Invalid read of size 1 ==2865== at 0x4A07480: memcpy (mc_replace_strmem.c:602) ==2865== by 0x544271E: XIGrabDevice (XIGrabDevice.c:69) ==2865== by 0x400B0A: main (gnome642481.c:56) ==2865== Address 0x642f614 is 0 bytes after a block of size 20 alloc'd ==2865== at 0x4A04896: calloc (vg_replace_malloc.c:418) ==2865== by 0x54425D3: XIGrabDevice (XIGrabDevice.c:65) ==2865== by 0x400B0A: main (gnome642481.c:56) SetReqLen() expects 4-byte units. Data() expects bytes. Gnome Bug 642481 <https://bugzilla.gnome.org/show_bug.cgi?id=642481> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Mark sourceid in Raw events as bug and force to 0..Peter Hutterer2011-02-231-0/+1
| | | | | | | | The protocol does not provide a source ID for raw events, so this value is always 0. It shouldn't really be there, but the past is so hard to change. Reported-by: Mark Dokter <dokter@icg.tugraz.at> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fill in mods/group->effective in XIQueryPointer()Carlos Garnacho2011-01-261-0/+3
| | | | | | | | the other XIModifierState/XIGroupState fields are being set correctly, but the "effective" field was being left as undefined memory. Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix passive grabs.Philipp Reh2011-01-111-1/+1
| | | | | | | | | | | _XIPassiveGrabDevice, which is called by alle the passive grab functions, wrongly returns an error when it shouldn't. The attached patch adds the missing "not" to properly test the error condition of _XReply. Signed-off-by: Philipp Reh <sefi@s-e-f-i.de> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* WireToEvent: Set display member of all events as wellDaniel Stone2010-12-141-0/+5
| | | | | | | All events were getting random uninitialised garbage for display; fix that. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Purge cvs tags.Jesse Adkins2010-10-061-2/+0
| | | | | Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix typo when converting raw events from the wire.Carlos Garnacho2010-10-071-1/+1
| | | | | | | | | | The raw values were being miscalculated, containing only the integral part of the FP3232, meanwhile normal valuators were mistakenly added the fractional part of its corresponding raw value. Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix build with gcc 2.95Matthieu Herrb2010-08-261-1/+1
| | | | | | | Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Always unlock display correctlyPauli Nieminen2010-07-131-18/+15
| | | | | | | | XISelectEvents and XIGetSelectedEvents were not unlocking display in all return paths. Reported-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
* Use single error path in XGetDeviceControlPauli Nieminen2010-07-131-14/+9
| | | | | | | | This reduces code duplication and fixes possible leak of d. d would leak if allocation of Device fails. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Julien Cristau <jcristau@debian.org>
* Use single error path in XGetFeedbackControlPauli Nieminen2010-07-131-14/+9
| | | | | | | | This reduces code duplication and fixes possible leak of f. f would leak if allocation of Feedback fails. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Julien Cristau <jcristau@debian.org>
* Use single error path in XQueryDeviceStatePauli Nieminen2010-07-131-15/+9
| | | | | | | | This reduces code duplication and fixes possible leak of data. data would leak if allocation of state fails. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Julien Cristau <jcristau@debian.org>
* Fix memory leak in XIGetSelectedEventsPauli Nieminen2010-07-131-0/+2
| | | | | | | mask_in was leaking for every successfull XIGetSelectedEvents. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Julien Cristau <jcristau@debian.org>
* Fix usage of uninitialized valuePauli Nieminen2010-07-131-0/+1
| | | | | | | | In error case length of extra data could be uninitialized. This would result randomly sized request later in function. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Julien Cristau <jcristau@debian.org>
* Purge macros NEED_EVENTS and NEED_REPLIESFernando Carrijo2010-07-084-8/+0
| | | | | | Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br> Acked-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Don't unlock the Display twice.Jamey Sharp2010-04-091-1/+0
| | | | | | | _xiQueryVersion's caller must wrap it in a LockDisplay/UnlockDisplay pair, so it shouldn't call UnlockDisplay itself. Signed-off-by: Jamey Sharp <jamey@minilop.net>
* Initialize extension with the right number of events.Peter Hutterer2010-02-223-11/+82
| | | | | | | | | | | | | If the server supports a lower XI version than the client, the Xlib-internal event vector may be smashed. See libXext for more details. http://cgit.freedesktop.org/xorg/lib/libXext/commit/?id=83fdb27df4ddc2fb088ddf2ec65f0db6b7c57287 This patch queries the server for the supported XI extension before registering the extension with Xlib. The number of events registered depends on the server version. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Julien Cristau <jcristau@debian.org>
* config: move CWARNFLAGS from configure.ac to Makefile.amGaetan Nadon2010-02-201-1/+2
| | | | | | | Compiler warning flags should be explicitly set in the makefile rather than being merged with other packages compiler flags. Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
* Don't export sizeDeviceClassType, size_classes and copy_classesJulien Cristau2009-09-291-5/+3
| | | | Signed-off-by: Julien Cristau <jcristau@debian.org>
* XQueryDeviceState: correct length of XValuatorStatePeter Hutterer2009-09-241-1/+2
| | | | | | | | | | | | The length is suppposed to be the complete class size, not just the struct size. Since XValuatorState is followed by multiple valuator values the size of the class is variable and dependent on the number of valuators. The server assembles the valuator state last. This bug is unlikely to affect clients as they should never go past the last class anyway. Tested-by: Thomas Jaeger Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* mask_len in XIGrabDevice is in 4-byte units (#23708)Peter Hutterer2009-09-071-2/+2
| | | | | | X.Org Bug 23708 <http://bugs.freedesktop.org/show_bug.cgi?id=23708> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Initialize send_event for cookie events. (#23609)Peter Hutterer2009-09-011-0/+6
| | | | X.Org Bug 23609 <http://bugs.freedesktop.org/show_bug.cgi?id=23609>
* Update XIWarpPointer to take doubles (inputproto >= 1.9.99.902)Peter Hutterer2009-08-241-8/+8
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Update library version for new symbols.Peter Hutterer2009-08-051-1/+1
| | | | | | | XI2 adds a whole lot of new symbols but leaves the existing ones. Minor bump only. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Remove leftover RCS tags.Peter Hutterer2009-08-041-2/+0
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Replace keysym grabs with keycode grabs.Peter Hutterer2009-07-221-4/+4
| | | | | | | | | | | | Keysym grabs are tricky to get right for applications that are more complicated than demo applications. otoh, we know keycode grabs are working. So let's go with keycode grabs for now and add keysym grabs later when we've sorted out the details. Requires inputproto 1.9.99.15 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix wrong raw_valuator wire copy, add fractional parts.Peter Hutterer2009-07-151-1/+3
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add flags to XIDeviceEvent and XIRawEvent.Daniel Stone2009-07-131-0/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Cater for new event-specific raw event types.Peter Hutterer2009-07-131-3/+10
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix broken formatting, remove empty comment.Peter Hutterer2009-07-131-2/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add the deviceid to XI2 property events.Peter Hutterer2009-07-131-0/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Plug memory leak in XIHierarchyEvent copy.Peter Hutterer2009-07-131-3/+3
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix segfault in XIDeviceChangedEvent wire parsing.Peter Hutterer2009-07-131-0/+2
| | | | | | Introduced by 225071e2e67fb65a0258397212f9826c9b25e078. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add event copying for raw events.Peter Hutterer2009-07-121-0/+38
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Switch to new XIEvent structures - no need for pointers anymore.Peter Hutterer2009-07-121-109/+70
| | | | | | | | This removes all those pointers from event structures that were just there due to the pre-cookie struct size limit. Pointers remaining are only those that are of variable length (e.g. masks and valuator states). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Remove XIFreeEventData - obsolete with cookie events.Peter Hutterer2009-07-122-71/+0
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>