summaryrefslogtreecommitdiff
path: root/dix
AgeCommit message (Collapse)AuthorFilesLines
2012-04-18Update currentTime in dispatch loopChase Douglas1-0/+3
A request, like input device grabs, may check a request timestamp against currentTime. It is possible for currentTime to lag a previously sent event timestamp. If the client makes a request based on such an event timestamp, the request may fail the validity check against currentTime unless we always update the time before processing the request. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18Update device state including when touch record does not existChase Douglas1-8/+0
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-18Check other clients' core masks properly when adding touch listenerChase Douglas1-4/+4
The current code checks the core event mask as though it were an XI 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: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18Create a new dix touch record for an emulated touch with no listenersChase Douglas1-0/+5
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-12/+2
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-18When activating an explicit grab, update owning listenerChase Douglas1-0/+33
Pointer passive grabs may be changed by the grabbing client. This allows for a selecting client to change an implicit grab to an active grab, which is the mechanism used for pop-up windows like application menus. We need to do the same thing with touches. If the grabbing client is the owner of a touch sequence, change the listener record to reflect the new grab. If the grabbing client is not the owner, nothing changes for the touch. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18Fix copy/paste error from before git history in UpdateCurrentTimeIf()Chase Douglas1-1/+1
See UpdateCurrentTime() for reference. I don't know what bug this might trigger, but it wouldn't hurt to fix this. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18When deactivating an explicit pointer grab, reject all grabs on touchesChase Douglas1-0/+11
Explicit pointer grabs are placed at the head of the touch listener array for pointer emulated touches. If the grab is deactivated, we must remove it from all touches for the device. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18Split out helper function TouchListenerAcceptReject()Chase Douglas2-34/+41
This will be used for accepting and rejecting touches in the future. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-16Use touch state when querying pointer through core protocolChase Douglas1-2/+1
QueryPointer is part of the core protocol. As such, it knows nothing about touch devices. Touches are converted to button 1 press, pointer motion, and button 1 release for core clients, so we should ensure the pointer state mask has button 1 set when XQueryPointer is used. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-12dix: don't BUG_WARN for button events from button-only deviceDaniel Kurtz1-1/+1
Events from button-only devices still need coordinates, and they get them from scale_to_desktop(). Therefore, a dev without valuators is not a bug. However, a dev with valuators, but less than two of them still is a bug. This was noticed when unplugging a "Creative Technology SB Arena Headset", which has some BTNs and some KEYs, but no REL or ABS valuators. It emits [BTN_3] = 0 on unplug, which would trigger the BUG_WARN. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-22Merge branch 'per-device-sync-counters' into for-keithPeter Hutterer4-8/+19
2012-03-22Xext: Add per-device SyncCountersPeter Hutterer1-0/+8
Previously, we only had one idle alarm that was triggered for all devices, whenever the user used any device, came back from suspend, etc. Add system SyncCounters for each device (named "DEVICEIDLETIME x", with x being the device id) that trigger on that device only. This allows for enabling/disabling devices based on interaction with other devices. Popular use-case: disable the touchpad when the keyboard just above the touchpad stops being idle. 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-22Change lastDeviceIdleTime to be per-devicePeter Hutterer3-8/+11
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-22Merge branch 'dtrace-input-abi' into for-keithPeter Hutterer3-1/+50
2012-03-22dix: add dtrace probes to input APIPeter Hutterer3-1/+50
For driver debugging, it is helpful to know whether the driver has actually submitted an event to the server. dtrace hooks can help here. Note that GetPointerEvents and friends may also be triggered by the server for other emulated devices, some care must be taken when analysing the results. Additional difficulty: proximity events have a run-time assigned type, so this may make automatic detection a tad harder. If in doubt, go for any event > 64 since the only two that can have that value are ProximityIn and ProximityOut. An example systemtap script is below: # Compile+run with # stap -g xorg.stp /usr/bin/Xorg # function print_valuators:string(nvaluators:long, mask_in:long, valuators_in:long) %{ int i; unsigned char *mask = (unsigned char*)THIS->mask_in; double *valuators = (double*)THIS->valuators_in; char str[128] = {0}; char *s = str; #define BitIsSet(ptr, bit) (((unsigned char*)(ptr))[(bit)>>3] & (1 << ((bit) & 7))) s += sprintf(s, "nval: %d ::", (int)THIS->nvaluators); for (i = 0; i < THIS->nvaluators; i++) { s += sprintf(s, " %d: ", i); if (BitIsSet(mask, i)) s += sprintf(s, "%d", (int)valuators[i]); } sprintf(THIS->__retvalue, "%s", str); %} probe process(@1).mark("input__event") { deviceid = $arg1 type = $arg2 detail = $arg3 flags = $arg4 nvaluators = $arg5 str = print_valuators(nvaluators, $arg6, $arg7) printf("Event: device %d type %d detail %d flags %#x %s\n", deviceid, type, detail, flags, str); } Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-03-22dix: set raw event values before adding up relative values (#46976)Peter Hutterer1-4/+5
Regression introduced in 4e52cc0ef48145134cd58d357fb7289e6f8bb709 Raw event values are values as-is from the driver, modified only be transformation or acceleration. 4e52cc caused the mask to be updated from relative to absolute coordinates which then got written into the raw events. Move the raw event update into the respective branches for absolute/relative events. X.Org Bug 46976 <http://bugs.freedesktop.org/show_bug.cgi?id=46976> 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> Tested-by: Sven Arvidsson <sa@whiz.se> Reviewed-by: Simon Thum <simon.thum@gmx.de>
2012-03-22dix: fix compiler warning "unused variable 'scr'"Peter Hutterer1-1/+0
getevents.c: In function 'updateSlaveDeviceCoords': getevents.c:326:15: warning: unused variable 'scr' [-Wunused-variable] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-22Use a new sprite trace for indirect touches when all touches have physically ↵Chase Douglas1-1/+2
ended All touches of an indirect device, such as a trackpad, are sent to the same window set. When there are no active touches, a new window set is created; otherwise, the window set of an existing touch is copied. The current code checks for any logically active touches. This includes touches that have physically ended but are still logically active due to unhandled touch grabs. Instead, we want a new window set whenever there are no physically active touches. This change skips over logically active but pending end touches, which are touches that have physically ended. 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-22dix: IsFloating() on master devices is always falsePeter Hutterer1-1/+1
There are a few subtle bugs during startup where IsFloating() returns true if the device is a master device that is not yet paired with its keyboard device. Force IsFloating() to always return FALSE for master devices, that was the intent after all and any code that relies on the other behaviour should be fixed instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2012-03-22dix: when rescaling from master, rescale from desktop dimensions (#46657)Peter Hutterer1-2/+4
master->last.valuators[] is in desktop dimensions, so use those as rescale axis ranges, not the screen. Otherwise, a rescale on any screen not the top-left will cause out-of-bounds coordinates which will always map to the bottom-right screen, causing the device to be stuck on that screen. X.Org Bug 46657 <http://bugs.freedesktop.org/show_bug.cgi?id=46657> 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 Stone3-12/+12
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 Packard35-16700/+15152
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-27dix: avoid NULL-pointer dereference on button-only devices (#38313)Peter Hutterer1-4/+15
And for such devices simply take the last.valuators[] which must be valid at all times anyway. UpdateSlaveDeviceCoords takes care of that. X.Org Bug 38313 <http://bugs.freedesktop.org/show_bug.cgi?id=38313> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-02-22Revert "dix: don't XWarpPointer through the last slave anymore (#38313)"Jeremy Huddleston1-14/+7
This reverts commit 2bfb802839688ecf328119c4c6979390fc60348d. This commit caused a regression. See: http://xquartz.macosforge.org/trac/ticket/517#comment:10 Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-22Merge remote-tracking branch 'whot/for-keith'Keith Packard1-0/+2
2012-02-14dix: reset last.scroll when resetting the valuator (#45611)Peter Hutterer1-0/+2
last.scroll remained on the last-submitted scrolling value but last.valuator was changed whenever the slave device changed. The first scrolling delta after a switch was then calculated as (last.scroll - new abs value), causing erroneous scrolling events. Test case: - synaptics with a scrolling method enabled, other device with 3+ axes (e.g. wacom) - scroll on touchpad - use other device - scroll on touchpad The second scroll caused erroneous button press/release events. X.Org Bug 45611 <http://bugs.freedesktop.org/show_bug.cgi?id=45611> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-02-11Merge remote-tracking branch 'alanc/master'Keith Packard1-9/+9
2012-02-08dix: fix an out-of-memory crashBenjamin Otte1-0/+3
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-08Implement touch early acceptChase Douglas1-5/+4
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-08Implement early touch rejectChase Douglas1-1/+8
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-6/+12
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-0/+45
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-08Store window pointer in touch listener recordChase Douglas1-6/+10
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-08Revert "dix: deduplicate callers of DeliverDeviceEvents in DeliverGrabbedEvents"Peter Hutterer1-10/+8
This call was supposed to have no functional changes but in some cases DeliverDeviceEvents() was called with a uninitialised win variable. Revert, safer than trying to sort this out otherwise. This reverts commit 6eff14a789341d366b3013c5aa020e959c954651. Reported-by: Mathieu Taillefumier <mathieu.taillefumier@free.fr> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2012-02-03Namespace list api to reduce conflicts with similar system headersAlan Coopersmith1-9/+9
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>
2012-01-24Don't set X and Y valuators for indirect touch eventsChase Douglas1-1/+1
For expediency, it made sense to always have the X and Y axes set for direct touch device event propagation. The last X and Y values are stored internally. However, indirect device touch event propagation does not depend on the touch's X and Y values. Thus, we don't need to set the values for every indirect touch event. On top of this, the previous X and Y values aren't stored for indirect touches, so without this change the axes get erroneously set to 0. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-24UngrabAllDevices: Don't kill clients if not told toDaniel Stone1-1/+2
The kill_client argument to UngrabAllClients specifies if we want to kill the client holding the grab or just deactivate the grab. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reported-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Cyril Brulebois <kibi@debian.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-24Only update pointer motion data for pointer emulated touch eventsChase Douglas1-2/+6
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-01-24Only scale direct device touch coordinatesChase Douglas1-1/+6
Indirect touch devices provide valuator values in pure device coordinates. They also don't need to be fixed up for screen crossings. 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-01-13Use event time instead of CurrentTime for grab timesChase Douglas1-1/+2
When {XI,X,}AllowEvents is called, the timestamp is compared against the grab time to ensure that the request pertains to the current grab in the server. While many clients may use CurrentTime (client-side), the timestamp of the event causing the grab is also valid. This change ensures that the server's notion of the grab time is the time of the event that activated the grab rather than the time that the grab is actually activated. This bug was exposed through nested touch then pointer grabs. 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-01-13dix: Update pointer limits for floating devices too (#43635)Peter Hutterer1-1/+1
When the screen is restructured, the pointer limits need to be reset for floating slave devices as well, not just for master pointers. Only skip devices that don't have a cursor (attached slaves and keyboard) Bug reproducer: float an absolute slave device, rotate the screen - the device is now confined to a section of the screen only. X.Org Bug 43635 <http://bugs.freedesktop.org/show_bug.cgi?id=43635> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-01-12Revert "dix: Extend initial connection handshake for forwarding proxies"Keith Packard1-9/+3
This reverts commit 78fa121f4097d29458e5453c13473595df06e26e. ABI change pended for 1.13
2012-01-09Merge remote-tracking branch 'whot/multitouch'Keith Packard1-0/+4
2012-01-09Revert "dix: don't return BadMatch from GetProperty (#23562)"Chris Halse Rogers1-1/+1
This reverts commit f04fe06ae244b851b38be824b1a80f2f8a030591. dixLookupWindow no longer returns BadMatch. No other caller was checking for it, so this problem is now fixed in the utility function. Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-01-09dix: Return BadWindow rather than BadMatch from dixLookupWindowChris Halse Rogers1-1/+9
dixLookupWindow uses dixLookupDrawable internally, which returns BadMatch when the XID matches a non-Window drawable. Users of dixLookupWindow don't care about this, just that it's not a valid Window. This is a generalised version of the fix for X.Org Bug 23562, where GetProperty was incorrectly returning BadMatch. Auditing other window requests, all that I checked would incorrectly return BadMatch in these circumstances. An incomplete list of calls that could incorrectly return BadMatch is: ListProperties, SetSelectionOwner, {Destroy,Map,Unmap}{,Sub}Window. None of the callers of dixLookupWindow, except for GetProperty, check for BadMatch Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-01-09Merge commit '777bf90abeac37087a3d0538b847742523d5acf2'Keith Packard2-12/+21
2012-01-06dix: Tune dixLookupDrawable for successAdam Jackson1-4/+3
The vast vast vast majority of resource lookups are successful. Move some work to the error paths so we don't punish success. Before: 40000000 trep @ 0.0009 msec (1109091.3/sec): PutImage 10x10 square 60000000 trep @ 0.0005 msec (2072652.2/sec): ShmPutImage 10x10 square After: 40000000 trep @ 0.0009 msec (1148346.9/sec): PutImage 10x10 square 60000000 trep @ 0.0005 msec (2091666.1/sec): ShmPutImage 10x10 square Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06dix: Tune dtrace hooks around DispatchAdam Jackson1-5/+9
Don't call LookupMajorName if the hooks aren't active, it's quite expensive. Before: 40000000 trep @ 0.0009 msec (1087458.5/sec): PutImage 10x10 square 60000000 trep @ 0.0005 msec (2012238.6/sec): ShmPutImage 10x10 square After: 40000000 trep @ 0.0009 msec (1109091.3/sec): PutImage 10x10 square 60000000 trep @ 0.0005 msec (2072652.2/sec): ShmPutImage 10x10 square Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06dix: Extend initial connection handshake for forwarding proxiesAdam Jackson1-3/+9
Forwarding proxies like sshd will appear to be local, even though they aren't really. This leads to weird behaviour for extensions that truly require running under the same OS services as the client, like MIT-SHM and DRI2. Add two new legal values for the initial connection's byteOrder field, 'r' and 'R'. These act like 'l' and 'B' respectively, but have the side effect of forcing the client to be treated as non-local. Forwarding proxies should attempt to munge the first packet of the connection accordingly; older servers will reject connections thusly munged, so the proxy should fall back to passthrough if the munged connection attempt fails. Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>