summaryrefslogtreecommitdiff
path: root/include/input.h
AgeCommit message (Collapse)AuthorFilesLines
2013-11-14include: export key_is_down and friendsPeter Hutterer1-6/+6
VNC needs key_is_down to check if a key is processed as down before it simulates various key releases. Make it available, because I seriously can't be bothered thinking about how to rewrite VNC to not need that. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Keith Packard <keithp@keithp.com>
2013-10-14include: change grabtypes to start at 1Peter Hutterer1-3/+3
Avoid erroneous detection of an unset grabtype as CORE Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-10dix: XAllowEvents() on a touch event means accepting itPeter Hutterer1-0/+1
A sync grab is the owner once it gets events. If it doesn't replay the event it will get all events from this touch, equivalent to accepting it. If the touch has ended before XAllowEvents() is called, we also now need to send the TouchEnd event and clean-up since we won't see anything more from this touch. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-10dix: move EmitTouchEnd to touch.cPeter Hutterer1-0/+1
No functional changes, this just enables it to be re-used easier. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-03-06dix: only show the cursor if a window defines one (#58398)Peter Hutterer1-0/+5
e02f864fdf "Suppress cursor display until the first XDefineCursor() request" disabled cursor display a priori unless -retro is given. On a plain server, caling XFixesHideCursor() and XFixesShowCursor() would show the default root cursor, despite no client actually defining a cursor. Change the logic, disable CursorVisible by default and only enable it from the window's CWCursor logic. If no window ever defines a cursor, said cursor stays invisible. X.Org Bug 58398 <http://bugs.freedesktop.org/show_bug.cgi?id=58398> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Bastien Nocera <hadess@hadess.net> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2013-02-08Short-cut the input device cleanup process during AbortServer()Peter Hutterer1-0/+2
If we're about to abort, we're already in the signal handler and cannot call down to the default device cleanup routines (which reset, free, alloc, and do a bunch of other things). Add a new DEVICE_ABORT mode to signal a driver's DeviceProc that it must reset the hardware if needed but do nothing else. An actual HW reset is only required for some drivers dealing with the HW directly. This is largely backwards-compatible, hence the input ABI minor bump only. Drivers we care about either return BadValue on a mode that's not DEVICE_{INIT|ON|OFF|CLOSE} or print an error and return BadValue. Exception here is vmmouse, which currently ignores it and would not reset anything. This should be fixed if the reset is required. 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>
2013-02-08Xext: if a root window is given in XTestFakeInput, move to thatPeter Hutterer1-0/+1
For absolute events, if the client specifies a screen number offset the coordinates by that. And add a new flag so we know when _not_ to add the screen offset in GPE. Without this offset and the flag, GPE would simply add the offset of the current screen if POINTER_SCREEN is set. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2013-01-09dix: add resource type to touch listenersPeter Hutterer1-1/+1
Instead of guessing what resource type the listener is and what property to retrieve, store the resource type in the listener directly. Breaks XIT test cases: TouchGrabTestMultipleTaps.PassiveGrabPointerEmulationMultipleTouchesFastSuccession Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56557 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2013-01-09input: Record grab pointer in TouchListenerKeith Packard1-1/+1
This places a pointer to the grab related to a TouchListener directly in the TouchListener structure rather than hoping to find the grab later on using the resource ID. Passive grabs have resource ID in the resource DB so they can be removed when a client exits, and those resource IDs get copied when activated, but implicit grabs are constructed on-the-fly and have no resource DB entry. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-17Pass the event list through to the pointer barrier code to return itPeter Hutterer1-1/+2
Instead of having the pointer barrier code enqueue events separately from GetPointerEvents, pass the event list through and let it add to it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17barriers: Switch to an explicit hook for barrier constrainmentJasper St. Pierre1-0/+5
Rather than riding on the ConstrainCursorHarder hook, which has several issues, move to an explicit hook, which will help us with some RANDR interaction issues. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-20Don't use GetTouchEvents in EmitTouchEndThomas Jaeger1-0/+5
As before GetTouchEvents causes unwanted side effects. Add a new function GetDixTouchEnd, which generates a touch event from the touch point. We fill in the event's screen coordinates from the MD's current sprite position. Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-20Don't use GetTouchEvents when replaying eventsThomas Jaeger1-0/+2
GetTouchEvents has plenty of side effects such as moving the pointer or updating the master device, which we don't want to happen when replaying. The only reason for calling it was to generate a DCCE event, but GetTouchEvents doesn't even do that right (we might need a DCCE event even when replaying a master event, or clients could interpret valuator data incorrectly). This discussion is moot at the moment anyway, since DeliverTouchEvents doesn't appear to deliver DCCE events. Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> [Added call to processInputProc instead of direct call to DeliverTouchEvents] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-10-19End physically active touches when device is disabledChase Douglas1-0/+1
Otherwise: * We can't end the touches while device is disabled * New touches after enabling the device may erroneously be mapped to old logical touches 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-06-07dix: disable all devices before shutdownPeter Hutterer1-1/+1
f3410b97cf9b48a47bee3d15d232f8a88e75f4ef introduced a regression on server shutdown. If any button or key was held on shutdown (ctrl, alt, backspace are usually still down) sending a raw event will segfault the server. The the root windows are set to NULL before calling CloseDownDevices(). Avoid this by disabling all devices first when shutting down. Disabled devices won't send events anymore. Master keyboards must be disabled first, otherwise disabling the pointer will trigger DisableDevice(keyboard) and the keyboard is removed from the inputInfo.devices list and moved to inputInfo.off_devices. A regular loop through inputInfo.devices would thus jump to off_devices and not recover. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-14dix: Remove redundant declarations.Michal Suchanek1-0/+3
Signed-off-by: Michal Suchanek <hramrach@gmail.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-04-18Rename TouchEnsureSprite to TouchBuildSprite and event type checksChase Douglas1-2/+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-18Split out helper function TouchListenerAcceptReject()Chase Douglas1-0/+2
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-03-22Xi: Fix TouchEnd to TouchUpdate change for one accepted grabChase Douglas1-1/+2
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-21Introduce a consistent coding styleKeith Packard1-379/+320
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-08Implement touch early acceptChase Douglas1-0/+2
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-0/+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-08Store window pointer in touch listener recordChase Douglas1-1/+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>
2011-12-21dix: Remove touch grabs if the grab disappearsDaniel Stone1-0/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21dix: hook up passive grabs and pointer emulated passive grabsPeter Hutterer1-0/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21dix: add touch to pointer event conversion helperPeter Hutterer1-0/+2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21dix: add real_event parameter to ActivatePassiveGrabPeter Hutterer1-1/+1
For touch events with pointer emulation, the event that triggers the grab (the pointer event) is not the same as the actual event (the touch event). For replaying, we need to store the real event then. No effective changes at this point, for the current caller event and real_event are identical. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21dix: add TouchResourceIsOwner helper functionPeter Hutterer1-0/+1
The first listener in the sequence is the owner of the touch sequence. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21dix: add helper functions for adding/removing touch listenersPeter Hutterer1-1/+4
The DIX will call TouchSetupListeners once for a new touch. After that the listener list remains static, with listeners only dropping out when they either reject the grab or disappear. Exception: if grabs activate they are prefixed to the listeners. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21dix: add TouchGetPointerEventType helper functionChase Douglas1-0/+1
Returns the respective pointer event type for a given touch event type. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21dix: add helper functions to build up/verify the sprite traceDaniel Stone1-0/+4
Touch events' sprite trace stays the same for the duration of the touch sequence. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21dix: add touch event history helper functionsPeter Hutterer1-0/+4
If touch client has not registered for ownership events and a grab above that client is rejected, the client needs to receive the complete event history. The history currently doesn't really do fancy overflow handling. We assume that the first TOUCH_HISTORY_SIZE events are the important ones and anything after that is dropped. If that is a problem, fix the client that takes > 100 event to decide whether to accept or reject. Events marked with TOUCH_CLIENT_ID or TOUCH_REPLAYING must not be stored in the history, they are events created by the DIX to comply with the protocol. Any such event should already be in the history anyway. A fixme in this patch: we don't have a function to actually deliver the event yet. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-20dix: add GetTouchOwnership event APIDaniel Stone1-0/+8
No callers yet. This API is not to be used by drivers, it's an API for the DIX which will create ownership events mainly on touch acceptance/rejection. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-20dix: add DIX API to create touchpointsPeter Hutterer1-0/+5
The DIX touchpoints are the ones used for event processing. 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-19dix: add helper functions to create DDX touch recsPeter Hutterer1-0/+5
DDX touch points are the ones that keep records of the driver-submitted touchpoints. They're unaffected by the grab state and terminate on a TouchEnd submitted by the driver. The client ID assigned is server-global. Since drivers usually submit in the SIGIO handler, we cannot allocate in the these functions. 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-19input: add a TouchClassRec to the devicesDaniel Stone1-0/+27
These structs will be used to store touch-related data, events and information. Drivers must call InitTouchClassDeviceStruct to set up a multi-touch capable device. Touchpoints for the DDX and the DIX are handled separately - touchpoints submitted by the driver/DDX will be stored in the DDXTouchPointInfoRec. Once the touchpoints are processed by the DIX, new TouchPointInfoRecs are created and stored. This process is already used for pointer events with the last.valuators field. Note that this patch does not actually add the generation of touch events, only the required structs. TouchListeners are (future) recipients of touch or emulated pointer events. Each listener is in a state, depending which event they have already received. The type of listener defines how the listener got to be one. Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-19Add the touch input API stubsDaniel Stone1-0/+14
xf86PostTouchEvent is the driver API to submit touch events to the server. This API doesn't do anything yet though but now we can at least bump the API. For valuators, drivers should use the existing xf86InitValuatorAxisStruct function. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-16include: add a bunch of flags for GetTouchEvent processingPeter Hutterer1-0/+9
TOUCH_CLIENT_ID is set if the touch was generated from a client ID instead of a DDX/driver touch ID. i.e. submitted by the dix. TOUCH_END is a special flag that's required to force the touch to end. Since the protocol with grab replaying and pointer emulation is rather complex, it's quite hard to know otherwise when a touch sequence should really die. The others do what it says on the imaginary box. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13dix: move event filter retrieval helpers to inpututils.cPeter Hutterer1-1/+0
No functional changes Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13dix: switch EventIsDeliverable to take the event type onlyPeter Hutterer1-2/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13input: replace GRABTYPE_* with the InputLevel enumsPeter Hutterer1-0/+6
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-13dix: Split ActivatePassiveGrab() from CheckPassiveGrab()Chase Douglas1-0/+2
The changed logic means we don't require the explicit grab = NULL setting and early exit anymore. Not 100% of it, but if we see that message pop up in a log we know it's broken. 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-12-13dix: move EventDeliveryState into a header file, we'll need it elsewherePeter Hutterer1-0/+7
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-10include: add GetXI2MaskByte and GetXI2EventFilterMask to headersPeter Hutterer1-0/+3
This is needed for touch event processing. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09Add a new XI2Mask struct and a few helper functions.Peter Hutterer1-0/+1
The current XI2 mask handling is handy for copying (fixed size arrays) but a pain to deal with otherwise. Add a struct for XI2 masks and the required accessors. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-29dix: rename GetWindowXI2Mask to WindowXI2MaskIssetPeter Hutterer1-1/+1
And let it return a boolean value, that's all the callers need anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-23Fix gcc -Wwrite-strings warnings in various extensionsAlan Coopersmith1-2/+2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-09include: export GetProximityEvents and QueueProximityEventsPeter Hutterer1-2/+2
This is mainly needed for consistency with GetPointerEvents and friend. No-one seems to actually need this function from outside the usual DDXs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-02Merge remote-tracking branch 'whot/two-screen-coordinates'Keith Packard1-0/+1