summaryrefslogtreecommitdiff
path: root/Xi
AgeCommit message (Collapse)AuthorFilesLines
2012-08-06Fix up formatting of initializers for arrays of structsAlan Coopersmith2-145/+144
The indenter seems to have gotten confused by initializing arrays of structs with the struct defined inline - for predefined structs it did a better job, so match that. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-08-05XIChangeDeviceProperty: free newly allocated prop when SetProperty failsAlan Coopersmith1-0/+2
Reported by parfait 1.0: Error: Memory leak (CWE 401) Memory leak of pointer 'prop' allocated with XICreateDeviceProperty(property) at line 774 of Xi/xiproperty.c in function 'XIChangeDeviceProperty'. 'prop' allocated at line 700 with XICreateDeviceProperty(property). prop leaks when handler != NULL at line 768 and handler->SetProperty != NULL at line 769 and checkonly != 0 at line 772 and rc != 0 at line 772. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-08-05Do sent TouchEnd to listeners that don't own an accepted touchDaniel d'Andrada1-0/+6
When the owner of a touch accepts it, the other listeners must receive a TouchEnd. Even though there's code implementing the logic above in ProcessTouchOwnershipEvent(), DeliverTouchEndEvent() was refusing to send those TouchEnd events in this situatuation. Signed-off-by: Daniel d'Andrada <daniel.dandrada@canonical.com> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-10Xi: Remove dead Device{Enter,Leave}WindowMaskDaniel Stone1-4/+2
These were an unused remnant of earlier MPX work; their only users got cleared out in dc153271, but the mask declarations remained. Remove them, and move DevicePropertyNotify's mask up to be contiguous with the rest of the range. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-09Add a common ARRAY_SIZE macro to dix.hDaniel Stone1-2/+0
Does what it says on the box, replacing those from Xi/ and glx/. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Cyril Brulebois <kibi@debian.org> 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> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-09Use C99 designated initializers in extension EventsAlan Coopersmith4-41/+41
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09Use C99 designated initializers in Xinput RepliesAlan Coopersmith28-174/+226
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09Fix more poorly indented/wrapped comments & codeAlan Coopersmith2-9/+9
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09Remove unneccesary casts from WriteToClient callsAlan Coopersmith28-36/+36
Casting return to (void) was used to tell lint that you intended to ignore the return value, so it didn't warn you about it. Casting the third argument to (char *) was used as the most generic pointer type in the days before compilers supported C89 (void *) (except for a couple places it's used for byte-sized pointer math). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-04Xi: extend PropagateMask to EMASKSIZEPeter Hutterer1-1/+1
Number of devices is 2 + MAXDEVICES, with index 0 and 1 reserved for XIAll{Master}Devices. At the current size, PropagateMask would be overrun in RecalculateDeviceDeliverableEvents(). Found by Coverity. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-06-07Xi: drop forced unpairing when changing the hierarchyPeter Hutterer1-6/+0
Devices are unpaired as needed on DisableDevice now. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-07Replace a few BUG_WARN with BUG_RETURN_VALPeter Hutterer1-15/+10
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-24Xi: make stub DeleteInputDeviceRequest call RemoveDeviceJulien Cristau1-0/+1
DeleteInputDeviceRequest is called from CloseDownDevices on reset, so call RemoveDevice to avoid leaking devices in Xvfb/Xnest/Xwin. Signed-off-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-17Xi: fix "discards ''const' qualifier" warningsPeter Hutterer2-3/+6
extinit.c: In function 'XInputExtensionInit': extinit.c:1301:29: warning: assignment discards 'const' qualifier from pointer target type [enabled by default] extinit.c:1303:36: warning: assignment discards 'const' qualifier from pointer target type [enabled by default] property.c: In function 'XIChangeDeviceProperty': xiproperty.c:757:39: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-17Xi: fix "shadows previous local" warningsPeter Hutterer2-33/+11
exevents.c: In function 'DeepCopyFeedbackClasses': exevents.c:272:20: warning: declaration of 'classes' shadows a previous local [-Wshadow] exevents.c:245:16: warning: shadowed declaration is here [-Wshadow] (and a few more like this) exevents.c: In function 'DeliverTouchEmulatedEvent': exevents.c:1442:27: warning: declaration of 'win' shadows a parameter [-Wshadow] exevents.c:1404:55: warning: shadowed declaration is here [-Wshadow] exevents.c:1475:28: warning: declaration of 'listener' shadows a parameter [-Wshadow] exevents.c:1403:62: warning: shadowed declaration is here [-Wshadow] xiselectev.c: In function 'ProcXISelectEvents': xiselectev.c:178:34: warning: declaration of 'dummy' shadows a previous local [-Wshadow] xiselectev.c:91:18: warning: shadowed declaration is here [-Wshadow] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-17dix: Move DeviceFocusEvent from Xi into enterleave.cPeter Hutterer1-234/+0
This is only called from the enterleave implementation, so move it and its helper functions to there. No functional changes. Fixes build error introduced in 31174565ec0090b4c03c9334c82878be2455f938 if building with '-Werror=implicit-function-declaration' Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-05-14Xi: Remove redundant declaration.Michal Suchanek1-6/+0
Signed-off-by: Michal Suchanek <hramrach@gmail.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-03Report touch emulated buttons in XIQueryPointer for XI 2.1 and earlierChase Douglas1-0/+14
XInput 2.1 and earlier clients do not know about touches. We must report touch emulated button presses for these clients. For later clients, we only report true pointer button presses. 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>
2012-05-02Report logical button state in ProcXIQueryPointerChase Douglas1-9/+4
Physical button state is usually meaningless to an X client. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-01Xi: return BadValue on XIQueryVersion if the version is less than first callPeter Hutterer1-20/+21
Clients that use plugin systems may require multiple calls to XIQueryVersion from different plugins. The current error handling requires client-side synchronisation of version numbers. The first call to XIQueryVersion defines the server behaviour. Once cached, always return that version number to any clients. Unless a client requests a version lower than the first defined one, then a BadValue must be returned to be protocol-compatible. Introduced in 2c23ef83b0e03e163aeeb06133538606886f4e9c Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-04-18Update device state including when touch record does not existChase Douglas1-3/+3
If a touch is physically active, the pointer core state should reflect that the first button is pressed. Currently, this only occurs when there are active listeners of the touch sequence. By moving the device state updating to the beginning of touch processing we ensure it is updated according to the processed physical state no matter what. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18Ensure touch is ended when last listener is rejectedChase Douglas1-8/+2
Currently, the touch is only logically ended if the touch has physically ended. If the touch hasn't physically ended, the touch record is never ended. If there aren't any more listeners, we don't need to keep the dix touch record around any more. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18Create a new dix touch record for an emulated touch with no listenersChase Douglas1-0/+28
As a special case, if a still physically active pointer emulated touch has no listeners and the device is explicitly grabbed for pointer events, create a new dix touch record for the grab only. This allows for clients to "hand off" grabs. For example, when dragging a window under compiz the window decorator sees the button press and then ungrabs the implicit grab. It then tells compiz to grab the device, and compiz then moves the window with the pointer motion. This is racy, but is allowed by the input protocol for pointer events when there are no other clients with a grab on the device. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18Rename TouchEnsureSprite to TouchBuildSprite and event type checksChase Douglas1-2/+4
The function will be used for building a sprite for pointer emulation after an explicit device grab. This commit refactors the code so that TouchBuildSprite will function with any event type and moves the checks to the caller. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18Don't deactivate implicit pointer grab on fake touch end eventChase Douglas1-0/+1
Fake touch end events are generated by touch acceptance and rejection. These should not cause implicit pointer grabs to be deactivated. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18End a pointer emulated touch event only on a "real" end eventChase Douglas1-1/+2
Fake end events are generated by touch acceptance or rejection. These should not end the touch point. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18On touch accept, only process end event for owner if it has seen the endChase Douglas1-1/+10
We still need to generate the touch ownership event to process the ending of the touch event in the case where the owner has the end already. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18Accept touch sequence for pointer listener after second event deliveryChase Douglas1-0/+6
This is a bit of unimplemented code for touchscreen pointer emulation. A pointer grabbing client currently never accepts the touch sequence. The sequence must be accepted once any touch-derived event is irrevocably delivered to a client. The first pointer event, derived from a touch begin event, may be caught in a sync grab and then replayed. This is essentially a revocable delivery of an event. Thus, we must wait till a non-begin event is delivered. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18Only set XI2 mask if pointer emulation is for XI2 clientChase Douglas1-1/+2
The current code returns a reference to memory that may not actually be an XI2 mask. Instead, only return a value when an XI2 client has selected for events. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18Check core event mask properly for pointer emulated touch eventsChase Douglas1-6/+12
The current code checks the core event mask as though it were an XI2 mask. This change fixes the checks so the proper client and event masks are used. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-16Ensure sequential touches are pointer emulated sequentiallyChase Douglas1-1/+74
Issue: * Two sequential touches (i.e. down, up, down, up) * Both are grabbed by a touch grab * Both have a second listener in the form of a pointer grab or selection * The second and first touches are rejected in that order The first touch must be pointer emulated before the second touch, so the second touch must be paused until the first touch is rejected or accepted and all events are delivered to pointer clients. This change ensures all pointer emulated events are emitted sequentially. It necessarily imposes a delay on further touch events when pointer grabs and selections are used, but there is no way around it. 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>
2012-04-16Update event type when delivering end event to a pointer listenerChase Douglas1-0/+7
Just like when we deliver to a touch listener, we must convert a touch end event to an update event for further clients. This also ensures that the touch record is not deleted at the end of ProcessTouchEvent(). 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>
2012-04-16Don't update listener after deactivating implicit pointer grabChase Douglas1-1/+3
After the pointer grab is deactivated, the touch listener record is updated at the end of DeliverTouchEmulatedEvent. However, the touch record is ended when the grab is deactivated, so the update to the listener record is in an array of memory that has been freed. 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>
2012-04-11Xi: fix XITouchClass sourceid assignmentPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-04-05Implement passive touch ungrabbingChase Douglas1-2/+7
Whoops. Forgot to implement this. The code currently generates an error due to the unhandled grab type. X.Org Bug 48069 <https://bugs.freedesktop.org/show_bug.cgi?id=48069> Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-03-22Change lastDeviceIdleTime to be per-devicePeter Hutterer1-1/+1
Preparation work for per-device idle counters. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: James Jones <jajones@nvidia.com>
2012-03-22Xi: Fix TouchEnd to TouchUpdate change for one accepted grabChase Douglas1-8/+16
If there is only one listener of a touch, the listener is a grab, and is accepted before the touch has ended, the current code will not end the touch record when the touch does end. This change adds a listener state for when a touch is accepted but has not yet ended. We now keep the touch record alive in this state, but end it when the touch ends. 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>
2012-03-22Xi: prohibit multiple XIQueryVersion requests with different versionsPeter Hutterer1-0/+9
Return BadValue if major or minor differs on the second call. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-21Indentation: Change '& stuff' to '&stuff'Daniel Stone9-28/+28
If the typedef wasn't perfect, indent would get confused and change: foo = (SomePointlessTypedef *) &stuff[1]; to: foo = (SomePointlessTypedef *) & stuff[1]; Fix this up with a really naïve sed script, plus some hand-editing to change some false positives in XKB back. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-21Introduce a consistent coding styleKeith Packard102-3500/+3351
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-15Keep virtual core pointer touch class around if new slave doesn't have oneChase Douglas1-6/+3
The VCP may have active touch grabs. The touch records must be kept so these touch grabs may be accepted/rejected in the future. This means the touch class list will not represent the touch class of the attached slave device if it does not have a touch class, but we already were breaking that assumption by keeping a separate touches array for the VCP. 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>
2012-02-15Don't clobber virtual core pointer touches array lengthPeter Hutterer1-5/+13
The VCP has its own touches array, don't overwrite it when the class is copied from the SD to the master. Reported-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-02-15Don't dereference a touch after it has been ended when punting to next ownerChase Douglas1-0/+1
In this case, we have ended the touch because the last owner has rejected it. We need to return from the function right now so we don't attempt to dereference another touch client for early acceptance processing. Signed-off-by: Chase Douglas <chase.douglas@ubuntu.com> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-15Focus event button state must show the logical buttons, not physical buttonsChase Douglas1-1/+1
Similar to the fix in fcda98c48610fd507ca0b89c6006a5497d9dc1c9. This ensures we show the correct logical state of the buttons in device focus events too. 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>
2012-02-09Xi: handle new XIAllowEvents request in inputproto 2.1.99.6Peter Hutterer1-6/+35
grab_window and touchid were removed from the struct for ABI compatibility reasons, we need to pull in the new, XI 2.2-specific struct. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-08Implement touch early acceptChase Douglas1-1/+26
This doesn't really implement early accept as it should. Ideally, the server should send end events to all subsequent touch clients as soon as an early accept comes in. However, this implementation is still protocol compliant. We can always improve it later. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-08Check for proper window ID when processing touch allow requestsChase Douglas1-1/+1
Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-08Move AllowTouch to dix/touch.c, and rename to TouchAcceptRejectChase Douglas1-44/+2
Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-08Export TouchEventRejected as TouchRejectedChase Douglas1-11/+27
This function is mostly correct for early reject usage. With a small change to pass the client resource explicitly and making the TouchOwnership event optional, it is usable for all rejection scenarios. This change exports it for use outside Xi/exevents.c and modifies the name accordingly. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-08Factor out TouchEnd generation and deliveryChase Douglas1-66/+37
The server often needs to generate and deliver TouchEnd events for circumstances including touch grab acceptance and rejection. This change refactors the code so it can be used more easily. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>