Commit Graph

1261 Commits

Author SHA1 Message Date
Peter Hutterer
97e3f4316b dix: auto-float SD's with SendCoreEvents "false"
AlwaysCore and SendCoreEvents specify whether a device is to send core
events. A device that has either disabled is not supposed to send core
events.

With MPX/XI2, a device that is attached automatically sends core events when
the event is routed through the master device. Floating a slave device
disables core events by breaking the route.

This patch automatically floats devices that have coreEvents disabled in the
xorg.conf/HAL. This replicates the behaviour of a SendCoreEvents "false"
device in server 1.6 and earlier.

The devices may still be reattached to a master at runtime.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-09 10:31:23 +10:00
Peter Hutterer
d8aadfa5af dix: remove unused and half-broken code to restore original classes.
In theory, the MD should change back to its old, original classes when the
last SD is detached. Thanks to the XTEST devices, we'll always have an SD
attached until the MD is removed.  So let's not worry about that and do
nothing instead of having some code that's essentially untested.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-09 10:31:11 +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
9005ec4ce1 dix: remove dixLookupResource - we don't have any users left.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
2009-09-07 10:51:16 +10:00
Peter Hutterer
219ae5b628 dix: hide the sequenceNumber key repeat hack behind two functions.
Just in case we figure out a better way to do it in the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-04 12:59:43 +10:00
Daniel Stone
bfb219f532 input: allow for detectable autorepeat.
For core and XI1 events, store the key_repeat flag in the sequence number
until TryClientEvents. The sequenceNumber is unset until TryClientEvents.

[Also thrown in, some random indentation changes. Thanks]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-04 12:59:41 +10:00
Daniel Stone
3d988e01e4 dix: improve code flow in TryClientEvents, better debugging messages.
Instead of a massive if (blah && blah), return early where possible.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-04 12:59:40 +10:00
Peter Hutterer
f04fe06ae2 dix: don't return BadMatch from GetProperty (#23562)
dixLookupWindow may return BadMatch if the window in question isn't actually
a window. In this case, GetProperty needs to return BadWindow - not
BadMatch.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03 14:19:35 +10:00
Peter Hutterer
993ca5acbd dix: when unsetting a cursor, update the sprite immediately (#23608)
Removing the device cursor while the cursor was within the window did not
update the visible sprite until the next enter/leave event.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03 08:39:27 +10:00
Peter Hutterer
0e4dd3b2d2 Un-export ApplyPointerMapping. This is an in-server function.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03 08:39:26 +10:00
Eamon Walsh
a470e8426e Correct outdated e-mail address in "Author" statements.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-09-02 17:56:52 -04:00
Eamon Walsh
0f3a64c3a5 Add DRI2 requests to protocol.txt
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-08-28 23:29:05 -04:00
Peter Hutterer
903c3db1d1 Xext: rename Xtst* to XTest*
This patch corrects a misnaming of XTest-related functions.

The extension itself announces itself as XTEST. Xtst is the library name
itself, but all library functions are prefixed by XTest. Same with the
naming in the server.

- Rename all *Xtst* functions to *XTest* for consistency with the library
  and in-server API.
- Rename the "Xtst device" property to "XTEST device" for consistency with
  the extension naming.
- Rename the device naming to "<master device name> XTEST device". The
  default xtest devices become "Virtual core XTEST pointer" and "Virtual
  core XTEST keyboard".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-27 14:24:51 +10:00
Peter Hutterer
8bfd23e144 input: move XTest device initialization into Xext/xtest.c
XTest devices are non-optional but nonetheless specific to the XTEST
extension.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-27 14:24:50 +10:00
Peter Hutterer
a95f80fa91 dix: use IsXtstDevice instead of the direct key lookup.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-27 14:24:50 +10:00
Jeremy Huddleston
0f613007cd CheckWindowOptionalNeed: Ensure w->optional is set to avoid SEGFAULT
If CheckWindowOptionalNeed is called consecutively (and the first removes optional), then
we will SEGFAULT.  This can happen in XQuartz because ReparentWindow will call
pScreen->ReparentWindow which can DeleteProperty which will CheckWindowOptionalNeed... then
ReparentWindow will call it again later indiscriminantly.
(cherry picked from commit b608c864cc)
2009-08-25 20:16:20 -07:00
Keith Packard
e7dd1efef4 Ensure that rotation updates happen frequently
The smart scheduler is designed to minimize scheduler overhead by
increasing the interval between WaitForSomething calls when a single
client is running. However, the software rotation code depends on
its BlockHandler being invoked for screen updates; the long delays
caused by the smart scheduler optimizations means that screen updates
can be delayed a long time as well.

The change is simple -- prevent the smart scheduler from increasing
the scheduling interval while any screen is using software rotation.

Signed-off-by: Keith Packard <keithp@keithp.com>
2009-08-25 18:14:19 -07:00
Peter Hutterer
80f18a7326 input: move CorePointer/KeyboardProc declarations into header.
The extern declaration in xichangehierarchy.c was broken anyway.
This fixes a crash on creating a new master device.

Reported-by: Maxim Levitsky
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24 10:09:23 +10:00
Peter Hutterer
ef75301854 dix: FixUpEventFromWindow mustn't scramble non-device events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24 10:06:37 +10:00
Richard Hughes
6b5978dcf1 Do not reset lastDeviceEventTime when we do dixSaveScreens
When we turn off DPMS with DPMSModeOff and do dixSaveScreens, don't reset the
event time else session clients using IDLETIME will be reset.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-18 10:51:31 +10:00
Eamon Walsh
d4b8f7602b xace: fix access mode in dixLookupWindow call within ProcUngrabKey.
Referencing a window (as grab-window) only requires GetAttr access.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-08-17 14:51:11 -04:00
Eamon Walsh
6d2f4e4878 Add XI2 requests to protocol.txt
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-08-17 14:51:11 -04: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
dca4de72d3 dix: fix potential use of unused variable 'mask'.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17 10:14:20 +10:00
Peter Hutterer
3989dc1d34 dix: use the XI2 defines for class types.
Doesn't matter really, they have the same values anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17 10:14:20 +10:00
Peter Hutterer
fe045820f1 input: move DeviceChangedEvent conversion into eventconvert.c
The version in eventconvert.c was half broken and for some reason we ended
up with a second version in exevents.c (which works). Move it over to where
it belongs and call EventToXI2 instad of having a custom function for it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17 10:14:20 +10:00
Peter Hutterer
6c292d1705 dix: update the sprite trace for all masters && floating slaves (#23257)
When the windows are restructured, CheckMotion needs to be called for all
masters and floating slaves to update the spriteTrace.

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

Tested-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-14 14:39:56 +10:00
Peter Hutterer
c477ac8a15 dix: re-name internal eventToClassesChanged to eventToDeviceChanged
DeviceClassesChangedEvents (where this name comes from) have been replaced
with DeviceChangedEvents.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13 11:19:36 +10:00
Peter Hutterer
59dc59a72f test: add XI2 eventconversion test for raw events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13 11:19:35 +10:00
Soren Sandmann Pedersen
211511f150 Disable the out-of-bounds workaround in pixman.
This workaround was necessary for older X servers, but now fb should
be using correct coordinates.

Also bump pixman requirement to 0.15.20.
2009-08-11 14:40:42 -04:00
Peter Hutterer
3abbd327f4 dix: detach SD during XI2 grabs only.
XI1 grabs on slave devices leave the device attached - just like in earlier
versions of XI.

Tested-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-06 10:05:12 +10:00
Peter Hutterer
c29aa7da22 Revert "dix: Remove temporary detachment of slave devices."
This reverts commit 0c0ef42292.

Tested-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-06 10:05:12 +10:00
Alan Coopersmith
95b678e6dc Correct modifier map built when ProcSetModifierMapping is called
Fixes xmodmap changes to modifiers to stop corrupting modifier maps

Previous code had two bugs:
 - the code to increment mod was after the code to continue if no
   modifier was set, so mod wouldn't be incremented for modifiers
   with no keys mapped to them (such as if you called
   xmodmap -e 'clear Lock')
 - the value it set in the modifier map was the raw modifier number,
   not the bitmask value for that modifier

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-05 11:15:54 +10:00
Peter Hutterer
26b83ad4a2 dix: require PointerProc and KeyboardProc to be passed into AllocDevicePair.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-05 09:33:15 +10:00
Peter Hutterer
d3e5629fac dix: call SetFocusOut and LeaveWindow when disabling a device.
PointerWindows[x] would be set after removing a master pointer. Destroying
this window then crashed the server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-03 10:11:48 +10:00
Peter Hutterer
97ed946cfc dix: SetFocusOut and LeaveWindow don't need parameters other than dev.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-03 10:11:48 +10:00
Peter Hutterer
46ac9f9241 dix: pass the sourceid around for enter/leave events.
The sourceid for enter/leave events as a result of pointer motion is the ID
of the slave device. The sourceid for those as a result of a grab activating
is the device itself.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 11:04:28 +10:00
Peter Hutterer
c299b2228f dix: remove obsolete comment, parameter described doesn't exist.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:14 +10:00
Peter Hutterer
5085ac09a5 input: switch internal event types to enums.
Use enum EventType instead of ints. This requires a load of default
cases in various switch statements to silence compiler warnings.

Reported-by: Aaron Plattner
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:14 +10:00
Peter Hutterer
845e65f080 xkb: move XkbFilterEvents to xkbsrv.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:14 +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
Aaron Plattner
587c3a2d19 Bug #22804: Reject out of bounds XGetImage requests
The XGetImage man page states:

    If the drawable is a window, the window must be viewable, and it must be the
    case that if there were no inferiors or overlapping windows, the specified
    rectangle of the window would be fully visible on the screen and wholly
    contained within the outside edges of the window, or a BadMatch error
    results.  Note that the borders of the window can be included and read with
    this request.

However, the server was only checking the requested region against the screen
bounds, allowing XGetImage requests to read pixels outside the bounds of a
window's ancestors.  Normally, this would just read other pixels from the
screen, but if one of the ancestor windows is redirected, the window's backing
pixmap may be smaller than the window itself.

This change checks the region against the window's bounding drawable, which is
either the screen pixmap, a redirected window's backing pixmap, or the root
window for servers that don't support GetWindowPixmap.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2009-07-22 12:52:49 -07:00
Peter Hutterer
ecd618957e dix: fix null-pointer dereference on activating enter/focus grabs.
EventToXI2 returns a NULL event for enter/focus events since these events
aren't yet wrapped into internal events. This is a quickfix only, it works
thanks to the alignment of internal and XI2 event types.

Eventually, enter/leave events should be wrapped into internal events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-22 15:27:16 +10:00
Peter Hutterer
48585bd1e3 dix: use the event mask of the grab for TryClientEvents.
A client that grabs for button/key events may not have the
ButtonPress/KeyPress mask set and should not receive an event in that case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-22 12:13:05 +10:00
Pierre Willenbrock
4dc91b3e54 Check if new space was actually allocated before freeing.
There will be no new space allocated, if mode != PropModeReplace and
len == 0, or if mode is not one of the handled modes.
This fixes freeing data that is still in use, leading to double frees and
other memory corruption.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-22 12:13:04 +10:00
Peter Hutterer
9a1bfa5664 input: remove XI2 keysym grabs, use keycode grabs instead.
Keysym grabs are tricky in the details, keycode grabs are known to work. So
for now, provide keycode grabs only.

Requires inputproto 1.9.99.15.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-22 12:12:51 +10:00
Gaetan Nadon
7b9915b11e dix: xserver "make dist" fails due to eventconvert.h (#27825)
This header file is not in the /dix dir, but in the /include dir.
The makefile aborted and the xserver distribution files were not created.
The fix is to remove this header file from the libdix_la_SOURCES
in the dix/Makefile.am.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-19 20:01:12 +10:00
Oliver McFadden
b5f6da1e9b Revert "Coverity Prevent: RESOURCE_LEAK in AccelSetProfileProperty:"
This reverts commit 7333dc2969.

False positive.
2009-07-17 06:34:00 +03:00
Oliver McFadden
7333dc2969 Coverity Prevent: RESOURCE_LEAK in AccelSetProfileProperty:
Event alloc_arg: Called allocation function "XIPropToInt" on "ptr" [details]
167  	    rc = XIPropToInt(val, &nelem, &ptr);

Event leaked_storage: Variable "ptr" goes out of scope
2009-07-16 19:03:14 +03: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
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