Commit Graph

879 Commits

Author SHA1 Message Date
Peter Hutterer 6764471901 Xi: don't deliver TouchEnd to a client waiting for TouchBegin (#55738)
If a client is still waiting for the TouchBegin, don't deliver a TouchEnd
event.

X.Org Bug 55738 <http://bugs.freedesktop.org/show_bug.cgi?id=55738>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Thomas Jaeger <thjaeger@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-10-29 13:15:50 +10:00
Peter Hutterer 3018f9c1e5 Xi: set xChangeDeviceControlReply.status to Success by default
If the status is other than Success, the code will set it to the required
value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-10-29 13:15:50 +10:00
Daniel Stone 314776eb36 Touch: Fix duplicate TouchBegin selection with virtual devices
Given the following scenario:
  1) client A selects for TouchBegin on window W for device D
  2) client B selects for TouchBegin on window W for XIAllDevices
  3) client C selects for TouchBegin on window W with device E

Step 3 will fail with BadImplementation, because attempting to look up
XIAllDevices or XIAllMasterDevices with dixLookupDevices doesn't work.
This should succeed (or, if it was selecting for device D, fail with
BadAccess as it would be a duplicate selection).

Fix this by performing the appropriate lookup for virtual devices.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Cc: Peter Hutterer <peter.hutterer@who-t.net>
Cc: Chase Douglas <chase.douglas@ubuntu.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-10-04 13:24:44 +10:00
Daniel Drake 3e6358ee6c Xi: Don't check for TOUCH_END, it's never set
This flag is never set, so checking for it here means that we'll
never release the simulated mouse button press after the user touches
(and releases) the touchscreen for the first time.

Fixes a problem where the XO laptop touchpad became totally
unusable after touching the screen for the first time (since X then
behaved as if the mouse button was held down all the time).

Signed-off-by: Daniel Drake <dsd@laptop.org>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-10-04 13:24:44 +10:00
Alan Coopersmith 9f7ef7f7f0 Fix up formatting of initializers for arrays of structs
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-06 15:22:53 -07:00
Alan Coopersmith 7328900042 XIChangeDeviceProperty: free newly allocated prop when SetProperty fails
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-05 08:25:03 +10:00
Daniel d'Andrada 4dbbcdf645 Do sent TouchEnd to listeners that don't own an accepted touch
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-08-05 08:25:02 +10:00
Daniel Stone 65011064d7 Xi: Remove dead Device{Enter,Leave}WindowMask
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-10 00:42:09 -07:00
Daniel Stone 854c1fa4a1 Add a common ARRAY_SIZE macro to dix.h
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-09 23:06:41 -07:00
Alan Coopersmith 9805cedf7b Use C99 designated initializers in extension Events
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-09 22:52:30 -07:00
Alan Coopersmith 2f5caeaddb Use C99 designated initializers in Xinput Replies
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-09 19:58:30 -07:00
Alan Coopersmith 6be74a9080 Fix more poorly indented/wrapped comments & code
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-09 19:14:50 -07:00
Alan Coopersmith 789d64e19a Remove unneccesary casts from WriteToClient calls
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-09 19:12:56 -07:00
Peter Hutterer 12bfb4cf1b Xi: extend PropagateMask to EMASKSIZE
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-07-04 21:16:16 +10:00
Peter Hutterer 9c0e820216 Xi: drop forced unpairing when changing the hierarchy
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-07 14:13:49 +10:00
Peter Hutterer 642569fc79 Replace a few BUG_WARN with BUG_RETURN_VAL
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-07 13:30:54 +10:00
Julien Cristau e4153c1d91 Xi: make stub DeleteInputDeviceRequest call RemoveDevice
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-24 14:57:11 +10:00
Peter Hutterer ae1c48ebc8 Xi: fix "discards ''const' qualifier" warnings
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-17 08:51:31 +10:00
Peter Hutterer e42bf98283 Xi: fix "shadows previous local" warnings
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-17 08:51:29 +10:00
Peter Hutterer ca6d25ad2d dix: Move DeviceFocusEvent from Xi into enterleave.c
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 31174565ec 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-17 08:50:44 +10:00
Michal Suchanek d2f71b1394 Xi: Remove redundant declaration.
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-14 13:17:30 +01:00
Chase Douglas ee542b8559 Report touch emulated buttons in XIQueryPointer for XI 2.1 and earlier
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-03 11:20:43 +10:00
Chase Douglas 1e7b500a8e Report logical button state in ProcXIQueryPointer
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-02 09:37:51 +10:00
Peter Hutterer ea51e9b287 Xi: return BadValue on XIQueryVersion if the version is less than first call
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 2c23ef83b0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-05-01 11:36:30 +10:00
Chase Douglas a986f2f30c Update device state including when touch record does not exist
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-18 18:29:56 -07:00
Chase Douglas e175971a6f Ensure touch is ended when last listener is rejected
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-18 13:58:40 -07:00
Chase Douglas d0449851d1 Create a new dix touch record for an emulated touch with no listeners
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-18 13:58:40 -07:00
Chase Douglas 3d06bfe93d Rename TouchEnsureSprite to TouchBuildSprite and event type checks
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-18 13:58:40 -07:00
Chase Douglas ef64b5ee97 Don't deactivate implicit pointer grab on fake touch end event
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-18 13:58:40 -07:00
Chase Douglas fc518cd9f5 End a pointer emulated touch event only on a "real" end event
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-18 13:58:40 -07:00
Chase Douglas 80d7d1ec6a On touch accept, only process end event for owner if it has seen the end
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-18 13:58:40 -07:00
Chase Douglas cacdb9a740 Accept touch sequence for pointer listener after second event delivery
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-18 13:58:39 -07:00
Chase Douglas 93c3340364 Only set XI2 mask if pointer emulation is for XI2 client
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-18 13:58:39 -07:00
Chase Douglas 4c1dfd2193 Check core event mask properly for pointer emulated touch events
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-18 13:58:39 -07:00
Chase Douglas 32ece7c09b Ensure sequential touches are pointer emulated sequentially
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-16 11:30:02 +10:00
Chase Douglas 163b0f375d Update event type when delivering end event to a pointer listener
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-16 11:30:02 +10:00
Chase Douglas 210cd12c47 Don't update listener after deactivating implicit pointer grab
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-16 11:30:02 +10:00
Peter Hutterer 72cfc1a097 Xi: fix XITouchClass sourceid assignment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-04-11 10:24:36 +10:00
Chase Douglas 1110facdfe Implement passive touch ungrabbing
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-04-05 14:36:46 -07:00
Peter Hutterer 6aef209ebc Change lastDeviceIdleTime to be per-device
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-22 13:12:56 +10:00
Chase Douglas 58427e08a4 Xi: Fix TouchEnd to TouchUpdate change for one accepted grab
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-22 11:33:20 +10:00
Peter Hutterer 2c23ef83b0 Xi: prohibit multiple XIQueryVersion requests with different versions
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-22 11:33:20 +10:00
Daniel Stone ab3a815a75 Indentation: Change '& stuff' to '&stuff'
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-21 14:02:30 -07:00
Keith Packard 9838b7032e Introduce a consistent coding style
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-03-21 13:54:42 -07:00
Chase Douglas eaba06a27c Keep virtual core pointer touch class around if new slave doesn't have one
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-15 11:09:32 +10:00
Peter Hutterer 8573b3519a Don't clobber virtual core pointer touches array length
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-15 11:09:20 +10:00
Chase Douglas 03d32fe7a7 Don't dereference a touch after it has been ended when punting to next owner
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-15 10:14:55 +10:00
Chase Douglas 1ecb7aaf2a Focus event button state must show the logical buttons, not physical buttons
Similar to the fix in fcda98c486. 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-15 10:14:55 +10:00
Peter Hutterer ceb026c6a6 Xi: handle new XIAllowEvents request in inputproto 2.1.99.6
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-09 08:02:44 +10:00
Chase Douglas 6241b5e4fd Implement touch early accept
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-08 18:04:15 +10:00
Chase Douglas 656ab879f2 Check for proper window ID when processing touch allow requests
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-08 18:04:15 +10:00
Chase Douglas 9a260e9af8 Move AllowTouch to dix/touch.c, and rename to TouchAcceptReject
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-08 18:04:15 +10:00
Chase Douglas 192b2c9a2e Export TouchEventRejected as TouchRejected
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-08 18:04:15 +10:00
Chase Douglas 19073425e5 Factor out TouchEnd generation and delivery
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>
2012-02-08 18:04:14 +10:00
Keith Packard e476af417d Merge remote-tracking branch 'whot/multitouch' 2012-01-09 13:17:37 -08:00
Peter Hutterer ed8f3c4bd1 Xi: change XIChangeDeviceProperty from const pointer to const void *
According to Daniel Kurtz, a typedef void *pointer is a atomic type. So a
'const pointer' is equivalent to 'void* const' instead of the intended
'const void*'.

This technically changes the ABI, but we don't bump it for this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-01-06 14:04:45 +10:00
Chase Douglas 146008358e Remove last listener on touch reject
The current code short-circuits around the block that removes the
rejecting listener if it is the only listener left. It also does not
delete the touchpoint record if the touch has not physically ended.

This change ensures the listener is removed under these circumstances.

Signed-off-by: Chase Douglas <chase.douglas@ubuntu.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-06 14:03:11 +10:00
Chase Douglas e30c3c5c59 Don't end touchpoint if owning client hasn't accepted/rejected
A touchpoint is ended when no further processing will take place for it.
This includes the situation where there is only one grabbing client, and
the client receives a touch end before it has accepted/rejected the
touchpoint.

This change ensures that a delivered touch end event is converted into a
touch update event under the above scenario. If the event is left as a
touch end event, the touchpoint will be ended in 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-01-06 14:03:07 +10:00
Peter Hutterer 2bb282cd45 Xi: only activate the device grab if we don't already have one
If the device is already grabbed, don't activate the passive grab, it screws
with our event masks. Just deliver to the grabbing client instead.

Reported-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 15:20:38 +10:00
Carlos Garnacho 5b169cb695 Xi: assign correct grab_mode/other_device_mode in XI2 passive grabs
CreateGrab() expects the keyboard mode to be stored in grab_mode, and the
pointer mode in other_device_mode, so respect this in passive XI2 grabs,
and switch modes if needed.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 14:16:36 +10:00
Peter Hutterer 4469430b10 Xi: add the hooks for passive touch grabs
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-21 14:16:33 +10:00
Peter Hutterer bb0af002dc Xi: handle grab accept/reject requests
Consists mostly of generating an ownership event and processing it.

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-21 12:38:36 +10:00
Peter Hutterer 209b3d613a Xi: hook up touch ownership handling
Ownership changes don't get processed directly when they happen, instead the
DIX submits an ownership event which goes through ProcessTouchEvents and
ProcessTouchOwnershipEvents.
Then on the required events are generated and sent to clients.

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>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:36 +10:00
Peter Hutterer 1894468c2b Xi: hook up pointer emulation for emulating touches
Includes a hack for implicit grab activation, because integrating this
requires a larger rewrite and I'm not sleeping enough as it is.
Right now, we deliver the event and check before/after if there is an
implicit grab on. If one activated, then store the event in the grab and
switch the listener type to a grab listener.

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-21 12:38:36 +10:00
Peter Hutterer e389a19a73 Process and deliver touch events
Does not include pointer emulation handling.
Does include partial ownership handling but not the actual processing of
ownership events.

Note: this commit is a retroactive commit extracted from a series of ~50
commits and may thus appear a bit more complicated than what you'd write out
from scratch.

Pointer processing tree is roughly:
- ProcessOtherEvents
  - ProcessTouchEvents
    - DeliverTouchEvents
      - DeliverTouchBeginEvent|DeliverTouchEndEvent|...
        - DeliverOneTouchEvent

Also hooks up the event history playing to the right function now.

Co-authored-by: Daniel Stone <daniel@fooishbar.org>
Co-authored-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>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:35 +10:00
Peter Hutterer dbfd7b37a0 Xi: make UpdateDeviceState aware of touch events
Update the logical button state for pointer-emulating events. Button state
must be kept separate from the ButtonClassRec to avoid clearing the button
state on a touch end if there is a physical button still down.

And obviously don't change the button state if we're currently replaying the
event history for some client.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:35 +10:00
Daniel Stone 8e58ce73c8 dix: when a window disappears, remove it from the touch sprite trace
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:35 +10:00
Daniel Stone d2af968cb6 Xi: allow selecting for touch events
Selecting for any of XI_TouchBegin/Update/End/Ownership requires the three
bits for begin/update/end to be set.

Only one client at a time may select for XI_TouchBegin event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:35 +10:00
Daniel Stone 3fb258ca28 input: add a TouchClassRec to the devices
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-19 09:08:36 +10:00
Peter Hutterer 93c2a1628a Hook up the ownership events
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-19 09:08:32 +10:00
Peter Hutterer 3390d3fc03 Xi: process raw touch events
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-16 11:18:47 +10:00
Peter Hutterer 84db813b9d Hook up TouchBegin/Update/End events
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-16 11:18:47 +10:00
Peter Hutterer 4c825eae89 Xi: add a FIXME
All the DeepCopy stuff really needs to be shared between the init calls the
drivers use and this code here. Too many bugs by not keeping the two in
sync.

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-16 11:18:47 +10:00
Peter Hutterer 0b9d2e426d Xi: split ProcessOtherEvent into ProcessDeviceEvent
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-16 11:18:47 +10:00
Peter Hutterer 218752bdc5 input: replace GRABTYPE_* with the InputLevel enums
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-13 13:24:08 +10:00
Peter Hutterer cd56bd7b3e Add GrabIsPointerGrab and GrabIsKeyboardGrab helpers
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:08 +10:00
Peter Hutterer 1d01e861b6 dix: split out core state and event state setting into helper functions
no functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:08 +10:00
Peter Hutterer 86c3137c81 Xi: split updating button count and state into helper functions
Functional change: for a button mapped to 0, the motionHintWindow is not
updated to the NullWindow anymore. Before it got updated unconditionally to
the button mapping. I have no idea what the practical effect of this is, but
I guess it's closer to the correct behaviour: pressing a button that's
logically disabled now does not disrupt the motion hint delivery.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:00 +10:00
Peter Hutterer e0f37250ff Xi: deduplicate button motion mask setting
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:00 +10:00
Alan Coopersmith 372a6f10dc Change disable_clientpointer return type to void
It doesn't return anything, nor does it's caller expect it to.

Fixes Solaris Studio compiler error:
"xichangehierarchy.c", line 214: Function has no return statement : disable_clientpointer

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-12-09 14:55:37 -08:00
Keith Packard 522f8bcc03 Merge remote-tracking branch 'whot/for-keith' 2011-12-08 20:57:26 -08:00
Peter Hutterer 8c9589c71d Xi: rename "state" to "corestate" in ProcessDeviceEvents
'state' is shadowed by the XKB 'state' as well (which feeds into the event
too), so rename this one to clarify that this is the core event state only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:24 +10:00
Peter Hutterer 631516a4aa Xi: check button mapping value _before_ assigning it
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:24 +10:00
Peter Hutterer a1304d6cb6 Xi: skip superfluous cast
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:24 +10:00
Peter Hutterer d2ebbcdaf6 Xi: when removing a device, reset ClientPointers where needed
if a client had the to-be-removed device as ClientPointer, reset to NULL.

Fixes #43165

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-12-09 14:56:23 +10:00
Peter Hutterer 86bb3781b3 input: swap the server over to use the XI2mask struct
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:23 +10:00
Peter Hutterer b601ea769f dix: allocate temporary grabs on the heap
Once grabs start having nested memory locations, we can't just use the
GrabRec on the stack anymore, we need to alloc/copy/free the grabs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:23 +10:00
Dave Airlie 682c09a2ce Xi: avoid overrun of callback array.
This code had an off-by-one and would allow writing one past the end of
the callbacks array.

Pointed out by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-12-06 16:00:35 +00:00
Peter Hutterer 61ef4daf64 Xi: add FreeInputMask function
Does what it says on the box, complements MakeInputMask.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-29 15:12:59 +10:00
Peter Hutterer ee9346bb31 Xi: add helper functions to alloc/free InputClientPtrs
Currently not needed since the InputClientRec is a self-contained struct. As
part of the touch rework that won't be the case in the future and a function
to allocate/free memory appropriately is required.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-29 15:12:43 +10:00
Peter Hutterer bedb8fd90d Xi: use single return code from XIPassiveGrabDevice
Some failures returned status but the actual return code was "ret". Use
"ret" consistently and move status to the local block is used in.

[the goto isn't necessary yet, but for a future patch]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-29 15:12:32 +10:00
Alan Coopersmith 05f589d464 Fix gcc -Wwrite-strings warnings in various extensions
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:07 -08:00
Alan Coopersmith 5f285a30a1 Make XIGetKnownProperty take a const char * argument
Now that MakeAtom takes const char *, so can XIGetKnownProperty.
Clears 71 warnings from gcc -Wwrite-strings of the form:
devices.c:145:5: warning: passing argument 1 of 'XIGetKnownProperty' discards qualifiers from pointer target type
../include/exevents.h:128:23: note: expected 'char *' but argument is of type 'const char *'

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-23 12:15:06 -08:00
Peter Hutterer 35ec24cf24 input: replace remaining GetPairedDevice() with GetMaster()
Wherever it's obvious which device we need (keyboard or pointer), use
GetMaster() instead of GetPairedDevice(). It is more reliable in actually
getting the device type we want.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-11-09 13:26:47 +10:00
Peter Hutterer 22715e465b Xi: allow passive keygrabs on the XIAll(Master)Devices fake devices
They don't have a KeyClassRec, but we must still allow passive grabs on
them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Bastien Nocera <hadess@hadess.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-11-09 13:26:41 +10:00
Peter Hutterer ffe20acedb Use new FP1616/FP3232 conversion functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-25 14:06:41 +10:00
Peter Hutterer 4bb5d8fae4 Xi: send DeviceChangedEvents when the scroll valuators change value
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-25 14:06:41 +10:00
Peter Hutterer d77dec6971 Xi: ensure the deviceid for DeviceChangedEvents is always the right one
If we're sending the event for a given device, make sure the deviceid is
that of the device.
This allows callers to use the same DCE for slave and master without having
to fiddle the DCE's internal fields.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-25 14:06:41 +10:00
Peter Hutterer fcdd2587a1 dix: drop unused argument from XISendDeviceChangedEvent
Instead of device and master (and just using master), drop the master
argument and let the callers pass in the device the event is to be sent for.

No effective functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-25 14:06:41 +10:00
Peter Hutterer 3304bbff9b Input: Add smooth-scrolling support to GetPointerEvents
For scroll wheel support, we used to send buttons 4/5 and 6/7 for
horizontal/vertical positive/negative scroll events.  For touchpads, we
really want more fine-grained scroll values.  GetPointerEvents now
accepts both old-school scroll button presses, and new-style scroll axis
events, while emitting both types of events to support both old and new
clients.

This works with the new XIScrollClass to mark axes as scrolling axes.
Drivers mark any valuators that send scroll events with SetScrollValuator.
(Currently missing: the XIDeviceChangeEvent being sent when a driver changes
a scroll axis at run-time. This can be added later.)

Note: the SCROLL_TYPE enums are intentionally different values to the XI2
proto values to avoid copy/overlapping range bugs.

Co-authored-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-09-30 09:24:18 +10:00
Peter Hutterer 635a1f50bc input: allow for max < min for relative axes on InitValuatorAxisStruct
Relative axes are initialized with 0, -1 but so far this never had any
effect as all users of this function (for relative axes) just set it to the
defaults anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29 12:26:43 +10:00
Peter Hutterer 8d1a414cca input: switch InitValuatorAxisStruct to return Bool
Return errors instead of silently ignoring them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29 12:26:43 +10:00
Daniel Stone 78d8d6dd7f Input: Add vertical and horizontal scroll axes
To be used for smooth scrolling with future driver APIs, replacing
Rel Vert Wheel and Rel Horiz Wheel axes, which have not been used in any
open driver to date.

Combined with double-granularity ValuatorMasks, these axes allow for
fine-grained scroll data to be sent to clients.  Future commits allow
drivers to post these scroll axes to
QueuePointerEvents/GetPointerEvents, which take care of emulating legacy
scroll button events.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29 12:26:43 +10:00
Daniel Stone 94c19a0a72 Input: Convert DeviceIntRec::last to use doubles
Change the last real user of a split integer/fractional co-ordinate
system, DeviceIntRec's last->{valuators,remainder} to just have one set
of doubles.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:26:34 +10:00
Daniel Stone 2d9beeb217 Input: Make DeviceEvent use doubles internally
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-29 12:24:34 +10:00
Keith Packard afb1fe695d Merge remote-tracking branch 'whot/next' 2011-09-26 20:24:15 -07:00
Carlos Garnacho f52d5cd374 Xi: Fix passive XI2 ungrabs on XIAll[Master]Devices
The corresponding DeviceIntPtr wasn't being gotten properly,
resulting in BadDevice from dixLookupDevice().

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-27 11:56:27 +10:00
Matt Turner 9edcae78c4 Use correct swap{l,s} (or none at all for CARD8)
Swapping the wrong size was never caught because swap{l,s} are macros.

It's clear in the case of Xext/xres.c, that the author believed
client_major/minor to be CARD16 from looking at the code in the first
hunk.

v2: dmx.c fixes from Keith.

Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21 17:14:16 -04:00
Matt Turner 2c7c520cfe Use internal temp variable for swap macros
Also, fix whitespace, mainly around
	swaps(&rep.sequenceNumber)

Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21 17:12:04 -04:00
Peter Hutterer 484cef5b29 Xi: silence compiler warnings (set but not used)
exevents.c: In function 'UpdateDeviceState':
exevents.c:719:9: warning: variable 'bit' set but not used
[-Wunused-but-set-variable]

exevents.c: In function 'ProcessOtherEvent':
exevents.c:889:22: warning: variable 'v' set but not used
[-Wunused-but-set-variable]
exevents.c:888:17: warning: variable 'k' set but not used
[-Wunused-but-set-variable]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-08-22 15:56:51 +10:00
Peter Hutterer 08a7246f43 dix: rename ProcessRawEvents to dix/events.c:DeliverRawEvent
No functional changes, prep work for future changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-06-08 13:57:05 +10:00
Peter Hutterer 0aa45c5c53 Xi: use temporary variable for filter.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-06-08 13:57:03 +10:00
Peter Hutterer bfd8422e88 Xi: use __func__ instead of function name.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
2011-06-03 14:43:05 +10:00
Peter Hutterer ffd4874798 include: add version_compare helper function
Compare two version numbers in the major.minor form.
Switch the few users of manual version switching over to the new function.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2011-05-13 09:41:50 +10:00
Peter Hutterer dc45d5816d Xi: split DeviceStateNotify delivery into a separate function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2011-05-13 09:41:38 +10:00
Peter Hutterer 5690199802 input: change CHECKEVENT macro to verify_internal_event function
The macro is sufficient if called during a development cycle, but not
sufficient information when triggered by a user (e.g.
https://bugzilla.redhat.com/show_bug.cgi?id=688693).

Expand what this does to print the event content and a backtrace, so at
least we know where we're coming from. Only the first 32 bytes are printed
since if something goes wrong, the event we have is almost certainly an
xEvent or xError, both restricted to 32 bytes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-05-06 09:58:08 +10:00
Peter Hutterer bf2059b07a input: Only release SD buttons for explicit floating/reattachment (#36146)
Grabbing an SD device temporary floats the device but we must not release
the buttons. Introduced in

    commit 9d23459415
    Author: Peter Hutterer <peter.hutterer@who-t.net>
    Date:   Fri Feb 25 11:08:19 2011 +1000

    dix: release all buttons and keys before reattaching a device (#34182)

X.Org Bug 36146 <http://bugs.freedesktop.org/show_bug.cgi?id=36146>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-05-05 10:29:17 +10:00
Nicolas Kaiser 9b5046d213 Xi: remove duplicated includes
Remove duplicated includes.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
2011-04-24 19:46:05 -07:00
Peter Hutterer 60b08e013d Xi: don't swap the status byte in the XIPassiveGrab replies
Reported-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-04-18 13:04:47 +10:00
Peter Hutterer a3f37f3698 Xi: exit with error value if CheckGrabValues failed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-04-18 13:04:44 +10:00
Peter Hutterer f4d9ff73b1 Xi: fix reply swapping function check for XIPassiveGrabDevice
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-04-18 13:04:42 +10:00
Peter Hutterer 2a49ffa3c9 Xi: return the bad device ID if a passive grab fails with BadDevice.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-04-18 13:04:39 +10:00
Peter Hutterer f0f0eec869 Xi: silence valgrind warning. (#36120)
Conditional jump or move depends on uninitialised value(s)
   at 0x4357A1: GetEventMask (events.c:454)
   by 0x43B9E8: DeliverEventsToWindow (events.c:2029)
   by 0x4E0C59: SendEventToAllWindows (exevents.c:2125)
   by 0x4E8301: XISendDeviceHierarchyEvent (xichangehierarchy.c:118)
   by 0x426F99: DisableDevice (devices.c:507)
   by 0x46BF72: xf86Wakeup (xf86Events.c:457)
   by 0x432ABA: WakeupHandler (dixutils.c:419)
   by 0x45B708: WaitForSomething (WaitFor.c:235)
   by 0x42E8D9: Dispatch (dispatch.c:367)
   by 0x422DC9: main (main.c:287)
 Uninitialised value was created by a stack allocation
   at 0x4E8190: XISendDeviceHierarchyEvent (xichangehierarchy.c:61)

Conditional jump or move depends on uninitialised value(s)
   at 0x43BB78: DeliverEventsToWindow (events.c:2010)
   by 0x4DDEEA: FindInterestedChildren (exevents.c:2103)
   by 0x4DDEFF: FindInterestedChildren (exevents.c:2104)
   by 0x4DDEFF: FindInterestedChildren (exevents.c:2104)
   by 0x4DDEFF: FindInterestedChildren (exevents.c:2104)
   by 0x4DDEFF: FindInterestedChildren (exevents.c:2104)
   by 0x4E0C6F: SendEventToAllWindows (exevents.c:2127)
   by 0x4E8301: XISendDeviceHierarchyEvent (xichangehierarchy.c:118)
   by 0x426F99: DisableDevice (devices.c:507)
   by 0x46BF72: xf86Wakeup (xf86Events.c:457)
   by 0x432ABA: WakeupHandler (dixutils.c:419)
   by 0x45B708: WaitForSomething (WaitFor.c:235)
 Uninitialised value was created by a stack allocation
   at 0x4E8190: XISendDeviceHierarchyEvent (xichangehierarchy.c:61)

Set the type of dummyDev to SLAVE. The jump listed above comes from a check
to IsMaster() in GetEventMask() that would then set the
XIAllMasterDevices mask.
Hierarchy events can only be set for XIAllDevices so the above IsMaster()
check had no effect and the device type doesn't really matter anyway beyond
shuting up valgrind.

Also initialize dummyDev to 0 to ease future debugging.

X.Org Bug 36120 <http://bugs.freedesktop.org/show_bug.cgi?id=36120>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-18 13:04:19 +10:00
Peter Hutterer 419a27b521 Xi: fix valuator alignment in DeepCopyDeviceClasses (#36119)
commit 678f5396c9 only fixed the
initialization, not the copy. After a slave device change, the valuator
were out of alignment again.

X.Org Bug 36119 <http://bugs.freedesktop.org/show_bug.cgi?id=36119>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-04-18 13:04:19 +10:00
Keith Packard c9d89cec14 Merge remote-tracking branch 'vignatti/for-keith' 2011-04-04 11:57:39 -07:00
Tiago Vignatti daae5e5de1 xi: fix memory leak in AddExtensionClient
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org>
2011-04-04 15:41:47 +03:00
Tiago Vignatti 4d87606a0d Xi: fix memory leak in ProcXGetSelectedExtensionEvents
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-04 15:41:13 +03:00
Tiago Vignatti 623bb34342 xi: fix memory leak in ProcXIQueryDevice
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-04 15:41:13 +03:00
Tiago Vignatti aa7096ca6f xorg: remove unused pointer values all over the server
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-04 15:41:13 +03:00
Matthieu Herrb 266ea63bc3 Xi: fix querydevice request swapping
WriteReplyToClient() swaps rep.length, so it can't be used
on return of WriteReplyToClient(). So save it's value for later
use.

Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2011-04-02 09:14:53 +02:00
Matthieu Herrb a074e6b675 Xi: add XI_Focus{In,Out} to swapped events.
Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2011-04-02 09:14:29 +02:00
Matthieu Herrb 81257377a2 Xi: take XI2 requests into account also for the swapping case.
Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2011-04-02 09:14:23 +02:00
Simon Thum 633b81e8ba xserver: remove AbsoluteClassRec keeping the ABI
This removes the struct, but keeps InitAbsoluteClassDeviceStruct as
a no-op and preserves related struct layout.

Signed-off-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-03-24 09:52:51 +10:00
Simon Thum 2103d61909 simplify ChangeDeviceControl in stubs
Signed-off-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-03-24 09:52:48 +10:00
Keith Packard c3c0e2fdd3 Merge remote branch 'whot/for-keith' 2011-03-09 14:25:54 -08:00
Peter Hutterer 33fee13361 Xi: fix XI2 passive grab reply length calculation
If modifiers failed, the reply length was 4 bytes too short.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-03-09 10:53:27 +10:00
Julien Cristau eb8141b6ed Xi: fix length checks for swapped clients
ChangeDeviceProperty and XIChangeProperty are followed by some data, so
use REQUEST_AT_LEAST_SIZE instead of REQUEST_SIZE_MATCH.

X.Org bug#35082 <https://bugs.freedesktop.org/show_bug.cgi?id=35082>

Reported-by: Markus Fleschutz <markus.fleschutz@x-software.com>
Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-09 07:59:41 +10:00
Adam Jackson 2cb3dc020c xi: Use RESTYPE consistently
No functional change

Reviewed-by: Soren Sandmann <ssp@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-08 13:20:33 -05:00
Peter Hutterer 579ee8f5d8 Merge branch 'mi-cleanup' into next 2011-02-23 08:44:42 +10:00
Peter Hutterer 77113dd3ee input: Change a bunch of direct dev->u.master accesses to use GetMaster()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2011-02-22 14:35:45 +10:00
Peter Hutterer febce8cb81 Xi: replace a direct master access with GetMaster()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2011-02-22 14:35:44 +10:00
Peter Hutterer dc57f89959 Switch to use IsFloating()
This is not a straightforward search/replacement due to a long-standing
issue.

dev->u.master is the same field as dev->u.lastSlave. Thus, if dev is a master
device, a check for dev->u.master may give us false positives and false
negatives.
The switch to IsFloating() spells out these cases and modifies the
conditions accordingly to cover both cases.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2011-02-22 14:35:44 +10:00
Peter Hutterer dc32a23890 Fix two incorrect checks for master devices.
These two were sideeffects of lastSlave being in the same field as the
master. For devices generated by the master device directly, lastSlave was 0
and the device would (with the old checks) be interpreted as floating.

Add the required checks to safeguard against master devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2011-02-22 14:35:44 +10:00
Bryce Harrington 649269d406 Check for OOM condition in XISendDeviceHierarchyEvent
When system is out of memory, calloc can fail returning a NULL pointer.
Check for this before dereferencing it, and bail out if it fails.

Ref.: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/720445

Signed-off-by: Bryce Harrington <bryce@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-17 15:38:27 +10:00
Daniel Stone 737562257e Input: Actually send Xi 1.x DeviceStateNotify events
When a client has selected for Xi 1.x DeviceStateNotify events, they
should receive them when a DeviceFocusIn event is generated.  The code
to do this was there, but an incorrect test meant they were never being
sent.

The "type" passed in is the XI2 type, the XI1 type is in event.type.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-17 09:22:00 +10:00
Daniel Stone da39d57a20 Input: Store passive-activating key in CheckDeviceGrabs
CheckDeviceGrabs will activate a passive grab for KeyPress and
ButtonPress events.  GrabInfoRec::activatingKey contains the keycode
which activated the passive grab, so we can deactivate it later in
ProcessOtherEvents.

Previously, CheckDeviceGrabs relied on its callers to set
activatingKey, which not all callers were doing (I'm looking at you,
ComputeFreezes).  Just set it in CheckDeviceGrabs instead.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-17 09:10:10 +10:00
Carlos Garnacho 787ba25a8a Xi: make XIQueryPointer return the current modifiers/group as documented.
The previous XKB info was being returned instead of the current
one, producing inconsistent results between the latest events
and the modifiers/group returned by this call.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>`
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-14 09:12:59 +10:00
Peter Hutterer 81daba8ce9 Xi: constify XIChangeDeviceProperty()
We don't modify "value", make it official.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
2011-02-14 09:12:58 +10:00
Peter Hutterer 16eb4f2a7b Xi: reset remainders when warping the device.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-01-20 07:48:46 +10:00
Daniel Stone 07a892cd82 Input: Pass sprite instead of device to FixUpEventFromWindow
Since FixUpEventFromWindow only uses the sprite trace to determine the
window stack, pass in a sprite instead of hardcoding the device sprite,
so we can deliver to windows other than the one currently containing the
sprite.

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>
2011-01-06 17:10:36 +00:00
Daniel Stone e1aed88be9 Input: Swap flags in DeviceEvents
Swap flags for different-endian clients when delivering XI2
DeviceEvents.

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>
2011-01-06 17:10:02 +00:00
Daniel Stone 03f2eb1e15 Input: Set client error value for invalid mask bits
When we send BadValue back to the client for having invalid mask bits,
at least tell them what the (first) invalid bit was.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-12-31 12:36:44 +00:00
Eoghan Sherry 36b614dedf Xi: Fix master button update when slave buttons are mapped. #24887
It is currently assumed that an event button delieved to a master device
corresponds to the slave button states. However, the event button is a
logical (mapped) slave button and slave button states correspond to
physical (unmapped) slave buttons. This leads to incorrect update of the
master button state and incorrect events devlivered to clients. Fix the
situation by taking the slave button map into account when querying a
slave button state.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=24887

Signed-off-by: Eoghan Sherry <ejsherry@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-12-07 08:07:54 +10:00
Peter Hutterer 5cd11d2356 Xi: move property reset from extension shutdown to init.
If any part of the stack calls XIGetKnownProperty during device shutdown
the property is re-initialized before the server generation resets, leaving
the value invalid again.

Move the reset to the extension init which happens before input devices are
initialized before the first property is requested.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2010-11-12 11:48:28 +10:00
Peter Hutterer 88cb61e1e5 Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-api
Conflicts:
	dix/getevents.c
	hw/xfree86/common/xf86Xinput.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-11 12:54:46 +10:00
Peter Hutterer 9e999d18b0 Xi: if XTEST device creation fails, fail the master devices.
When getting close to the MAXDEVICES limit, the creation of XTEST devices
may fail due to device id exhaustion. In that case, fail the creation of
master devices too and return an error to the client.

Theoretically, we could alloc the MDs without the XTEST devices but that
will get interesting when a client starts sending XTEST events through those
devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2010-11-09 07:59:56 +10:00
Peter Hutterer 5a455e0c80 Xi: rename two variables from ptr to dev.
They were named ptr when everything was in one function to save one more
variable. Now that the stuff is split out, "dev" makes more sense.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2010-11-09 07:59:45 +10:00
Peter Hutterer 9b89b91c68 Xi: split hierarchy manipulation into static functions.
No functional changes, just code cleanup to improve readability.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2010-11-09 07:59:07 +10:00
Peter Hutterer fe8d122b13 Xi: reshuffle conditions for labeling a device as IsXExtensionKeyboard (#29046)
From the original bug reporter Ezra Reeves:

"I did some more digging on this today, and I found that an HP branded
wireless USB mouse has the same issue. With this mouse (as well as the
logitech wireless mouse), the return from:

xdev = XListInputDevices(GDK_WINDOW_XDISPLAY(rootwin), &ndevices_return);

lists the USB device twice, but both have xdev[num].use == 3
(IsXExtensionKeyboard as defined in X11/XI.h).

[...]

Swapping the order of the test in Xi/listdev.c that determines whether a
device is a pointer or a keyboard properly detects my devices (OEM USB
wireless mouse/kb combo) -- one as a keyboard and one as a pointer."

X.Org Bug 29046 <http://bugs.freedesktop.org/show_bug.cgi?id=29046>

Reported-by: Erik Kilfoil <ekilfoil@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-29 08:28:57 +10:00
Peter Hutterer 58554f1c64 Convert some leftover axes->mode access to valuator_get_mode()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-25 10:37:46 +10:00
Peter Hutterer dd11f734a9 input: remove "mode" field from ValuatorClassRec.
We have per-axis mode now. For those bits that still need it (XI 1.x),
assume that the first axis holds the device's mode.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 16:19:00 +10:00
Peter Hutterer 5cf3b654fc input: move proximity state into ProximityClassRec.
Previously the OutOfProximity bit in the valuator mode.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 16:18:59 +10:00
Chase Douglas 65c0fc81eb Add support for per-axis valuator modes (Relative/Absolute)
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-10-22 13:37:57 +10:00
Peter Hutterer eaf0b6a4d8 Merge branch 'master' into input-api
Conflicts:
	config/udev.c
	hw/xfree86/common/xf86Helper.c
	hw/xfree86/common/xf86Module.h
	hw/xfree86/common/xf86Xinput.h
	hw/xfree86/os-support/linux/lnx_init.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-15 13:46:59 +10:00
Peter Hutterer 4ac3be29bc input: Purge AddOtherInputDevices DDX hook.
This hook wasn't used by any DDX. Device addition and removal is handled by
the config backend, so we don't need to do anything special that during the
ListInputDevices request processing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-09-01 15:26:52 +10:00
Peter Hutterer cb672a461c input: remove OpenInputDevice and CloseInputDevice DDX hooks.
In theory, these hooks were to be used for DDX-specific device enablement.
None of the DDXs however did anything here. Now we call DEVICE_INIT on all
devices when they are added, so the xfree86 DDX as the only one with real
code didn't do anything here.

kdrive checked for device validity but that's already handled in
ProcXOpenDevice.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-09-01 15:26:51 +10:00
Peter Hutterer 0fb7a5c261 input: Purge Register*Device() functions.
RegisterPointerDevice() and RegisterKeyboardDevice() were already mapped to
RegisterOtherDevice() and obsolete.

RegisterOtherDevice() was called for all devices and the two assignments can
simply be moved into AddInputDevice(). Purge RegisterOtherDevice() and
pretend it never happened.

*lalalalala*

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-09-01 15:26:47 +10:00
Matt Turner 08adf41f63 Replace malloc/strlen/strcpy with strdup.
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2010-08-27 19:05:48 -04:00
Peter Hutterer 619ca32202 Xi: reset the unused classes pointer after copying
After copying the unused_classes into the device, reset the original
pointer. Otherwise we have two pointers pointing to the same field and both
get freed on device removal.

Some classes already have this behaviour since 51c8fd69.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-08-13 11:07:21 +10:00
Peter Hutterer a1afe17255 dix: add aux. functions for button_is_down, set_button_down, set_button_up.
Same as the matching key functions. Buttons, like keys, can have two states
for down/up - one posted, one processed. Posted is set during event
generation (usually in the signal handler). Processed is set during event
processing when the event queue is emptied and events are being delivered to
the client.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-07-07 13:29:46 +10:00
Peter Hutterer c184429080 Xi: use set_key_up/down instead of manual bit handling.
We have the wrappers, use them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-07 13:29:45 +10:00
Keith Packard 07a093add0 Merge remote branch 'whot/for-keith' 2010-06-10 18:39:10 -07:00
Peter Hutterer dc614484f9 Xi: don't copy the modifier key count when copying device classes (#25480)
The modifier key count is maintained by the XKB layer and
increased/decreased for all modifiers that set state.

Test case, MD/SD modifier key count in comment:
1. keyboard 1: press and hold Shift_L    # SD:1     MD:1
2. keyboard 2: press and release Shift_L # SD:1,0   MD:1,0
<class copy happens>                     # SD:1     MD:1
3. keyboard 1: release Shift_L           # SD:0     MD:1
4. keyboard 1: press and release Shift_L # SD:1,0   MD:2,1

The modifier is now logically down on the MD but not on keyboard 1 or
keyboard 2.

XKB is layered in before the DIX, it increases/decreases the modifier key
count accordingly. In the above example, during (2), the MD gets the key
release and thus clears the modifier bit. (3) doesn't forward the release to
the MD because it is already cleared. The copy of modifierKeysDown when the
lastSlave changes however increases the counter for the held key. On (4),
the press and release are both forwarded to the MD, causing a offset by 1
and thus do not clear the logical modifier state.

X.Org Bug 25480 <http://bugs.freedesktop.org/show_bug.cgi?id=25480>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniel@fooishbar.org>
2010-06-11 09:47:42 +10:00
Mikhail Gusarov 7287ef9e6c Remove unnecessary parentheses around return values in functions
This patch was generated by the following Perl code:

perl -i -pe 's/([^_])return\s*\(\s*([^(]+?)\s*\)s*;(\s+(\n))?/$1return $2;$4/g;'

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-10 06:42:42 -07:00
Mikhail Gusarov 0a4d8cbdcd Remove more superfluous if(p) checks around free(p)
This patch has been generated by the following Coccinelle semantic patch:

@@
expression E;
@@

-if(E) { free(E); }
+free(E);

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2010-06-06 20:27:18 +07:00
Keith Packard faeebead7b Change the devPrivates API to require dixRegisterPrivateKey
This patch only changes the API, not the implementation of the
devPrivates infrastructure. This will permit a new devPrivates
implementation to be layed into the server without requiring
simultaneous changes in every devPrivates user.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-06-05 19:23:03 -07:00
Jamey Sharp a83cff9f4d Move each screen's x/y origin into ScreenRec.
Many references to the dixScreenOrigins array already had the
corresponding screen pointer handy, which meant they usually looked like
"dixScreenOrigins[pScreen->myNum]". Adding a field to ScreenRec instead
of keeping this information in a parallel array simplifies those
expressions, and eliminates a MAXSCREENS-sized array.

Since dix declared the dixScreenOrigins array, I figure allocating a
screen private for these values is overkill.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> (i686 GNU/Linux)
2010-06-03 14:03:23 -07:00
Jamey Sharp 217ccaa5a3 Delete panoramiXdataPtr: it's redundant.
This eliminates a dynamically-allocated MAXSCREENS-sized array.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> (i686 GNU/Linux)
2010-06-03 14:03:23 -07:00
Jamey Sharp e7fae9ecc4 Move each screen's root-window pointer into ScreenRec.
Many references to the WindowTable array already had the corresponding
screen pointer handy, which meant they usually looked like
"WindowTable[pScreen->myNum]". Adding a field to ScreenRec instead of
keeping this information in a parallel array simplifies those
expressions, and eliminates a MAXSCREENS-sized array.

Since dix uses this data, a screen private entry isn't appropriate.

xf86-video-dummy currently uses WindowTable, so it needs to be updated
to reflect this change.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> (i686 GNU/Linux)
2010-06-03 14:03:23 -07:00
Peter Korsgaard 6cccf0131c dix: add 3x3 transformation matrix xinput property for multi-head handling
For absolute input devices (E.G. touchscreens) in multi-head setups,
we need a way to bind the device to an randr output. This adds the
infrastructure to the server to allow us to do so.

positionSprite() scales input coordinates to the dimensions of the shared
(total) screen frame buffer, so to restrict motion to an output we need to
scale/rotate/translate device coordinates to a subset of the frame buffer
before passing them on to positionSprite.

This is done here using a 3x3 transformation matrix, which is applied to
the device coordinates using homogeneous coordinates, E.G.:

[ c0 c1 c2 ]   [ x ]
[ c3 c4 c5 ] * [ y ]
[ c6 c7 c8 ]   [ 1 ]

Notice: As input devices have varying input ranges, the coordinates are
first scaled to the [0..1] range for generality, and afterwards scaled
back up.

E.G. for a dual head setup (using same resolution) next to each other, you
would want to scale the X coordinates of the touchscreen connected to the
both heads by 50%, and translate (offset) the coordinates of the rightmost
head by 50%, or in matrix form:

   left:            right:
[ 0.5 0 0 ]     [ 0.5 0 0.5 ]
[ 0   1 0 ]     [ 0   1 0   ]
[ 0   0 1 ]     [ 0   0 0   ]

Which can be done using xinput:

xinput set-prop <left> --type=float "Coordinate Transformation Matrix" \
       0.5 0 0 0 1 0 0 0 1

xinput set-prop <right> --type=float "Coordinate Transformation Matrix" \
       0.5 0 0.5 0 1 0 0 0 1

Likewise more complication setups involving more heads, rotation or
different resolution can be handled.

Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-28 16:49:30 +10:00
Keith Packard 4e9d3e4132 Revert "Add a "flags" field to DeleteInputDeviceRequest."
Peter wants to get a larger patch sequence put together and I didn't
read past the commit message to see the 'don't take this patch
please'.

This reverts commit 531ff40301.
2010-05-26 07:54:35 -07:00
Peter Hutterer 531ff40301 Add a "flags" field to DeleteInputDeviceRequest.
Some input drivers need to implement an internal hotplugging scheme for
dependent devices to provide multiple X devices off one kernel device file.
Such dependent devices can be added with NewInputDeviceRequest() but they are
not removed when the config backend calls DeleteInputDeviceRequest(),
leaving the original device to clean up.

Example of the wacom driver:

config/udev calls NewInputDeviceRequest("stylus")

wacom PreInit calls
        NewInputDeviceRequest("eraser")
        NewInputDeviceRequest("pad")
        NewInputDeviceRequest("cursor")
        PreInit finishes.

When the device is removed, the config backend only calls
DeleteInputDeviceRequest for "stylus". The driver needs to call
DeleteInputDeviceRequest for the dependent devices eraser, pad and cursor to
clean up properly.
However, when the server terminates, DeleteInputDeviceRequest is called for
all devices - the driver must not remove the dependent devices to avoid
double-frees. There is no method for the driver to detect why a device is
being removed, leading to elaborate guesswork and some amount of wishful
thinking.

Though the input driver's UnInit already supports flags, they are unused.
This patch uses the flags to supply information where the
DeleteInputDeviceRequest request originates from, allowing a driver to
selectively call DeleteInputDeviceRequest when necessary.

Also bumps XINPUT ABI.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-25 17:47:32 -07:00
Jamey Sharp e291c56182 Return an appropriately-typed error from dixLookupResourceByType.
Rather than always returning BadValue, associate an error status like
BadWindow with a resource type like RT_WINDOW, and return the
appropriate one for the requested type.

This patch only touches the core protocol resource types. Others still
return BadValue and need to be mapped appropriately.

dixLookupResourceByType can now return BadImplementation, if the caller
asked for a resource type that has not been allocated in the server.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-05-19 12:32:48 -07:00
Jamey Sharp 92ed75ac59 Eliminate boilerplate around client->noClientException.
Just let Dispatch() check for a noClientException, rather than making
every single dispatch procedure take care of it.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-05-13 17:14:07 -07:00
Mikhail Gusarov 3f3ff971ec Replace X-allocation functions with their C89 counterparts
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-05-13 00:22:37 +07:00
Peter Hutterer 9802839d35 Xi: reset the known properties at the end of the server generation.
Properties allocated through XIGetKnownProperty() aren't reset on the second
server generation but keep the old value. As a result, wrong Atoms are
supplied to the driver, resulting in potential data corruption or weird
error message.

Reproducible by running "xlsatom | grep FLOAT" twice on a plain X server.
The second X server generation won't have the FLOAT atom defined anymore,
despite the users of this atom not noticing any errors.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-07 12:16:43 -07:00
Keith Packard 65e961fcc1 Replace some input devPrivates with regular struct fields
In the process, fixes a memory leak in CloseDevice, and an unchecked
memory allocation in InitializePredictableAccelerationProperties.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-04-30 13:05:11 -07:00
Tiago Vignatti 057c147541 Xi: check for NULL pointer before dereferences it in ListButtonInfo
Both dev and dev->button are already used before their checking were being
performed. So check on the beginning.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2010-04-21 18:07:19 +03:00
Tiago Vignatti d948dcd955 Xi: fix not reached code in XSendExtensionEvent
Error was introduced in 31a7994a. I.e., broken since 2007. I guess nobody uses
XSendExtensionEvent.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2010-04-21 18:07:16 +03:00
Daniel Stone a2ea8c2f2c Record: Avoid duplicates from replaying frozen events
Reintroduce a check which used to be there in the old
ProcessKeyboardEvent/ProcessPointerEvent codepath, which avoids us
recording events subject to a grab twice: once when it's first processed
in EnqueueEvent, and then again when it's thawed and being replayed.

This required a tiny amount of code motion to expose syncEvents.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-03-12 13:06:22 +10:00
Peter Hutterer 02d1116e7e Xi: assume BadMode for non-BadMatch errors returned from SetDeviceMode.
The XI protocol spec only allows for two errors on the SetDeviceMode
requests: BadMatch or BadMode. BadMode however is a dynamically assigned
extension error and the driver doesn't have access to the actual error
number. Hence, if a SetDeviceMode driver returns an error other than
BadMatch, assume BadMode.

The two exceptions are BadAlloc and BadImplementations, pass these on to the
client (any request is allowed to return either of those).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2010-02-22 12:04:36 +10:00
Chris Dekter 122fc0e7a0 Re-enable RECORD extension.
RECORD was disabled during the switch to internal events. This patch
modifies the record callback to work with internal events instead of
xEvents. The InternalEvents are converted to core/Xi events as needed.

Since record is a loadable extension, the EventTo* calls must be externed.

Signed-off-by: Chris Dekter <cdekter@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-02-22 12:04:28 +10:00
Peter Hutterer 48f7298657 Xi: reset the sli pointers after copying device classes. (#25640)
If the indicator flags have the XkbSLI_IsDefault bit set, the indicator map
and names aren't their own bit of memory but rather point into the
device->key->xkbInfo->desc structure. XkbCopySrvLedInfo knows about this and
leaves the pointers alone.

When copying the classes from the slave to the master, these pointers are
copied and still point to the dev->key class of the slave device. If the
slave device is removed, the memory becomes invalid and a call to modify
this data (e.g. XkbSetIndicators) may cause a deadlock.

The copying of dev->key relies on dev->kbdfeed to be already set up. Hence
the pointers need to be reset once _both_ kbdfeed and key have been copied
into the master device.

X.Org Bug 25640 <http://bugs.freedesktop.org/show_bug.cgi?id=25640>
Fedora Bug 540584 <https://bugzilla.redhat.com/show_bug.cgi?id=540584>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-02-15 15:27:41 +10:00
Benjamin Tissoires a34812b090 Add labels for multitouch valuators
Thoses definitions have been included in the kernel but the X server is not updated accordingly.
Without these definitions, the multitouch axes are not correctly labelled.

Signed-off-by: Benjamin Tissoires <tissoire@cena.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-02-09 10:21:27 +10:00
Dan Nicholson 0711598dd3 config: Introduce InputAttributes in NewInputDeviceRequest
In order to give NewInputDeviceRequest more information, a new
InputAttributes type is introduced. Currently, this collects the product
and vendor name, device path, and sets booleans for attributes such as
having keys and/or a pointer. Only the HAL backend fills in the
attributes, though.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
2009-12-22 23:24:13 -08:00
Alan Coopersmith 895f40792a Add type name argument to CreateNewResourceType
Convert all calls of CreateNewResourceType to pass name argument

Breaks DIX ABI.

ABI versions bumped:

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2009-12-18 17:44:12 -08:00
Alan Coopersmith eb750f8b5e Check for failures from CreateNewResourceType
Make sure to check return value before setting bitmask flags.
For most calls, just fails to init the extension.   Since Xinput
already calls FatalError() on initialization failure, so does
failure to allocate Xinput's resource type.

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2009-12-18 16:51:45 -08:00
Peter Hutterer ea14a41821 Xi: reset device properties to NULL after deleting them. (#25374)
Commit 0e6cee853d introduced cleanup code to
remove the accel properties when switching schemes. The same code is
triggered by the default closedown code but only after unconditionally
removing all device properties (as part of the cleanup). The properties,
although deleted never got reset to NULL.

X.Org Bug 25374 <http://bugs.freedesktop.org/show_bug.cgi?id=25374>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Andy Furniss <lists@andyfurniss.entadsl.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2009-12-11 11:37:37 +10:00
Peter Hutterer 1b127ab842 Xi: when deleting all properties, reset property handler to NULL.
Trying to unregister property handlers during the device closure process
leads to invalid memory accesses.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2009-11-25 10:57:07 +10:00
Peter Hutterer a30e739a14 Xi: don't crash when deleting invalid device properties.
Deleting a property that was not set on a device leads to a null-pointer
reference. The protocol allows deleting those properties - it has to be a
noop.

Reproducible:
xinput --set-prop "My device" --type=int --format=8 "my property" 1
xinput --delete-prop "My other device" "my property"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2009-11-22 19:42:13 -08:00