Commit Graph

1261 Commits

Author SHA1 Message Date
É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
d3f6b43a24 Update to xextproto 7.0.99.1.
xextproto had Xlib client headers moved into libXext.
Protocol header files are named fooproto.h, header files with constants
foo.h or fooconst.h where foo.h was already in use for client-side headers.
2009-07-15 17:00:05 +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
975bf60a82 dix: use sizeof(FP3232) instead of 2 * sizeof(int32_t).
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
Peter Hutterer
2d35ea8d95 dix: switch to byte-counting functions.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-14 10:05:54 +10:00
Peter Hutterer
2c535b6f13 dix: don't send presence events for attaching/detaching slave devices.
The code that didn't list attached slave devices for XI1 clients doesn't
exist anymore, so there's no need for these presence events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-14 09:00:35 +10:00
Peter Hutterer
0c0ef42292 dix: Remove temporary detachment of slave devices.
Previously, an active grab on an attached slave device would send the device
floating for the duration of the grab. This breaks existing XI applications
(e.g. the GIMP) since they grab all devices automatically - resulting in the
loss of control over the VCP.

The behaviour of extended input devices during a grab in relation to the
core pointer is not specified in the XI protocol specification.
The removal of the temporary detachment restores the behaviour of extended
input devices as present in currently released servers - even if a device is
grabbed, an event from this device will result in an event from the core
pointer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-12 21:54:35 +10:00
Peter Hutterer
9f1570c8f4 input: include effective modifiers in device events.
Require inputproto 1.9.99.13

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-12 16:57:08 +10:00
Peter Hutterer
183c075d2f dix: always init the full button map to default values (#22594)
Master devices must have the standard button map applied for all buttons to
ensure buttons larger than 7 (the default for MDs) are mapped appropriately.

We can't copy the button map from SDs to MDs since that breaks the chained
button mapping. However, by ensuring all buttons (even non-existing ones)
are mapped, devices that send such buttons continue to work.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-06 12:58:03 +10:00
Peter Hutterer
50a2a8dc76 Fix IsXtstDevice - returns false positives since 0814f511d5.
Missing check for the value of 'mid' returned false positives if master was
NULL.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-03 09:20:59 +10:00
Peter Hutterer
e13605ea40 dix: introduce "Xtst Device" label property.
Xtst devices get this property assigned automatically so they can be
detected easily by a client.
The property is read-only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-01 08:46:31 +10:00
Peter Hutterer
0814f511d5 input: store the master device's ID in the devPrivate for XTest devices.
Rather than storing a simple boolean in the devPrivate for XTest devices,
store the actual master device's id (since it is constant for the life of
the device anyway).

Callers should use GetXtstDevice now instead of digging around in the
devPrivates themselves.

This patch allows for a cleanup in the creation of new master devices since
GetMaster and GetXtstDevice spare the need for loops, IsPointer checks and
similar.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Close <Benjamin.Close@clearchain.com>
2009-07-01 08:46:31 +10:00
Peter Hutterer
1bcc0d3c24 input: abstract Xtst device lookup
The callers should need to use the dev privates key to look up xtest
devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Close <Benjamin.Close@clearchain.com>
2009-07-01 08:46:31 +10:00
Peter Hutterer
34424fab9a dix: set the client's error value to the bad deviceid in check_butmap_change.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-01 08:46:30 +10:00
Eamon Walsh
da04e8f135 dix/property.c: use memcpy where appropriate.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-06-30 17:54:25 -04: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
Simon Thum
2830e84937 dix: rename pDev->dev, pVel->vel for consistency
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-29 12:20:49 +10:00
Simon Thum
373e8c960d dix: improve pointer acceleration API
This makes the ptr accel api actually sensible from a driver
perspective, since it avoids superfluous device lookups.
Also, makes independent accel contexts possible.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-29 12:20:48 +10:00
Eamon Walsh
31166c2ae0 xace: add a new hook for checking property content after it has been set.
Allows security modules to enforce what property contents can be set by
clients.  Uses the new DixPostAccess bit to distinguish between the
existing call made during the lookup (with the old property data) and
this new call.  Note that this only applies to writes, prepends, or
appends to existing properties; for new properties the existing
DixCreateAccess hook call may be used since it includes the new data.

Refer to the XACE-Spec document in xorg-docs, section "Property Access."

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-06-26 17:52:51 -04:00
Eamon Walsh
00bc8d34c6 Xi: check for Use permission on the device in SetClientPointer().
Presumably, some intelligent, XI2-aware management app will be calling
XISetClientPointer on behalf of other clients; this check makes sure
the target client has permission on the device.

Requires changing the prototype to return status code instead of Bool.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-23 20:50:29 -04:00
Dave Airlie
07c36e4fdc dix/resource: fix use after free in resource code with DRI
LookupClientResourceComplex is used by DRI1 code to find and free a DRI
drawable in a callback, however when the DRI code returns this->value
is now pointing at freed memory. It seemed easiest to store the value
to a temporary and return it afterwards.

Another option might be a new FreeClientResourceComplex or one that
also returns the id, so we can free it using an alternative means.

found using valgrind.

amended along ajax's suggestions
2009-06-24 10:44:11 +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
Ben Gamari
07154db4a8 Xi: Remove redundant and incorrect butmap range check
Maps are CARD8s, therefore checking for values above 255 is completely
unnecessary. Moreover, 0 is a valid value for maps, so the check wasn't
even correct to begin with. This fixes bug #22392, which was uncovered
by commit 280b7f92d7.

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-23 11:53:33 +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
e92dcb6ce0 input: unify button numbers on master devices.
Master devices provide the union of all attached slave devices' buttons,
i.e. the number of buttons on the master device is always the number of
buttons of the slave device with the highest number of buttons. When slaves
are attached or detached, the master device adjusts the button number to
reflect the new buttons.

On a slave switch, this slave's button labels are copied into the master (up
to slave->num_buttons). The remaining button labels (if any) stay as they
are. Thus, if any of the higher buttons is still pressed, it reflects the
label of the last pressed device that provided this button.

If two devices press the same button and it is differently labelled the last
pressed one will be reflected in the master device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18 15:50:47 +10:00
Peter Hutterer
280b7f92d7 dix: reduce MDs and xtest pointers to 7 buttons by default.
MD's will soon be the union of all devices anyway. XTest pointers are only
for the core protocol XTest stuff, so 7 buttons (lmr + 4 wheel buttons)
should do.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18 14:41:50 +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
Peter Hutterer
17f9723f48 input: bump to ints for deviceids - XI2 requires 16-bit deviceids.
Note: ABI break, but ABI_XINPUT_VERSION has NOT been bumped. Recompile input
drivers.

Revert "Xi: return BadImplementation for deviceids 256 and above"
This reverts commit 2b459f44f3.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18 14:40:54 +10:00
Peter Hutterer
80837dbefd input: change axisVal from uint to double.
With subpixel support, uint just doesn't cut it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18 14:40:53 +10:00
Peter Hutterer
01241b4247 Xi: Add support for sourceid in the device classes. 2009-06-17 11:21:19 +10:00
Peter Hutterer
d230742ea8 Xi: namespace XI2 files.
Some files (notably those merged with MPX before XI2 came along) didn't use
a 'xi' prefix. This patch changes all of them to meaningful names.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-17 09:05:22 +10:00
Peter Hutterer
5e0ca6fabd input: remove un-used "setter" argument from SetClientPointer.
It's obsolete, not likely to come back, let's drop it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-12 12:37:16 +10:00
Peter Hutterer
aa2babf11c input: remove dependency on XI2 protocol for XI_LASTEVENT.
inputstr includes XI2proto.h for the sole purpose of XI_LASTEVENT.
However, using XI_LASTEVENT in the server is prone to errors, if the server
is recompiled against a newer version of the protocol it would bump this
variable and associates bits, including potential ABI.

This patch defines an XI2LASTEVENT for use in the server and removes the
XI2proto.h require. XI2LASTEVENT is the current value of XI_LASTEVENT.

This patch is required by components that require access to inputInfo
(currently xf86-video-geode and xf86-video-cirrus) but should not have a
require for the XI2 protocol.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-11 13:42:49 +10:00
Dave Airlie
6d4ffcc9e0 input: move inputstr.h to where its needed.
This stops inputstr.h being needed to be included by output drivers.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-10 11:15:24 +10:00
Peter Hutterer
9390b7a133 dix: protect against missing ButtonClasses in GetPointerMapping.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-07 20:35:14 +10:00
Peter Hutterer
7348bf4935 dix: set the generic event type for implicit XI2 grabs.
event->type is always GenericEvent for XI2 events. Instead, XI_ButtonPress
(the generic event's evtype must be stored.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-07 09:31:08 +10:00
Simon Thum
bb1c131b78 dix: suppress pointer acceleration on xtest devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-07 09:31:08 +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
Eamon Walsh
da682abc78 xace: fix a bad send access hook call. 2009-06-04 17:33:25 -04:00
Peter Hutterer
993daf0649 Merge branch 'master' into xi2 2009-06-04 15:11:36 +10:00
Adam Jackson
e1e8c7ddd7 s/MIN/min/, s/MAX/max/ (#2968) 2009-06-03 13:45:42 -04:00
Peter Hutterer
eb3fe72cbc dix: set the device state for XI valuator events.
Valuator events need to include the device's state, while other device
events need to include the state of the core devices.

Reported-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-03 14:38:51 +10:00
Peter Hutterer
08fd2ae652 dix: use GetMaster in PickPointer and PickKeyboard.
GetMaster is more reliable than GetPairedDevice, it always returns the
keyboard/pointer if desired, even if the wrong device was passed in.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-03 12:19:05 +10:00
Peter Hutterer
a371a47205 dix: EventToCore must return BadMatch for proximity events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-03 11:47:26 +10:00
Peter Hutterer
2bd5ea8065 dix: rework event conversion before delivery.
Let EventToXI, EventToCore and EventToXI2 return BadMatch if there's no
matching event for this protocol spec.
Adjust the delivery paths to cope with BadMatch errors (and clean them up on
the way).

As a side-effect, this fixes server crashes on proximity events for a
grabbed device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-03 11:46:30 +10:00
Peter Hutterer
fc8cfc3a05 dix: ensure EventIsDeliverable has inputMasks set at all times.
For proximity events, the XI2 type is 0 and inputMasks never got set in the
preceding condition. As a result, proximity events got never delivered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-02 16:57:20 +10:00
Peter Hutterer
a66686a83e input: add support for XIAllDevices and XIAllMasterDevices passive grabs.
These grabs are suported through two fake devices inputInfo.all_devices and
inputInfo.all_master_devices. These devices are not part of the device list
and are only initialised for their device id, nothing else.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-02 16:02:31 +10:00
Peter Hutterer
f00cf76751 dix: get the current MD keyboard for the grab modifier state.
A passive XI2 grab always uses the paired master device as a modifier
device. After issuing a passive grab, the slave may be reattached to a
different master and hence the modifier device may change.
2009-06-02 16:02:31 +10:00
Peter Hutterer
1cd7ed75d9 dix: float slave devices during passive grabs.
Exception - implicit passive grabs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-02 16:02:29 +10:00
Peter Hutterer
f56ad22e8f dix: rework temporary slave detachment.
Rework addresses two issues:
- storing the master device's pointer is a bad idea, we need to store the ID
  of the device in case it disappears during the grab.
- restoring the old master did not actually reattach the device. Fixed now.
2009-06-02 15:53:21 +10:00
Peter Hutterer
b3e4810a28 dix: move grab device assignment into GRABTYPE_CORE block.
grab->type is the device type and XI2 types overlap with core events (being
less than GenericEvent). Thus, for passive grabs the grab device would be
overwritten with whatever device was activating it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-02 10:41:10 +10:00
Peter Hutterer
18ae486708 dix: don't try to activate a passive grab on top of an active one.
If we already have an active grab on the device, don't attempt to activate
another one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-02 10:41:10 +10:00
Peter Hutterer
ff1d6244eb input: add support for XIAnyModifier in passive XI2 grabs. 2009-06-02 10:40:59 +10:00
Peter Hutterer
80ea32ad4f dix: switch grab checking from unsigned shorts to unsigned ints
XIAnyModifier is outside of the unsigned short range.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-01 13:48:43 +10:00
Peter Hutterer
080b0331b3 input: Add grabtype to GrabParameters.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-01 13:48:43 +10:00
Peter Hutterer
bee02a1541 dix: ensure implicit passive grabs have the xi2mask zeroed.
This fixes XI2 enter/leave events being sent to non-xi2 clients.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-01 13:45:30 +10:00
Peter Hutterer
0f47203a9a dix: Set the implicit passive grab flag for keyboards too.
Extension devices have ActivateKeyboardGrab as their grab activation
function, hence we need to ensure the implicit passive grab flag is set
accordingly in the grab for further event delivery.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-29 14:19:35 +10:00
Peter Hutterer
75c73ddbfc dix: fix broken XI event delivery during grabs.
If an implicit passive grab is active, the XI event mask is in
grab->deviceMask. Otherwise, for explicit grabs, the XI event mask is in
grab->eventMask.

Reported-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-29 14:02:39 +10:00
Peter Hutterer
235cf5713a dix: init inputMasks to NULL to avoid random value dereference.
If the XI2 type is 0 (e.g. proximity events), inputMasks is never set and
may not be NULL.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-29 12:10:48 +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
d7aef3f663 Merge branch 'master' into xi2
Conflicts:
	Xext/geext.c
	Xi/chdevcur.c
	Xi/extgrbdev.c
	Xi/xiproperty.c
	configure.ac
	dix/ptrveloc.c
	hw/xfree86/common/xf86Config.c
	mi/mipointer.h
	test/input.c
	xkb/xkb.c
2009-05-28 17:20:58 +10:00
Peter Hutterer
a25f248fc3 Xi: Send Enter or Leave events with XIPassive(Un)grabNotify
If a passive enter or focus in grab activates, send additional enter or
focus events with mode XIPassiveGrabNotify to the grabbing client.
Likewise, if the grab deactivates, send additional leave or focus out
events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-28 15:02:35 +10:00
Peter Hutterer
a7e23a79c1 Xi: Add support for Enter and FocusIn grabs.
Enter grabs are checked for in CheckMotion(), each time the sprite window
changes the current grab is deactivated (if applicable) and the new grab is
activated (if applicable). Exception - if the grab is on a parent window of
the current window since we keep the grab across descendants.

Since CheckMotion() may change the grab status of a device, we mustn't get
"dev->deviceGrab.grab" in ProcessOtherEvents until after CheckMotion().
FocusIn grabs are checked in much the same manner.

The event delivery for grabs replaces the NotifyNormal on window change with
a NotifyGrab on window change. Note that this happens before the grab
activates, so the EnterNotify(NotifyGrab) is still delivered to the window,
not to the grabbing client. This is in line with the core protocol semantics
for NotifyGrab events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-27 14:40:58 +10:00
Peter Hutterer
bedfd561fa dix: fix wrong cast of eventMask into CreateGrab. 2009-05-27 13:54:19 +10:00
Peter Hutterer
b3463fd6a8 dix: convert window coordinates to FP1616 before calculating event_x/y
root_x/y are already in FP1616 at this point.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-27 13:54:19 +10:00
Peter Hutterer
10b5e98101 dix: take grabs into account for XI_Enter/Leave events. 2009-05-27 13:54:18 +10:00
Peter Hutterer
9dc3810a03 dix: set the right grab event type for implicit passive grabs.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-27 13:54:18 +10:00
Nicolai Hähnle
6583477035 Remove reference to non-existing requestLog and requestLogIndex
These fields were removed in 252ec50481.

Signed-off-by: Nicolai Haehnle <nhaehnle@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-27 10:04:28 +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
c9df51b070 input: allow for master pointers to not have a button class.
There's devices (e.g. some barcode readers) that have axes but no buttons.
When such a device sends a motion event, the valuator and button class is
copied into the master pointer (i.e. removing the button class).
So we need a couple of extra sanity checks for the button class to exist.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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
438a4eafa5 input: remove nested union from InternalEvent.
There's no need for internal events to be a struct with a single nested
union, we might as well make the union itself the InternalEvent.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22 15:44:56 +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
7db55a0806 dix: remove superfluous loop in change_modmap.
A device can only be attached to a single master device. So instead of
looping and searching for the master device, we can just use dev->u.master
directly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22 12:24:21 +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
7b891e450f dix: Remove obsolete comment
CorePointerProc doesn't back up the device classes anymore.
2009-05-20 16:22:24 +10:00
Peter Hutterer
42719ce5c7 dix: remove superfluous loop in change_modmap.
A device can only be attached to a single master device. So instead of
looping and searching for the master device, we can just use dev->u.master
directly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-20 16:22:24 +10:00
Eamon Walsh
77e90261d5 dix/events.c: Use wClient where appropriate.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-05-19 19:36:03 -04:00
Eamon Walsh
3cea176d5a xace: Fix a bad device access hook call.
Add a proper access mode, and reverse the logic of the return value.
Zero ("Success") is returned on success from the hook calls.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-05-19 19:35:46 -04:00
Peter Hutterer
5c3e728980 dix: count must be 1 if we have an XI2 match.
This fixes events that activated a grab not getting delivered to the client.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-16 12:20:59 +10:00
Peter Hutterer
8ff1bff8f4 Update to new XI2 names 2009-05-16 12:20:58 +10:00
Peter Hutterer
273890924b input: reduce the number of superfluous hierarchy events
There's only two reasons for hierarchy events:
- device is added, removed, etc. In this case we want to send the event as
  it happens.
- devices are added in a XIChangeDeviceHierarchy request. In this case we
  only want one event cumulating all changes.
2009-05-16 12:20:58 +10:00
Peter Hutterer
033a2b12fc Xi: set per-device hierarchy changed flags.
Rather than have one field per hierarchy change, XI2 has two fields - one
generic one and one per-device that include the device-specific flags.
This requires some funky handling for removed devices, but oh well.
2009-05-16 12:20:58 +10:00
Peter Hutterer
fdce58ca82 dix: ensure Activate/DeactivateGrab has a valid value.
Xephyr doesn't manually set Activate/DeactivateGrab for new devices,
resulting in a NULL-pointer dereference later when a grab is activated.
Avoid the segfault by ensuring that the pointer is always valid.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-16 12:20:58 +10:00
Peter Hutterer
6f9e220498 dix: ensure Activate/DeactivateGrab has a valid value.
Xephyr doesn't manually set Activate/DeactivateGrab for new devices,
resulting in a NULL-pointer dereference later when a grab is activated.
Avoid the segfault by ensuring that the pointer is always valid.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-16 12:01:22 +10:00
Adam Jackson
c66cf7b64c Update several of my and/or Red Hat's licenses to standard form. 2009-05-14 07:02:44 -04:00
Alan Coopersmith
b680bda34d Fix a couple off-by-one array boundary checks.
Error: Write outside array bounds at Xext/geext.c:406
        in function 'GEWindowSetMask' [Symbolic analysis]
       In array dereference of cli->nextSib[extension] with index 'extension'
       Array size is 128 elements (of 4 bytes each), index <= 128

Error: Buffer overflow at dix/events.c:592
	in function 'SetMaskForEvent' [Symbolic analysis]
       In array dereference of filters[deviceid] with index 'deviceid'
       Array size is 20 elements (of 512 bytes each), index >= 0 and index <= 20

Error: Read buffer overflow at hw/xfree86/loader/loader.c:226
	in function 'LoaderOpen' [Symbolic analysis]
       In array dereference of refCount[new_handle] with index 'new_handle'
       Array size is 256 elements (of 4 bytes each), index >= 1 and index <= 256

These bugs were found using the Parfait source code analysis tool.
For more information see http://research.sun.com/projects/parfait

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-08 12:27:11 -07: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
bae070914f input: update to inputproto 1.9.99.8 XI2 defines.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-08 14:33:44 +10:00
Simon Thum
9457ce4489 dix: remove superfluous includes from ptrveloc.c
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-08 14:33:22 +10:00
Simon Thum
ee30e1b102 dix: fix warning in pointer acceleration
newer gcc's warn against how this cast is done (though it eludes me why),
and lrintf() is also faster especially on insane processors like the P4
(http://www.mega-nerd.com/FPcast).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-08 14:33:22 +10:00
Simon Thum
3fc6fcfb26 dix: add 'none' pointer acceleration profile with number -1
This is a shorthand for disabling acceleration, while retaining the
possiblity to use constant deceleration. If constant deceleration is
also unused, it will optimize motion processing.

Other possiblities to deactivate acceleration were quite hidden,
and didn't always work as expected. E.g. xset m 1 1 would retain
adaptive deceleration, while xset m 1 0 would not (in the default
profile).

Also removes the 'reserved' profile; it was unused and it's trivial
to add new ones anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-07 16:49:06 +10:00
Simon Thum
9d1597cbef dix: remove superfluous includes from ptrveloc.c
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-07 16:49:04 +10:00
Simon Thum
35fce4e5c7 dix: fix warning in pointer acceleration
newer gcc's warn against how this cast is done (though it eludes me why),
and lrintf() is also faster especially on insane processors like the P4
(http://www.mega-nerd.com/FPcast).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-07 16:49:02 +10:00
Peter Hutterer
d220d6907d Xi: add GrabButton and GrabKeysym code.
We don't do keycode grabs in XI2, they're pointless.
2009-05-06 14:37:33 +10:00
Peter Hutterer
59358de4b6 input: ensure various ProcUngrabKey/Buttons have the right grabtype set. 2009-05-04 17:40:29 +10:00
Peter Hutterer
834ea071b6 dix: if grab types differ, two grabs cannot be the same. 2009-05-04 17:40:25 +10:00
Peter Hutterer
08cd846000 dix: only free the old cursor if the grab was successful.
Testcase: start thunderbird and move a message around, crashes after two or
three moves.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-04 15:21:38 +10:00
Peter Hutterer
6a618929a0 input: reshuffle CreateGrab and friends to take a GrabParameters param.
This is cleaning up work in preparation for XI2 passive grabs.
2009-05-01 09:07:37 +10:00
Eamon Walsh
57aff88c7d Fix most remaining deprecated resource lookups.
Callsites updated to use dixLookupResourceBy{Type,Class}.
TODO: Audit access modes to make sure they reflect the usage.
2009-04-29 01:04:37 -04:00
Peter Hutterer
c2c515ead3 dix: remove all but main() from main.c
All other functions are pushed into where they seemed to fit.
main.c is now linked separately into libmain.a and linked in by the various
DDXs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-28 16:03:56 +10:00
Peter Hutterer
987579c930 dix: remove all but main() from main.c
All other functions are pushed into where they seemed to fit.
main.c is now linked separately into libmain.a and linked in by the various
DDXs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-28 15:57:14 +10:00
Peter Hutterer
057fc9a4f8 Merge branch 'master' into xi2
Conflicts:
	Xi/chdevhier.c
	include/input.h
2009-04-24 16:15:47 +10:00
Benjamin Close
fab563bf8f input: propagate XTst events through virtual slave devices.
A XTest virtual slave device pair (kbd/ptr) exists for every master
device pair. This is so XTest events are correctly propogated via slave
devices up to Master devices and the classes are correctly changed along
the way. We add the XTest slave device pair to the Virtual Core pointer
and provide a simple way of creating the devices.

A XTest Slave Device is identified by the XTstDevicePrivateKey property
being set in the devices devProperties

XI events are still propagated through the matching device, in the hope the
client knows what it is doing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-24 15:28:33 +10:00
Benjamin Close
826a5bff01 dix: Change AllocMaster into AllocDevicePair, allow creation of SDs too.
Allocating a slave device is essentially the same as allocating a master device.
Hence we rename AllocMaster to AllocDevicePair and provided the ability to
indicate if a master or slave device pair is required.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-21 13:11:51 +10:00
Peter Hutterer
e2e5932bda dix: don't allow more than MAX_VALUATORS on one device.
Some keyboards (?) advertise more than MAX_VALUATORS axes. Parts of the
internal event delivery relies on not having more than MAX_VALUATOR axes, so
let's cap it down.
If there's real devices that require more than the current 36, I'm sure we can
bump this up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-21 13:11:51 +10:00
Julien Cristau
063833f3a6 Add XI 1.5 event and requests to protocol.txt 2009-04-20 12:50:34 +02:00
Julien Cristau
4f86ee61a4 Add RandR 1.3 requests to protocol.txt 2009-04-20 12:50:29 +02:00
Peter Hutterer
d5ad14c8ed Merge branch 'master' into xi2 2009-04-19 22:28:22 +10:00
Peter Hutterer
54716fd3db Convert to using int32_t fixed point values on the wire.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-19 22:28:12 +10:00
Peter Hutterer
129ac9a914 dix: set root_x/y for device events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-19 22:28:12 +10:00
Peter Hutterer
74d0fc3aee dix: don't allow more than MAX_VALUATORS on one device.
Some keyboards (?) advertise more than MAX_VALUATORS axes. Parts of the
internal event delivery relies on not having more than MAX_VALUATOR axes, so
let's cap it down.
If there's real devices that require more than the current 36, I'm sure we can
bump this up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-19 22:28:11 +10:00
Peter Hutterer
edb70caf21 dix: remove un-used parameter "core" from AllowSome
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-19 22:28:11 +10:00
Peter Hutterer
c94ea5bc05 input: use a GrabMask union in GrabDevice to allow for XI2 masks.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-19 22:28:11 +10:00
Peter Hutterer
09f9a86077 input: replace GrabRec's coreGrab field with grabtype.
Don't allow grabs of different types to override each other.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-19 22:28:08 +10:00
Simon Thum
cbbc7fed99 dix: correctly utilize tracker buffer and protect from timer overruns
two small related fixes hard to split up

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-19 22:19:00 +10:00
Peter Hutterer
8bf2f56267 dix: fix dev/keybd variable mixup.
Reported-by: Eric Anhold <eric@anholt.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-19 22:18:05 +10:00
Simon Thum
73b01a9aac dix: fix pointer accelerations remainder handling
This didn't really work as intended, but did amazingly well thanks
to roundf() hiding the defect. Cheers!

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-19 22:17:48 +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
Simon Thum
9212948461 dix: allow relative motion buffer to accumulate in a natural way
Since with XI2 we pass sub-pixel motion, anything else is broken.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-19 22:16:49 +10:00
Peter Hutterer
b406886bbf input: allow NULL as XkbRMVLOSet in InitKeyboardDeviceStruct.
Virtually all callers use
    XkbGetRulesDefault(&rmlvo);
    InitKeyboardDeviceStruct(..., rmlvo);

Let's save them the trouble and accept NULL as a hint to take the
default RMLVO.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Close <Benjamin.Close@clearchain.com>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-04-17 10:03:40 +10:00
Peter Hutterer
4e4e263bc0 dix: remove un-used parameter "core" from AllowSome
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-17 10:03:30 +10:00
Eric Anholt
4474c200a1 Move VENDOR_* defines from AC_SUBST to a header to avoid angering shave.
This is more sane anyway, as it ensures a rebuild when changing them.
2009-04-14 10:35:44 -04:00
Simon Thum
ff7f019bbc dix: correctly utilize tracker buffer and protect from timer overruns
two small related fixes hard to split up

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-10 13:49:51 +10:00
Simon Thum
06aebecb19 dix: fix pointer accelerations remainder handling
This didn't really work as intended, but did amazingly well thanks
to roundf() hiding the defect. Cheers!

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-10 13:49:51 +10:00
Peter Hutterer
011cee3103 dix: fix dev/keybd variable mixup.
Reported-by: Eric Anhold <eric@anholt.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-09 20:50:32 +10:00
Peter Hutterer
6c3b633299 Merge branch 'master' into xi2 2009-04-07 19:36:27 +10:00
Peter Hutterer
0cfd481308 dix: Dont change the keyboard mapping on non-keyboard devices.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-07 19:25:17 +10:00
Adam Jackson
6574ab092f DPMS: Remove the defaultDPMS* variables 2009-04-03 18:22:20 -04:00
Adam Jackson
c1cf36ee29 DPMS: Simplify command line parsing 2009-04-03 18:22:20 -04:00
Adam Jackson
d52fddefae DPMS: Align the default timeouts with the default screensaver timeout.
On a typical LCD, a black screensaver is actually worse for power
consumption than a normal screen, because it takes more energy to turn
the crystals opaque.  Also, the intermediate DPMS states are essentially
useless and most monitors alias them to the 'off' state, so we may as
well do the same.

As a pleasant side effect, this brings the default DPMS timeouts in line
with the EnergyStar Program Requirements for Computers:

http://www.energystar.gov/index.cfm?c=revisions.computer_spec

which state that products must be "shipped with the display's Sleep mode
set to activate within 15 minutes of user inactivity".
2009-04-03 18:22:20 -04:00
Adam Jackson
38576dc3ae DPMS: Simplify some macro silliness. 2009-04-03 18:22:19 -04:00
Adam Jackson
2e145989d1 dix: Simplify InitClient() 2009-03-31 15:00:27 -04:00
Peter Hutterer
e3c1096273 dix: build_modmap_from_modkeymap needs to bounds-check its argument.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-03-27 11:26:15 +10:00
Peter Hutterer
45baef0b77 dix: return BadValue as error in SetModifierMapping.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-03-27 11:26:15 +10:00
Peter Hutterer
844bb629fe dix: remove a truly useless a = (foo) ? bar : bar; statement.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-23 16:06:53 +10:00
Tomas Carnecky
62183a06e5 Remove two unused defines in C files
These two defines were defined in C files but not used anywhere:

  dix/window.c      #define DeviceEventMasks (KeyPressMask | [...]
  os/connection.c   #define MAXFD 500

Signed-off-by: Tomas Carnecky <tom@dbservice.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-23 16:06:34 +10:00
Peter Hutterer
111ef10375 dix: move ProcGrabPointer guts into GrabDevice.
Yes, this means we have even more arguments to GrabDevice. But it beats having
a copy of most but not all of GrabDevice in ProcGrabPointer.
Also, reshuffle the order of parameters, the CARD* status is a return value
and should be last.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 15:17:57 +10:00
Peter Hutterer
15a969c0fc dix: remove now obsolete mskidx parameter from DeliverEventsToWindow.
mskidx would always be dev->id anyway, so if we're already passing in the
device, mskidx is superfluous.
2009-03-20 15:17:57 +10:00
Peter Hutterer
46145a9312 dix: remove coreMods field from GrabRec.
Nobody uses it anyway, and it's taking up a whole bit!
2009-03-20 15:17:56 +10:00
Peter Hutterer
d9b7343eac dix: even if we don't get a XI1 event, continue processing. 2009-03-20 15:17:56 +10:00
Peter Hutterer
e11dc10f01 dix: Send HierarchyEvents when devices are added/removed/enabled/disabled. 2009-03-20 15:17:56 +10:00
Peter Hutterer
8634e1bcba dix: send presence events when floating and unfloating SDs 2009-03-20 15:17:56 +10:00