Commit Graph

365 Commits

Author SHA1 Message Date
Daniel Stone
5680fa41ea Input: Remove x and y from moveAbsolute/moveRelative
Both these functions modify the mask and
pDev->last.{valuators,remainder} in-place now, so there's no need to
pass in pointers to local x and y values.

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
Daniel Stone
0882b788da Input: Convert acceleration code to using ValuatorMask
Instead of passing a set of int* to the acceleration code, pass it a
mask instead, which avoids an unfortunate loss of precision.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-09-29 12:24:34 +10:00
Daniel Stone
e1df51421b Input: Set fractional member in set_raw_valuators
RawDeviceEvents have space for fractional valuator members, so might as
well start using them.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:51 +10:00
Daniel Stone
cdf202250e Input: Convert transformAbsolute to work on doubles
Change transformAbsolute to use doubles internally.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:51 +10:00
Daniel Stone
3463078f96 Input: Convert clipAxis, moveAbsolute and moveRelative to double
Change all these three to use doubles internally, though the outputs of
moveAbsolute and moveRelative are still truncated to int.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29 12:23:51 +10:00
Daniel Stone
4e52cc0ef4 Input: Prepare moveRelative for conversion to double
Shuffle some code around in moveRelative to make the conversion to
double easier later.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:51 +10:00
Daniel Stone
80fdf9ca33 Input: Prepare moveAbsolute for conversion to double
Shuffle some code around to make moving to double easier later.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:51 +10:00
Daniel Stone
6a6b4eb05c Input: Store clipped absolute axes in the mask
Change moveAbsolute to be more symmetric with moveRelative by storing a
clipped axis value back in the mask, rather than just in
dev->last.valuators.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:51 +10:00
Peter Hutterer
3a077f246e input: provide a single function to init DeviceEvents to 0
getevents.c already had that function, but XKB was manually initializing it,
causing bugs when the event structure was updated in one place but not the
other.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-08-22 15:56:52 +10:00
Peter Hutterer
4b376ddeb4 dix: fix compiler warnings ("foo" set but not used)
devices.c: In function 'AttachDevice':
devices.c:2409:18: warning: variable 'oldmaster' set but not used
[-Wunused-but-set-variable]

events.c: In function 'ConfineToShape':
events.c:683:15: warning: variable 'pSprite' set but not used
[-Wunused-but-set-variable]

events.c: In function 'ProcGrabPointer':
events.c:4759:15: warning: variable 'time' set but not used
[-Wunused-but-set-variable]

getevents.c: In function 'GetMotionHistory':
getevents.c:425:9: warning: variable 'dflt' 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:52 +10:00
Daniel Stone
e084ac30b3 Input: Reset SD remainder when copying co-ords from MD
In updateSlaveDeviceCoords, pDev->last.valuators was being copied from
the master, but pDev->last.remainder wasn't.  Make sure we copy both, to
avoid minor inconsistencies.

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-07-01 08:46:28 +10:00
Peter Hutterer
23a7832789 input: add POINTER_NORAW to avoid generation of raw events (#30068)
RawEvents are supposed to be events coming from the driver. When warping the
pointer, this should not generate a raw event.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-01 08:46:28 +10:00
Peter Hutterer
0d140567ba dix: fix crashers with floating device.
dc57f89959 accidentally reversed the
conditions.

in dix/events.c we try to detach floating devices. This leads to a
NULL-dereference on GetMaster()->id.

in dix/getevents.c we try to get the master device for the floating slave
and dereference it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-06-07 15:17:55 +10:00
Peter Hutterer
b75cdb5bf7 dix: drop x/y back into the right valuators after transformation.
If the matrix is used for rotation, the coordinates affected may change.
e.g. a valuator mask of (x, nil) becomes [x, lasty] and is rotated to
[lasty, x]. Since the second value was unset, we would not drop x back into
the mask, resulting in a loss of movement.

Thus, drop any value that changed after applying the matrix into the
valuators. Thus, the example above becomes
(x, nil) → [x, lasty] → [lasty, x] → (lasty, x)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-06-03 14:43:05 +10:00
Peter Hutterer
fe4b818700 dix: don't pass x/y to transformAbsolute
We passed in the mask, but didn't do anything with it. Move the logic to
take the axes out of the valuator masks into transformAbsolute.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-06-03 14:43:05 +10:00
Peter Hutterer
20fb07f436 input: remove DDX event list handling
The current approach to event posting required the DDX to request the event
list (allocated by the DIX) and then pass that list into QueuePointerEvent
and friends.

Remove this step and use the DIX event list directly. This means that
QueuePointerEvent is not reentrant but it wasn't before anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-05-11 14:27:36 +10:00
Peter Hutterer
8670c46bdf input: replace EventListPtr with InternalEvent array
EventListPtr is a relic from pre-1.6, when we had protocol events in the
event queue and thus events of varying size.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-05-11 14:27:36 +10:00
Peter Hutterer
e7150db535 input: Provide Queue{Button|Keyboard|Proximity}Event helpers
Don't require every caller to use GPE + mieqEnqueue, provide matching
Queue...Event functions instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-05-11 14:27:33 +10:00
Chase Douglas
65b54548dc Input: Pass co-ordinates by reference to transformAbsolute
With the upcoming XI 2.1 touch work, the co-ordinate values will need to
be passed by reference, rather than modified in-place.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-05-03 01:46:35 +01:00
Nicolas Kaiser
86c0c8b9c5 dix: 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:06 -07:00
Peter Hutterer
071a6ac4d0 input: remove GetKeyboardValuatorEvents, this is now unnecessary.
GetKeyboardValuatorEvents handles NULL valuator masks already, so the
GetKeyboardEvents wrapper is not needed. Rename GKVE to GKE.

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:05:46 +10:00
Chase Douglas
b28a1af55c Fix unset valuator handling for XI 1.x valuator events again
Set the valuator values for unset masked absolute valuators in the
internal device event. This ensures the values will always be correct in
getValuatorEvents even if the device has been removed.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-07 12:45:55 +10:00
Keith Packard
0ac4931753 Merge remote-tracking branch 'ajax/xserver-next' 2011-03-14 13:06:41 -07:00
Peter Hutterer
769531b9cc Add mode field to pointer movement hooks.
Preparation work for pointer barriers.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-14 13:25:14 -04:00
Adam Jackson
7b5e562ea7 input: warning fix
getevents.c:770:5: warning: suggest parentheses around '&&' within '||'

Introduced with dc57f89959e549403f8488eb9f23425bd7118b22:

-    if(dev->u.master && dev->valuator) {
+    if(dev->valuator && IsMaster(dev) || !IsFloating(dev)) {

So I'm assuming the two terms around the || are meant to be a unit.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-09 10:53:32 +10:00
Simon Thum
a4b8526185 dix: update pointer acceleration code to use ValuatorMask
Signed-off-by: Simon Thum <simon.thum@gmx.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-02 14:54:03 +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
d63c979c7f dix: replace direct master access with GetMaster and temp. device.
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
0d440a1c6e dix: allow for button-only input devices (#21457)
Add a few checks for the existence of a valuator class on the device to
avoid null-pointer dereferences for button events from devices without a
valuator class.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-12-10 10:57:55 +10:00
Peter Hutterer
aba8133c9c dix: clear up an overly convoluted if statement.
No functional changes, just improves readability. This statement had things
added to/removed from it for a few server releases while the input event
queue was revamped. What made sense once is now mainly confusing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-12-09 10:03:26 +10:00
Ferry Huberts
b16964910d dix: do not use bit-wise operators on the boolean result of BitIsOn
Performing bit-wise operations on a boolean amounts to mixing types,
is confusing and basically incorrect; one should only perform
logical operations on booleans.

Performing such operations relies on the implementation detail
that a boolean is in fact an integer and that its value FALSE
is implemented as zero.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-11-30 13:25:47 -08:00
Peter Hutterer
23e3d1f233 dix: remove now unnecessary !! before BitIsOn()
The macro has been changed to do this already, no need for double
not-not-ing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-11-26 11:05:50 +10:00
Peter Hutterer
639600fa7e dix: add a fixme about a corner-case that should probably be fixed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-11-24 08:47:00 +10:00
Peter Hutterer
0aca9e8424 dix: fix typo, set the second valuator with the y-axis data.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-11-24 08:47:00 +10:00
Peter Hutterer
45131bb67f dix: GetProximityEvents needs to check up to the last valuator
valuator_mask_size() returns the highest valuator set as opposed to the
number of set bits (which obviously changes as we unset valuators).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-11-24 08:47:00 +10:00
Peter Hutterer
6f12934d4e dix: replace a manual valuator check with valuator_get_mode().
This check was missing the OutOfProximity mask and resulted in the wrong
bits being set in InternalEvents.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-11-24 08:47:00 +10:00
Simon Thum
ebe3ddaf28 dix: fix up valuators passed to acceleration code.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-11-24 08:47:00 +10:00
Chase Douglas
31737fff08 Fix transformAbsolute
transformAbsolute must use old values if valuator mask doesn't have new
ones, and it must only set new values if there was a change.

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>
2010-11-19 11:11:04 +10:00
Chase Douglas
463841f45a Fix GPE Y axis scaling
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>
2010-11-19 11:11:04 +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
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
b5ef88c911 dix: clip absolute axes depending on their 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
Peter Hutterer
ea567b675f dix: populate motion history only if the mode matches the first axis.
XI1 doesn't cater for mixed mode devices, so bail out on the first valuator
that has a different 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
Peter Hutterer
6f6f460c24 dix: send proximity events if one or more axes are Absolute.
We only skip relative events for proximity, not absolute ones. Now with
mixed mode, just unset those axes that are relative.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 15:18:33 +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
0418a39e71 dix: get rid of the now-superfluous valuator arrays in GPE and friends.
The valuators are stored inside the mask, use it from there. are stored
inside the mask, use it from there. are stored inside the mask, use it from
there. are stored inside the mask, use it from there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 11:02:53 +10:00
Peter Hutterer
675f4a8525 Abstract valuator masks through a set of APIs.
This commit introduces an abstraction API for handling masked valuators. The
intent is that drivers just allocate a mask, set the data and pass the mask
to the server. The actual storage type of the mask is hidden from the
drivers.

The new calls for drivers are:
    valuator_mask_new()     /* to allocate a valuator mask */
    valuator_mask_zero()    /* to reset a mask to zero */
    valuator_mask_set()     /* to set a valuator value */

The new interface to the server is
    xf86PostMotionEventM()
    xf86PostButtonEventM()
    xf86PostKeyboardEventM()
    xf86PostProximityEventM()

all taking a mask instead of the valuator array.

The ValuatorMask is currently defined for MAX_VALUATORS fixed size due to
memory allocation restrictions in SIGIO handlers.

For easier review, a lot of the code still uses separate valuator arrays.
This will be fixed in a later patch.

This patch was initially written by Chase Douglas.

Signed-off-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>
2010-10-22 11:02:48 +10:00
Joe Shaw
e354ccac36 fix a sign problem with valuator data.
Without this patch, any negative valuator value is wrong when returned
from XQueryDeviceState().  This is a regression from at least xserver
1.4.

Valuator data is set in dix/getevents.c:set_valuators() by copying
signed int values into an unsigned int field
DeviceEvent.valuators.data.

That data is converted into a double with an implicit cast by
assignment to axisVal[i] in Xi/exevents.c:UpdateDeviceState().

That double is converted back to a signed int in
queryst.c:ProcXQueryDeviceState().  If the original value in
set_valuators() is negative, the double value will be > 2^31 and the
conversion back to a signed int is undefined.  (Although I
consistently see the value -2^31.)

Fix this by changing the definition of DeviceEvent.valuators.data from
uint32_t to int32_t.

Signed-off-by: Joe Shaw <joeshaw@litl.com>
Reviewed-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>
2010-10-18 10:16:23 +10:00
Peter Hutterer
424b856e8e dix: update comments for GetPointerEvents and friends
All these now generate InternalEvents, point this out. Remove XKB/XI
references, that's just confusing. This comment referred to the old-style
event generation code from server 1.4 to including 1.6 but is now just
confusing to newcomers.

Remove comment about SwitchCoreKeyboard() for the same reason.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-18 07:59:55 +10:00
Peter Hutterer
79ea9ef399 input: constify valuators passed in by input drivers.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-09-06 12:44:10 +10:00
Peter Hutterer
fc091936e2 dix: copy the valuators passed into GPE/GKVE/GProxE.
GPE and friends modify the valuators array passed in. Which means any driver
using e.g. xf86PostButtonEventP(..., valuators) twice to emulate a button
click will provide garbage data on the second run.

This is currently affecting the wacom driver, xf86PostButtonEventP() with
valuators is required to have input events with device-specific axis values.
Passing the same valuators in twice, once with press, once with release,
will see the valuators modified in the first call and garbage submitted in
the next one.

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>
2010-08-18 13:10:54 -07:00
Peter Hutterer
651c36e95e xkb: post-fix PointerKeys button events with a DeviceChangedEvent.
commit 1432785839
    xkb: release XTEST pointer buttons on physical releases. (#28808)
revealed a bug with the XTEST/PointerKeys interaction.

Events resulting from PointerKeys are injected into the event processing
stream, not appended to the event queue. The events generated for the fake
button press include a DeviceChangedEvent (DCE), a raw button event and the
button event itself. The DCE causes the master to switch classes to the
attached XTEST pointer device.

Once the fake button is processed, normal event processing continues with
events in the EQ. The master still contains the XTEST classes, causing some
events to be dropped if e.g. the number of valuators of the event in the
queue exceeds the XTEST device's number of valuators.

Example: the EQ contains the following events, processed one-by-one, left to
right.

[DCE (dev)][Btn down][Btn up][Motion][Motion][...]
                  ^ XkbFakeDeviceButton injects [DCE (XTEST)][Btn up]

Thus the event sequence processed looks like this:

[DCE (dev)][Btn down][Btn up][DCE (XTEST)][Btn up][Motion][Motion][...]

The first DCE causes the master to switch to the device. The button up event
injects a DCE to the XTEST device, causing the following Motion events to be
processed with the master still being on XTEST classes.

This patch post-fixes the injected event sequence with a DCE to restore the
classes of the original slave device, resulting in an event sequence like
this:
[DCE (dev)][Btn down][Btn up][DCE (XTEST)][Btn up][DCE (dev)][Motion][Motion]

Note that this is a simplified description. The event sequence injected by
the PointerKeys code is injected for the master device only and the matching
slave device that caused the injection has already finished processing on
the slave. Furthermore, the injection happens as part of the the XKB layer,
before the unwrapping of the processInputProc takes us into the DIX where
the DCE is actually handled.

Bug reproducible with a device that reports more than 2 valuators. Simply
cause button releases on the device and wait for a "too many valuators"
warning message.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-08-13 11:07:13 +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
32473d6bf3 dix: use BitIsOn/SetBit/ClearBit macros for set_key_down helpers.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-07-07 13:29:45 +10:00
Peter Hutterer
10442ce02b dix: treat flags as flags, not as value in key_is_down.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-07-07 13:29:45 +10: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
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
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
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
9f462ff908 dix: Clip only into axis ranges if we're in absolute mode. (#26543)
An absolute device in relative mode may provide valuators outside of the
axis range. Clipping back into the range prevents screen crossings in a
multi-screen (Xinerama) setup as the required screen edge for crossing is
never met: miPointerSetPosition crosses the screen conditional to the X
coordinate being equal to the screen width or _less than_ 0. While the
former can be met when clipping into the coordinate range and scaling, the
latter cannot, resulting in a mouse pointer that gets stuck on the rightmost
screen.

This patch only applies axis clipping for valuators in mode Absolute. If
relative, we allow the values to get above/below the axis ranges. Doesn't
matter, miPointerSetPosition will reset the values to the allowed range even
if no screen was crossed.
This leads to interesting values provided to clients, the valuator range of
the device resets once a screen is crossed and essentially reflects
the position of the cursor on the screen - scaled into the valuator range.
The values themselves are valid given the range though.

In theory, the XI1 specs require that a relative device has a min/max range
of 0/0. This doesn't really go well with devices that actually can switch
mode between relative and absolute since they would have to reset their axis
range when switching. If multiple XI clients are in use, we have no method
of notifying them about the changes, so other clients may continue to use
the wrong axis ranges (note: XI1 wasn't really designed to have multiple
clients use a device). Expecting all relative devices to have this min/max
of 0 is unrealistic at this point.

So pick what is possibly the lesser of all evils, pass the beer and despair.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-03-10 09:30:19 +10:00
Oldřich Jedlička
993e78d6c4 Fix typo in updateSlaveDeviceCoords
The index [0] for the second valuator looks bogus; fix it.

Signed-off-by: Oldřich Jedlička <oldium.pro@seznam.cz>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-02-01 15:27:42 +10:00
Peter Hutterer
6f265d55a6 dix: don't update the slave coordinates from the VCK.
A keyboard event from a device with both valuators and keys will be posted
through the VCK. In this case, do not update the slave device coordinates
from the VCK - they're always 0/0. Leave them as-is, for the next pointer
event will continue where it left.

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>
2010-01-05 14:01:51 -08:00
Peter Hutterer
45f447dafd dix: force a minimum of 0 for screen coordinates.
Currently the root coordinates may fall into ]-1..0] if the subpixel
remainder is less than 0. Screen coordinates mustn't go below 0, so use
miPointerSetPosition to cap off the remainder if the coordinates are below
0.

This is cheating a bit, a more comprehensive solution to deal with subpixels
correctly when crossing screens is needed. For now, this'll do.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Simon Thum <simon.thum@gmx.de>
2009-10-02 12:16:47 +10:00
Simon Thum
824a09d856 dix: move bounds check before access
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-22 16:26:14 +10:00
Keith Packard
8b5086250a Eliminate bogus event resizing.
Now that all event queues hold internal events only, they never need
to be resized. Resizing them led to memory corruption as they would
get sized for an appropriate xEvent, not an internal event.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-20 20:45:24 +10:00
Peter Hutterer
a9d30f6a03 dix: GetKeyboardValuatorEvents doesn't recurse anymore - fix comment.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-08 18:07:16 +10:00
Peter Hutterer
2851f04cb2 dix: rework DeviceChangedEvents a bit.
DCEs are now processed when sent throught the master device, not when sent
through the slave device. This includes a removal of some un-used (or partly
used) fields in the DCE itself to something more self-explanatory.

TODO: if a device has events queued and its attachment is changed, the DCE
is silently dropped now. Instead, it should be generated as soon as the
first event after the attachment is sent.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17 13:25:35 +10:00
Peter Hutterer
f85619b14d dix: update GetMaximumEventsNum() to real value (3).
GPE and friends now use internal events so they may generate up to 3 events.
One (optional) DeviceChanged event and one raw event plus a device event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:13 +10:00
Peter Hutterer
4e9b2938cd include: untangle events.h from the SDK headers.
InternalEvents shouldn't be used anywhere outside the X server itself. Split
up into events.h for opaque typedefs for the events needed by various
headers and eventstr.h for the actual struct definitions.

eventstr.h must only be included by code that requires internal events and
is not part of the SDK.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:13 +10:00
Éric Piel
52088d3c2d xserver: remove unused code in clipValuators
The axes variables was never used, remove it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-15 17:09:22 +10:00
Peter Hutterer
35ff5cd26e dix: fix wrong raw valuator copy
internal events keep valuator data at the index for the valuator, not like
the wire events that start with first_valuator.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-15 10:36:30 +10:00
Peter Hutterer
d040af7fa3 Update to type-specific raw events - require inputproto 1.9.99.14.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-15 10:36:30 +10:00
Thomas Jaeger
cbeb6a73c4 dix: report subpixel coordinates for high-resolution devices
Acked-by: Simon Thum <simon.thum@gmx.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-29 12:20:49 +10:00
Thomas Jaeger
e341512bfa dix: update a comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-24 09:00:41 +10:00
Thomas Jaeger
5cbd4d3d6e dix: do away with an instance of temporary in-place modification
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-24 09:00:41 +10:00
Thomas Jaeger
94cdc1ef0a dix: deal with first_valuator > 0 correctly if POINTER_SCREEN is set
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-24 09:00:41 +10:00
Peter Hutterer
96706c24bd dix: fix wrong indices in set_valuator.
Reported-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-22 15:11:26 +10:00
Peter Hutterer
a30fef9956 input: Add labels to buttons and valuators - ABI_XINPUT_VERSION 7
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18 14:41:47 +10:00
Simon Thum
707b124168 dix: prefer lroundf() over roundf() in axis scaling
it's unclear whether there actually is a problem, but in a very similar
case there is (bug#21456). Also, integer addition is generally faster.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-07 09:31:07 +10:00
Peter Hutterer
68d86adbe8 dix: GetProximityEvents doesn't need extra events for valuators.
With internal events, we only have one event for all the data, no need to
calculate for extra events.

Reported-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-29 12:03:41 +10:00
Peter Hutterer
da0d3baf71 dix: protect event generation against single-valuator devices.
If we have a single-axis device and it sends events it should not access
non-existant memory.
2009-05-22 15:44:57 +10:00
Peter Hutterer
ebe45e1a72 input: introduce partial class copying depending on the event.
Copying all classes into the master device has drawbacks for hybrid devices
(devices that are both mice and keyboards). If such a device posts an event,
it's key classes are moved into the VCP. The key event itself is unaffected
by keyboard grabs and the like.

Partial class copying copies depending on the event and copies the classes
into the right master device (i.e. the VCK for key events, the VCP for
pointer events).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22 15:44:57 +10:00
Peter Hutterer
bc63c8a457 dix: introduce GetMaster()
For hybrid devices (keys + buttons/axes) the attached master device is
generally the wrong one. One shouldn't post a button event through a
keyboard and vice versa.

GetMaster(dev) returns the right master device for the given type needed.
This may be the MD paired with this device's MD.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22 15:44:57 +10:00
Peter Hutterer
d79318f269 dix: Add a deviceid to the DeviceChangedEvent.
ChangeDeviceId would actually overwrite the flags field if deviceid wasn't
present. Aside from the event of course not telling which device generated
it in the first place.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22 15:44:57 +10:00
Peter Hutterer
b12d302df8 Input: rename DeviceIntRec->isMaster to ->type.
isMaster is not enough as long as we differ between master pointers and
keyboard. With flexible device classes, the usual checks for whether a
master device is a pointer (currently check for ->button, ->valuators or
->key) do not work as an SD may post an event through a master and mess this
check up.

Example, a device with valuators but no buttons would remove the button
class from the VCP and thus result in the
IsPointerDevice(inputInfo.pointer) == FALSE.

This will become worse in the future when new device classes are introduced
that aren't provided in the current system (e.g. a switch class).

This patch replaces isMaster with "type", one of SLAVE, MASTER_POINTER and
MASTER_KEYBOARD. All checks for dev->isMaster are replaced with an
IsMaster(dev).
2009-05-22 15:44:50 +10:00
Peter Hutterer
add2defac7 Split the signal-handler's lastSlave out into a separate variable.
dev->u.lastSlave was not signal safe since it was accessed by the DIX and
during signal handling.
Replaced with:
'dev->last.slave' for the signal handler's lastSlave (used to generate
                  DeviceChangedEvents), .
'dev->u.lastSlave' for the DIX lastSlave (currently only used in
                   change_modmap)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22 15:44:03 +10:00
Peter Hutterer
73c7398aaf dix: 'namespace' HAS_OLD_SLAVE and HAS_NEW_SLAVE.
We need more flags for this in the near future, so let's namespace them now.
2009-05-21 11:59:17 +10:00
Peter Hutterer
c2785ae7eb dix: refuse events from disabled devices.
If the device is disabled ("off"), it must not send events to a client.
The driver shouldn't send events in that case anyway, but just to make sure
we simply drop events coming while the device is disabled.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-20 16:22:24 +10:00
Peter Hutterer
00bc043fa0 dix: export subpixel precision in XI2 events for root/event coordinates.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-08 14:33:50 +10:00
Peter Hutterer
4318075140 dix: store subpixel precision and send it down the wire to the client.
For the valuator data, not yet for root x/y and event x/y.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-19 22:17:07 +10:00
Peter Hutterer
4cc6a96d71 input: add support for RawDeviceEvents. 2009-03-20 15:17:56 +10:00
Peter Hutterer
0befeb36c1 dix: Add device info to DeviceChangedEvent, and fill in CCCE.
We need to fill the info here, as the device may change until we get a chance
to process it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 15:17:55 +10:00
Peter Hutterer
d60391d8ca dix: fix uncredible fail in PostSyntheticMotion.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 14:48:57 +10:00
Peter Hutterer
7f1ba804a1 dix: s/numEvents/num_events/ in GetKeyboardValuatorEvents
GPE and GProxE use the same.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-12 11:03:29 +10:00
Peter Hutterer
59bc615ed2 dix: set the valuator mode in set_valuators
We only have per-device mode for now anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-25 14:50:55 +10:00
Peter Hutterer
d3b355875a dix: fix wrong condition for setting valuators on the event.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-24 11:20:23 +10:00
Peter Hutterer
bdc262701a dix: remove un-used getValuatorEvents and countValuatorEvents from getevents.c
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer
085d503608 dix: Fix PostSyntheticMotion to use a DeviceEvent for posting.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer
4026c63e4e mi: switch the EQ to contain InternalEvents only.
This gets rid of the nevents parameter, InternalEvents are always a single
item per event. Also remove the special DeviceValuator handling in both
enqueueing and dequeueing.

Custom callback handlers are now broken until fixed.

For bisectability, we copy the InternalEvent back into the XI required during
POE and friends. Consider this a temporary solution.

Note: Because of misc linker bonghits, Xvfb won't link in this revision.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:39 +10:00
Peter Hutterer
5a827593f9 dix: switch event generation to InternalEvents.
GPE, GKVE, GProxE generate InternalEvents now.
DeviceClassesChangedEvents generates an InternalEvent now, but incomplete! We
need to tack on the information about the new SD in the ClassesChanged events.

Note: To make the progress bisectable, we drop back into XI events at the end of the
Get*Events functions. So the rest of the server still uses XI events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:39 +10:00
Peter Hutterer
a7e6424d99 dix: remove obsolete comment. Event lists should not be allocated by the DDX 2009-01-27 09:29:03 +10:00
Daniel Stone
18e51911f5 Input: Add postdown to ButtonClassRec
This mirrors that in KeyClassRec: the state of the buttons as posted to
GetPointerEvents, rather than the state of the buttons as processed by
ProcessOtherEvent and friends.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:09:00 +11:00
Daniel Stone
32db27a7f8 Input: Remove modifierMap from core
We already have modmap (in the exact same format!) in XKB, so just use
that all the time, instead of duplicating the information.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:55 +11:00
Daniel Stone
f062e90a95 Input: Remove modifierKeyMap
Since modifierKeyMap is generated from modifierMap, just remove it, and
only generate it when we need to send the modifier map to the client.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:55 +11:00
Daniel Stone
40877c6680 XKB: Make XKB mandatory
No more #ifdef XKB, because you can't disable the build, and no more
noXkbExtension either.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:06:25 +11:00
Daniel Stone
07c3bb922b XKB: Move XkbCopyKeymap definition to xkbsrv.h
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-20 15:32:18 +11:00
Peter Hutterer
d36adf52a2 dix: fix WarpPointer calls for devices with custom valuator ranges (#19297)
If the MD's lastSlave was a devices with custom axes ranges, then a
WarpPointer would position the cursor at the wrong location. A WarpPointer
request provides screen coordinates and these coordinates were scaled to the
device range before warping.

This patch consists of two parts:
1) in the WarpPointer handling, get the lastSlave and post the event through
   this device.
2) assume that WarpPointer coordinates are always in screen coordinates and
   scale them to device coordinates in GPE before continuing. Note that this
   breaks device-coordinate based XWarpDevicePointer calls (for which the spec
   isn't nailed down yet anyway) until a better solution is found.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-13 09:22:56 +10:00
Peter Hutterer
56efbc0986 dix: drop x/y back into last.valuators before updating the history (#19285)
positionSprite needs to scale to screen coordinates and in the process of
doing so alters dev->last.valuators[0:1]. Drop the real coordinates back after
finishing and before updating the motion history. This way, we don't push the
screen coordinates into the motion history.

X.Org Bug 19285 <http://bugs.freedesktop.org/show_bug.cgi?id=19285>
2009-01-12 11:44:10 +10:00
Peter Hutterer
a3f9e887d9 dix: don't accept Button 0 presses in GPE. 2009-01-09 16:08:37 +10:00
Peter Hutterer
689be0cb4b dix: set the correct length in CreateClassesChangedEvent.
Fallout from aeff14d5f2. Yes, we don't malloc
anymore because we are inside a SIGIO and the memory is already there anyway.
But we still need to set the event length correctly, otherwise
mieqEnqueue/mieqProcessInputEvent don't know how much memory to copy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-12-18 09:58:42 +10:00
Peter Hutterer
aeff14d5f2 dix: don't alloc in ChangeMasterDeviceClasses.
We mustn't realloc as we are inside a signal handler. With
SetMinimumEventSize, this code should never be hit anyway, as the event list
should have the required memory before this code is hit.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-12-12 11:43:32 +10:00
Peter Hutterer
cb95642dc8 Remove #define NEED_EVENTS and NEED_REPLIES
A grep on xorg/* revealed there's no consumer of this define.

Quote Alan Coopersmith:
"The consumer was in past versions of the headers now located
in proto/x11proto - for instance, in X11R6.0's xc/include/Xproto.h,
all the event definitions were only available if NEED_EVENTS were
defined, and all the reply definitions required NEED_REPLIES.

Looks like Xproto.h dropped them by X11R6.3, which didn't have
the #ifdef's anymore, so these are truly ancient now."

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2008-12-12 11:43:32 +10:00
Peter Hutterer
0b4fef6337 dix: move MAX_VALUATOR_EVENTS into include/input.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-12-10 12:42:45 +10:00
Peter Hutterer
ee1a6c2841 dix: fix calculation of valuator events.
Follow-up to 4971315296. countValuatorEvents was copied from GKVE where it
was obviously broken but nobody noticed. GPE had the correct version, but that
one got lost during de-duplication. Restoring the correct calculation - if we
have 6 valuators, we want 1 valuator event, not 2.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-12-08 12:05:52 +10:00
Paulo Cesar Pereira de Andrade
49f77fff14 Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.

  This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)

  LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.

  xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
Peter Hutterer
e670fd8896 dix: fix GetMaximumEventsNum(), may return a DCCE event too.
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-12-03 16:10:40 +10:00
Peter Hutterer
5d02e580d7 dix: use UpdateFromMaster in GetProximityEvents.
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-12-02 15:50:38 +10:00
Paulo Cesar Pereira de Andrade
d6cbd4511e Export symbols defined in the sdk.
This is the biggest "visibility" patch. Instead of doing a "export"
symbol on demand, export everything in the sdk, so that if some module
fails due to an unresolved symbol, it is because it is using a symbol
not in the sdk.

  Most exported symbols shouldn't really be made visible, neither
advertised in the sdk, as they are only used by a single shared object.

  Symbols in the sdk (or referenced in sdk macros), but not defined
anywhere include:
XkbBuildCoreState()
XkbInitialMap
XkbXIUnsupported
XkbCheckActionVMods()
XkbSendCompatNotify()
XkbDDXFakePointerButton()
XkbDDXApplyConfig()
_XkbStrCaseCmp()
_XkbErrMessages[]
_XkbErrCode
_XkbErrLocation
_XkbErrData
XkbAccessXDetailText()
XkbNKNDetailMaskText()
XkbLookupGroupAndLevel()
XkbInitAtoms()
XkbGetOrderedDrawables()
XkbFreeOrderedDrawables()
XkbConvertXkbComponents()
XkbWriteXKBSemantics()
XkbWriteXKBLayout()
XkbWriteXKBKeymap()
XkbWriteXKBFile()
XkbWriteCFile()
XkbWriteXKMFile()
XkbWriteToServer()
XkbMergeFile()
XkmFindTOCEntry()
XkmReadFileSection()
XkmReadFileSectionName()
InitExtInput()
xf86CheckButton()
xf86SwitchCoreDevice()
RamDacSetGamma()
RamDacRestoreDACValues()
xf86Bpp
xf86ConfigPix24
xf86MouseCflags[]
xf86SupportedMouseTypes[]
xf86NumMouseTypes
xf86ChangeBusIndex()
xf86EntityEnter()
xf86EntityLeave()
xf86WrapperInit()
xf86RingBell()
xf86findOptionBoolean()
xf86debugListOptions()
LoadSubModuleLocal()
LoaderSymbolLocal()
getInt10Rec()
xf86CurrentScreen
xf86ReallocatePciResources()
xf86NewSerialNumber()
xf86RandRSetInitialMode()
fbCompositeSolidMask_nx1xn
fbCompositeSolidMask_nx8888x0565C
fbCompositeSolidMask_nx8888x8888C
fbCompositeSolidMask_nx8x0565
fbCompositeSolidMask_nx8x0888
fbCompositeSolidMask_nx8x8888
fbCompositeSrc_0565x0565
fbCompositeSrc_8888x0565
fbCompositeSrc_8888x0888
fbCompositeSrc_8888x8888
fbCompositeSrcAdd_1000x1000
fbCompositeSrcAdd_8000x8000
fbCompositeSrcAdd_8888x8888
fbGeneration
fbIn
fbOver
fbOver24
fbOverlayGeneration
fbRasterizeEdges
fbRestoreAreas
fbSaveAreas
composeFunctions
VBEBuildVbeModeList()
VBECalcVbeModeIndex()
TIramdac3030CalculateMNPForClock()
shadowBufPtr
shadowFindBuf()
miRRGetScreenInfo()
RRSetScreenConfig()
RRModePruneUnused()
PixmanImageFromPicture()
extern int miPointerGetMotionEvents()
miClipPicture()
miRasterizeTriangle()
fbPush1toN()
fbInitializeBackingStore()
ddxBeforeReset()
SetupSprite()
InitSprite()
DGADeliverEvent()

  SPECIAL CASES
o defined as _X_INTERNAL
	xf86NewInputDevice()
o defined as static
	fbGCPrivateKey
	fbOverlayScreenPrivateKey
	fbScreenPrivateKey
	fbWinPrivateKey
o defined in libXfont.so, but declared in xorg/dixfont.h
	GetGlyphs()
	QueryGlyphExtents()
	QueryTextExtents()
	ParseGlyphCachingMode()
	InitGlyphCaching()
	SetGlyphCachingMode()
2008-11-29 23:56:06 -02:00
Peter Hutterer
4971315296 dix: clean up GetPointerEvents and GetKeyboardValuatorEvents.
Split into several functions, remove some stale comments.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-04 16:02:25 +10:30
Daniel Stone
d9ff20e323 DIX: Remove unnecessary prototype
We don't call XkbCopyKeymap from getevents.c anymore, so axe it.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-04 16:01:42 +10:30
Peter Hutterer
5d0a945a03 dix: SwitchCorePointer is long gone, bury it. 2008-10-31 17:09:13 +10:30
Tiago Vignatti
d1bb5e3b47 mi: functions here are carrying 'time' without need. 2008-10-08 03:41:17 -03:00
Peter Hutterer
9c8a2be2c7 dix: fix axis scaling.
For two axes [a, b] and [x, y] (inclusive), the formula to scale point P(ab)
to (x,y) is:
    (P - a)/(b - a) * (y - x) + x

And the whole end result rounded of course to get the integer we need.
2008-10-03 15:27:07 +09:30
Peter Hutterer
93ef72fa26 dix: don't lose subpixel precision when scaling.
Only scale x/y back from screen range if we have crossed screen, otherwise
leave it as it is.
2008-10-03 15:27:07 +09:30
Peter Hutterer
609c04b62b dix: stick a warning in about loss of subpixel precision. 2008-08-15 14:52:13 +09:30
Peter Hutterer
465a9bb96e dix: don't try to create events if we don't have a screen. #16898
A NULL screen may happen during server shutdown, when the output has been shut
down but the devices still generate events.

X.Org Bug 16898 <http://bugs.freedesktop.org/show_bug.cgi?id=16898>
2008-08-08 17:37:06 +09:30
Peter Hutterer
6ca34549b8 dix: remove obsolete FIXME comment.
Thanks to Simon Thum for pointing this out.
2008-08-08 16:19:20 +09:30
Simon Thum
c9eb0e870c Add support for multiple pointer acceleration schemes. #8583
Available acceleration schemes:
 - xorg classic scheme.
 - the new "Predictable" polynomial accel scheme.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-07-13 20:54:33 +09:30
Ander Conselvan de Oliveira
c42427f63f Fix incorrect test regarding keyboard map.
In the map stored in each keyboard device, the first line refers to
minimum keycode, i.e., the 0th line refers to keycode 8. When not
using XKB the wrong test caused some keys to be interpreted as
locks ('m' for instance). The had to be pressed twice to generate
both KeyPress and KeyRelease events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-07-10 17:27:13 +09:30
Peter Hutterer
3a2beb2f86 dix: InitEventList does not need to be _X_EXPORT. 2008-06-25 20:03:31 +09:30
Keith Packard
8c9234a163 Xi: avoid double button mapping.
Button events were mapped once in GetPointerEvents and then again in
UpdateDeviceState. While it might make sense to just fix up UpdateDeviceState,
it turns out to be better to leave the raw button number in the event because
DGA reports raw device events without button translation, and so when it calls
UpdateDeviceState, the button down counts get scrambled and buttons get stuck
down.

See also:
http://lists.freedesktop.org/archives/xorg/2008-June/036201.html

Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-06-15 11:47:24 +09:30
Eamon Walsh
c448460fdc Fix "warning: pointer targets in assignment differ in signedness". 2008-06-13 21:05:26 -04:00
Eamon Walsh
17ed6242e7 Fix "warning: assignment from incompatible pointer type". 2008-06-13 21:03:17 -04:00
Peter Hutterer
a7ae9cbd78 dix: don't read valuators past numAxes. 2008-06-02 10:25:52 +09:30
Peter Hutterer
6cecae0e86 dix: Remove superfluous comment.
This code can handle devices with < 2 valuators now.
2008-05-31 17:42:06 +09:30
Peter Hutterer
5fe57787fa dix: store the absolute values in the motion history.
The core protocol requires absolute values and it's a bit hard to get them if
we only have relative ones in the history. Switch the motion history to
absolute, and if we really need the relative values, we can probably generated
them from the abs. ones in the future.
2008-05-26 17:27:32 +09:30
Peter Hutterer
1883485edd If core motion history is required, scale back to screen coords and INT16. 2008-05-26 17:22:25 +09:30
Peter Hutterer
0b88510069 Ensure the motion history is merged for master devices.
Add each event to the master's MH as well as to the SDs. In the MD, store
min/max and the actual value. When retrieving the MH, rescale all coordinates
to the current coordinate range and only post those valuators that are
currently active on the device.
2008-05-26 15:55:20 +09:30
Peter Hutterer
d22c25bda4 dix: Allocate MD's motion history to be large enough for potential valuators
Since we can't predict how many valuators may be in a future SD attached to an
MD, we need to preallocate a history buffer that is large enough to keep
MAX_VALUATORS coordinates per event.

In addition, the history buffer needs to memorize the coordinate ranges at the
time, thus requiring MDs to store (min_val, max_val, current_val, time)
instead of (current_val, time) for each motion history entry.

This commit only fixes the allocation.
2008-05-26 09:26:18 +09:30
Peter Hutterer
0877de13ac Remove GetMotionProc from ValuatorClassRec.
With the MD/SD device hierarchy we need control over the generation of the
motion history as well as the conversion later before posting it to the
client. So let's not let the drivers change it.

No x.org driver currently uses it anyway, linuxwacom doesn't either so dumping
it seems safe enough.
2008-05-25 22:49:54 +09:30
Peter Hutterer
3ae0f4fc83 dix: update valuators > 2 as well.
master->last.valuator[x] for x > 2 is undefined. For all other devices, it's
the respective device's last valuators.

If the lastSlave did not have a valuator that is to be updated now, it is
reset to 0.
2008-05-23 15:52:40 +09:30
Peter Hutterer
7eec1c23a3 dix: don't allow relative data in deviceValuators.
In GPE, we don't care about the device mode. Let's put the absolute values
into the deviceValuator event and worry about relative valuators on the other
side of the EQ.
2008-05-23 13:23:02 +09:30
Peter Hutterer
fe59b1a62b dix: more device scaling insanity.
Assuming master->last.valuators is in screen coords, SD's are always in device
coordinates.

1. If an event comes in, scale masters->last to the device, drop into device's
last->valuators.
2. Apply motion from the actual event
3. Scale back to screen coords, check if we may need to cross screens
4. Drop screen coords into master->last
5. Rescale to device coords, drop into deviceValuator event and SD->last
6. Drop screen coords into ev->root_x/y

Whoopee...
2008-05-23 12:51:52 +09:30
Peter Hutterer
6c9e9f8a40 input: instead of lastx/y, use a last.valuators[] array on the device.
During GetPointerEvents (and others), we need to access the last coordinates
posted for this device from the driver (not as posted to the client!). Lastx/y
is ok if we only have two axes, but with more complex devices we also need to
transition between all other axes.

ABI break, recompile your input drivers.
2008-05-23 12:01:37 +09:30
Peter Hutterer
fb146cbb0f dix: coreEvents doesn't have meaning here, use master instead.
We mustn't clip x/y if we are attached, otherwise we can't change screens.
2008-05-23 12:01:09 +09:30
Magnus Vigerlöf
fc1cc0adcb dix: Cleanup of GetPointerEvents
Changed all the checks for x&y valuator so the more complex
calculation is only made once.
Added TODOs for valuator/axis 2 and above for future correct
handling of relative reporting of these.

Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-05-23 09:33:09 +09:30
Magnus Vigerlöf
a0241d5380 dix: Correct clipAxis so it can handle devices with value ranges properly
Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-05-23 09:30:43 +09:30
Peter Hutterer
7f85acdf70 dix: fill valuators with the correct values depending on the device mode (GPE)
valuators[] is passed from the DDX. Depending on the device mode, update it
with either absolute values or relative values. The deviceValuator event sent
to the client will then contain the respective values.
2008-05-22 23:27:15 +09:30
Magnus Vigerlöf
0f15875a27 Make all conversion handling in GPE.
This isn't quite finished yet, but at least it gives us the ability to use a
tablet as a normal mouse - with all the scaling in place.

Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-05-22 19:22:46 +09:30