Commit Graph

668 Commits

Author SHA1 Message Date
Jamey Sharp
a83cff9f4d Move each screen's x/y origin into ScreenRec.
Many references to the dixScreenOrigins array already had the
corresponding screen pointer handy, which meant they usually looked like
"dixScreenOrigins[pScreen->myNum]". Adding a field to ScreenRec instead
of keeping this information in a parallel array simplifies those
expressions, and eliminates a MAXSCREENS-sized array.

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

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

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

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

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

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> (i686 GNU/Linux)
2010-06-03 14:03:23 -07:00
Jamey Sharp
e291c56182 Return an appropriately-typed error from dixLookupResourceByType.
Rather than always returning BadValue, associate an error status like
BadWindow with a resource type like RT_WINDOW, and return the
appropriate one for the requested type.

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

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

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-05-19 12:32:48 -07:00
Jamey Sharp
8033fb6c97 Set event sequence number in WriteEventsToClient instead of at callers.
TryClientEvents already did this; this commit just moves the assignment
one level down so that no event source has to worry about sequence
numbers.

...No event source, that is, except XKB, which inexplicably calls
WriteToClient directly for several events.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-05-19 12:32:34 -07:00
Jamey Sharp
4b9600a416 Make WriteEventsToClient/WriteToClient no-op on fake or dead clients.
This matches the test in TryClientEvents, and is a superset of tests
done by the callers of these functions. The consequence of forgetting
these tests is a server crash, so they're always desirable. In my
opinion, it's better to not require the callers to remember to do these
checks.

For callers that don't do very much work before calling WriteToClient or
WriteEventsToClient, I've removed the redundant checks.

hw/xquartz/xpr/appledri.c has an interesting case: While its check for
"client == NULL" appears redundant with the test in WriteEventsToClient,
it dereferences client to get the sequence number.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=27497
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-05-19 12:32:34 -07:00
Mikhail Gusarov
3f3ff971ec Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13 00:22:37 +07:00
Keith Packard
cdeb2c23f8 Fix cursor ref counting mistakes with sprites and xf86Cursor.c
A few cursor value assignments weren't getting correctly ref counted,
causing leaks of cursor objects.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-03 10:26:52 -07:00
Tiago Vignatti
4971099860 dix: wrap variables with #ifdef when panoramix is not used
this shut up some warnings.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-02 13:55:16 -07:00
Keith Packard
65e961fcc1 Replace some input devPrivates with regular struct fields
In the process, fixes a memory leak in CloseDevice, and an unchecked
memory allocation in InitializePredictableAccelerationProperties.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-04-30 13:05:11 -07:00
Jamey Sharp
54e51de8cd ProcGrabButton: remove redundant error check.
If dixLookupResourceByType did not return Success, it will have set the
pointer to NULL, so the second if will always be true.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-04-26 19:24:25 -07:00
Keith Packard
e424d58123 Merge remote branch 'whot/for-keith' 2010-04-15 15:01:34 -07:00
Tim Yamin
5f31e21961 dix: fix cursor screen check for xinerama setups.
The de-duplication of CheckPhysLimits 942eae6868 added a
condition that is invalid for a Xinerama setup. pScreen is invalid for the
Xinerama case, so comparing it to anything is a bad idea.

Signed-off-by: Tim Yamin <plasm@roo.me.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-16 07:53:14 +10:00
Peter Hutterer
9ddbb03fa5 dix: Fix crash in DeliverGrabbedEvents.
If both devices are synchronously grabbed, first with a GrabPointer, then
with a GrabKeyboard (GrabModeSync on both), sync.other of each device points
to the grab of the respective other device.

If the keyboard is then thawed through a AllowSome request, the VCK's
sync.other is reset to NULL. Subsequently, an event on the VCP would crash
the server when dereferencing sync.other on the VCP.

The check's purpose is to compare if the other device is grabbed by the same
client, which should be checked by accessing (dev->deviceGrab->grab->resource).
A check of the server-1.3 sources confirms that.

XTS test case: Xlib13 XAllowEvents 20.

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-04-15 10:26:53 -07:00
Peter Hutterer
1c612acca8 dix: if owner-events is true for passive grabs, add the window mask (#25400)
A client requesting a GrabModeSync button grab, owner-events true, with only
the ButtonRelease mask set would never receive the press event even if the
grab window had the ButtonPress mask set.

The protocol requires that if owner-events is true, then the delivery mask
is the combination of the grab mask + the window event mask.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Jim Ramsay <i.am@jimramsay.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-03-21 15:26:28 -07:00
Daniel Stone
a2ea8c2f2c Record: Avoid duplicates from replaying frozen events
Reintroduce a check which used to be there in the old
ProcessKeyboardEvent/ProcessPointerEvent codepath, which avoids us
recording events subject to a grab twice: once when it's first processed
in EnqueueEvent, and then again when it's thawed and being replayed.

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

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-03-12 13:06:22 +10:00
Peter Hutterer
f2eacb4646 Revert "dix: Use DeliverGrabbedEvent for implicit passive grabs (#25400)"
Several users have pointed out that this commit introduces regressions, most
notably perhaps fluxbox which essentially stops working after a few clicks.

This reverts commit cf72b5437d.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-03-11 08:48:50 +10:00
Peter Hutterer
cf72b5437d dix: Use DeliverGrabbedEvent for implicit passive grabs (#25400)
A client requesting a GrabModeSync button grab, owner-events true, with only
the ButtonRelease mask set would never receive the press event even if the
grab window had the ButtonPress mask set.

The protocol requires that if owner-events is true, then the delivery mask
is the combination of the grab mask + the window event mask.

DeliverGrabbedEvents does this already for us, checking first the delivery
based on owner_events and then based on the grab mask. AFAICT, the device
cannot enter the states FREEZE_BOTH_NEXT_EVENT or FREEZE_NEXT_EVENT that
would be handled by DGE in any possible path here.

Bonus point - CheckPassiveGrabsOnWindows suddenly becomes a lot lesss
complicated.

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

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-03-03 19:53:24 -08:00
Keith Packard
780c95caf9 Merge remote branch 'whot/for-keith' 2010-02-24 09:59:19 -08:00
Peter Hutterer
c0d9419131 dix: remove now-erroneous comment about frozen slave devices.
A direct grab on a slave device through XI2 detaches it, regardless of
whether the grab is sync or async. So this comment doesn't apply to XI2
anyway.

For XI1, aside from your life being miserable already, it doesn't matter as
XI1 does not have a concept of attachment. You can freeze a device and if
you don't freeze _all_ other devices at the same time, the master device can
still happily send events to the client.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Adam Jackson <ajax@redhat.com>
2010-02-23 11:25:55 +10:00
Eamon Walsh
0c4b75a089 Don't print a failure message when XACE denies an input event delivery.
A denial is normal and the behavior should be to drop the event.
Having the log message creates excessive log spam.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-02-22 17:04:26 -05:00
Eamon Walsh
e687e11b12 Revert "Remove some debug messages that trigger on XACE event delivery failure."
The log messages still need to be there for non-XACE failures.

This reverts commit 4be354c4c2.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-02-22 17:03:58 -05:00
Chris Dekter
122fc0e7a0 Re-enable RECORD extension.
RECORD was disabled during the switch to internal events. This patch
modifies the record callback to work with internal events instead of
xEvents. The InternalEvents are converted to core/Xi events as needed.

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

Signed-off-by: Chris Dekter <cdekter@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-02-22 12:04:28 +10:00
Alan Coopersmith
c9726bbe31 Update Sun license notices to current X.Org standard form
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-12-16 17:11:35 -08:00
Peter Hutterer
c20c889727 dix: fix memory leak, free event list on shutdown. (#25028)
X.Org Bug 25028 <http://bugs.freedesktop.org/show_bug.cgi?id=25028>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2009-12-03 08:23:53 +10:00
Jeremy Huddleston
7897b6c2d4 dix: Properly detect if the other device is frozen
Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
2009-11-03 16:44:24 -08:00
Eamon Walsh
4be354c4c2 Remove some debug messages that trigger on XACE event delivery failure.
It is normal for XACE to deny an event delivery, so these log messages
shouldn't trigger when that happens.  Just drop them for now.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-10-14 19:19:19 -04:00
Eamon Walsh
8502c06e19 xace: Fake return values on denials in input polling requests.
Instead of returning BadAccess when "read" permission is denied
on a device, falsify the device state (buttons down, keys pressed).
This is nicer to applications, but may still have undesired side
effects.  The long-term solution is not to use these requests in
event-driven code!

Requests affected: QueryPointer, QueryKeymap, XiQueryDevice.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-10-14 19:19:19 -04:00
Peter Hutterer
72f5874434 dix: extend IsPointerDevice check to valuator-only devices.
A device with valuators but no keys is definitely a pointer device and needs
to be attached to the VCP. Otherwise, the class copying happens on the VCK
and the VCP isn't updated with the events that are to be sent through it.
This addresses the trigger for #24441, not the actual issue.
Jury is still out on valuator+key devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2009-10-13 10:04:50 -07:00
Jamey Sharp
b0dd6be2c8 Cast small-int values through intptr_t when passed as pointers
On 64-bit systems, int and pointers don't have the same size, so GCC gives
warnings about casts between int and pointer types. However, in the cases
covered by this patch, it's always a value that fits in int being stored
temporarily as a pointer and then converted back later, which is safe.
Casting through the pointer-sized integer type intptr_t convinces the
compiler that this is OK.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-10-08 13:38:44 +11:00
Peter Hutterer
fd91313673 dix: plug memory leak in DeviceEnterLeaveEvents.
'event' must be freed before exiting.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-25 08:17:02 +10:00
Peter Hutterer
90aa0e4a49 input: don't use typecasts to access members of InternalEvent.
To avoid confusion, the member names are now postfixed with _event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-22 11:15:32 +10:00
Peter Hutterer
d3c66d6b69 dix: FindChildForEvent needs init child to None.
silences compiler warning:
events.c: In function 'FixUpEventFromWindow':
events.c:2262: warning: 'child' may be used uninitialized in this function

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-14 09:32:53 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Eamon Walsh
da682abc78 xace: fix a bad send access hook call. 2009-06-04 17:33:25 -04: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
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
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
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
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
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
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
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
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
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
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
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
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
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
Peter Hutterer
6c3b633299 Merge branch 'master' into xi2 2009-04-07 19:36:27 +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
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
d9b7343eac dix: even if we don't get a XI1 event, continue processing. 2009-03-20 15:17:56 +10:00
Peter Hutterer
a4b61cfc78 dix: un-static FixUpEventFromWindow and deal with focus events too. 2009-03-20 15:17:56 +10:00
Peter Hutterer
4cc6a96d71 input: add support for RawDeviceEvents. 2009-03-20 15:17:56 +10:00
Peter Hutterer
a668d91e28 dix: store the xi2mask on grabs and pass it around as needed.
This enables passive and implicit passive grabs for XI2 events, except that we
don't have the protocol spec yet to request them.
2009-03-20 15:17:56 +10:00
Peter Hutterer
97e89a5957 Allow XI2 event selection for AllDevices and AllMasterDevices. 2009-03-20 15:17:55 +10:00
Peter Hutterer
808a158182 dix: Enable XI2 delivery for events and focused events.
No support for grabbed events yet.
2009-03-20 15:17:55 +10:00
Peter Hutterer
87ff1159b4 dix: deliver device enter/leave events. 2009-03-20 15:17:55 +10:00
Peter Hutterer
3f37923a72 Xi: send XI2 focus events. 2009-03-20 15:17:55 +10:00
Peter Hutterer
daf7dd3bfe dix: Add GetWindowXI2Mask helper 2009-03-20 15:17:55 +10:00
Peter Hutterer
181e41511d dix: fix up device enter/leave for XI_Enter/XI_Leave. 2009-03-20 15:17:55 +10:00
Peter Hutterer
77d51b94bd dix: FixUpEventForWindow needs to handle XI2 events. 2009-03-20 15:17:54 +10:00
Peter Hutterer
95ed2ab715 Add XI2_EVENT check. 2009-03-20 15:17:54 +10:00
Peter Hutterer
43e48900fc dix: Force deviced ids of 2 and higher for actual devices.
0 is now reserved for the "AllDevices" virtual device.
1 is now reserved for the "AllMasterDevices" virtual device.

This also means that wherever we passed in (mskidx = 0), we now need to pass
in the deviceid.
2009-03-20 15:17:54 +10:00
Peter Hutterer
70896f6127 dix: abstract event filters through GetEventFilters.
Don't let everyone acces the filters[] array directly. This is necessary once
we start dealing with GenericEvents, where the filters are a bit more
complicated.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 15:17:54 +10:00
Peter Hutterer
8a8763f150 dix: restructure DeliverEventsToWindow, a little bit anyway.
Desperate attempt of making the code easy to read and understand. A failed
desparate attempt, possibly.
2009-03-20 15:17:54 +10:00
Peter Hutterer
891cfc8020 dix: clean up DeliverDeviceEvents.
Move mask checking into external function and streamline the code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 15:17:54 +10:00
Peter Hutterer
445daa62e7 Xext: purge XGE event masks.
The masks were originally designed to generically handle event masks for
extensions. Since all that is in-server anyway, it's much better writing
custom event masks for those extensions that need it and not providing a
unified mechanism.
XI2 needs more than the current implementation, which is already too complex
for most other extensions. good riddance.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 15:17:53 +10:00
Peter Hutterer
6fe4c28bf4 Add agressive event type checking.
Best to FatalError if a wrong event comes in. At least that forces me to fix
it really quickly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 15:17:53 +10:00
Peter Hutterer
7d4df0ee44 dix: fix device sync state when calling SyncBoth during AllowEvents.
This did access the wrong device's sync state, potentially freezing or not
thawing the actual device that was supposed to be thawed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 14:48:57 +10:00
Peter Hutterer
e8094d8f3f dix: ProcSendEvent shouldn't use inputInfo.keyboard directly.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 14:48:57 +10:00
Peter Hutterer
31301861c1 dix: remove wrong InputInfo.pointer usage - should be pDev instead. 2009-03-16 13:29:07 +10:00
Peter Hutterer
639658b2ea dix: use GetPairedDevice in ProcQueryPointer rather than inputInfo.keyboard. 2009-03-16 13:29:06 +10:00
Peter Hutterer
f01ee198ff dix: don't use inputInfo.keyboard to get the focus window in ActivateKbdGrab
I'm not sure if that's the right solution, but the other one is wronger.
2009-03-16 13:29:06 +10:00
Peter Hutterer
de415743f4 dix: fix XACE checks in ProcWarpPointer 2009-03-16 13:29:06 +10:00
Peter Hutterer
18430616cf dix: use PickPointer() and PickKeyboard instead of inputInfo.pointer/keyboard.
Affected calls:
 ProcChangeKeyboardControl
 ProcBell
 ProcUngrabKey
 ProcUngrabButton
2009-03-16 13:29:06 +10:00
Peter Hutterer
b368dd1720 dix: remove a few pointless (void) casts of return values.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-12 11:03:29 +10:00
Keith Packard
f8dd80d13b Replace dixLookupResource by dixLookupResourceBy{Type,Class}
dixLookupResource attempted to automatically detect whether the caller
wanted a lookup by-type or by-class, unfortunately, it guessed wrong for
RT_NONE. Instead of trying to make the guess better, this patch just reverts
the unification and creates separate functions for each operation.
2009-03-09 13:08:09 -07:00
Jason Vas Dias
e0ed9f16d0 Fix build with --enable-debug.
[amended by Peter Hutterer]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-03 16:53:06 +10:00
Peter Hutterer
763848d3ab Input: change processing API to InternalEvents.
Don't pass xEvent* and count through to processing, pass a single
InternalEvent.

Custom handlers are disabled for the time being. And for extra fun,
XKB's pointer motion emulation is disabled. But stick an error in there so
that we get reminded should we forget about it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer
155986a93d dix: CheckPassiveGrabsOnWindow moved to internal events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer
1c38abd4b1 dix: switch DeliverGrabbedEvent to internal events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer
fb858774b8 dix: switch DeliverDeviceEvents to internal events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer
3aa9404fcd dix: switch DeliverFocusedEvent to internal events.
And because of xfree() macro hilarity, rename "pointer" to "ptr". Oh, how we
laughed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer
8c873e7f51 dix: Switch DeliverGrabbedEvents to use internal events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:39 +10:00
Peter Hutterer
a371853698 dix: Deliver{Grabbed|Focused|Device}Events API changed to InternalEvents.
With the API change, we can now purge the XI conversion from POE.

Note: this commit breaks DGA even more.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:39 +10:00
Peter Hutterer
8f94ec6f78 dix: convert passive grabs to use internal events.
deviceGrab.sync.event is now an internal event, and CheckDeviceGrabs and
friends is changed over.

Note that this currently breaks some frozen grabs. See towards the end of
ComputeFreezes().

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:39 +10:00
Peter Hutterer
daa3245c47 dix: fix EnqueueEvent to work with internal events.
Note that we're only partially switched to internal events. The event in the
devices' event queue (dev->deviceGrab.sync.event) is still an XI event. The
events in syncEvents are InternalEvents only now.
This also implies fixing CheckVirtualMotion to work with internal events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:39 +10:00
Peter Hutterer
75595ba4aa Xi: make ProcessOtherEvents more InternalEvent aware.
Get rid of the deviceValuator processing and a few other things, but still
drop back into XI before checking device grabs or doing anything else.

NoticeEventTime now needs to take InternalEvents, and while we're at it,
change NoticeTime from a macro to a function.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:39 +10:00
Peter Hutterer
3a02e538db dix: update CheckMotion to deal with DeviceEvents.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:39 +10:00
Peter Hutterer
8829d966a6 Xi: support InternalEvents in UpdateDeviceState, parts of POE and EnqueueEvent
Note that this breaks DGA. Life is tough.

EnqueueEvent is a somewhat half-baked solution, we immediately drop back into
XI and store them. But it should in theory work.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

Don't let the dcce be random data.
2009-02-23 17:52:39 +10:00
Peter Hutterer
007e93c869 xkb: Switch the xkb event processing path over to InternalEvents.
Before dropping down into the DIX, convert back into XI events. This is a
temporary solution only, until the DIX is capable of handling InternalEvents
anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:39 +10:00
Peter Hutterer
64e595d12e dix: check if keybd->key is valid before getting the keyboard state.
For floating SDs, GetPairedDevice() returns the SD itself, hence keybd->key
may be NULL.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-19 09:51:51 +10:00
Peter Ã…strand
ddb8d8945d xserver: Avoid sending uninitialized padding data over the network
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:28:38 +10:00
Peter Hutterer
b735a4b495 dix: Remove lastEventMask variable, substitute with a #define.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:28:18 +10:00
Peter Hutterer
772e0f9159 dix: Don't set core events in SetMaskForEvent.
Rather, modify the two callers to call separately for the two different.
events. Unexport SetMaskForEvent too.
And while we're at it, get rid of the MotionFilter macro, because it's one
half confusing and one half pointless.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:28:17 +10:00
Peter Hutterer
340f1576af dix: remove DefineInitialRootWindow()
Obsolete.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-13 14:41:57 +10:00
Peter Hutterer
cc696a2b79 Doxygen-ify bits of events.c 2009-02-13 14:41:57 +10:00
Peter Hutterer
8364bf7374 Document the event masks.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-13 14:41:57 +10:00
Shunichi Fuji
7bbf05d9aa dix: build fix if PANORAMIX is not defined.
Signed-off-by: Shunichi Fuji <palglowr@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-10 16:06:35 +10:00
Peter Hutterer
5b2bbffc12 dix: deduplicate SyntheticMotion.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-10 14:26:59 +10:00
Peter Hutterer
34820f9c13 dix: remove XineramaChangeToCursor.
It's nearly identical to ChangeToCursor now anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-10 14:26:57 +10:00
Peter Hutterer
942eae6868 dix: Remove XineramaCheckPhysLimits.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-10 14:26:55 +10:00
Peter Hutterer
bf044f6d10 dix: reduce redunancy in XineramaConfineCursorToWindow.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-10 14:26:53 +10:00
Peter Hutterer
cdce5699f0 dix: Get rid of XineramaCheckVirtualMotion.
Yes, this is an ugly piece mess of #ifdefs, but it beats having two nearly
identical functions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-10 14:26:44 +10:00
Tomas Carnecky
bc57efffe6 Fix "warning: unused variable XXX"
events.c:4614: warning: unused variable ‘kbd’
xkbUtils.c:361: warning: unused variable ‘maxKeysPerMod’
xf86Events.c:409: warning: unused variable ‘ke’
generic.c:131: warning: unused variable ‘cs’
generic.c:130: warning: unused variable ‘size’
xf86RandR12.c:591: warning: unused variable ‘crtc’

Signed-off-by: Tomas Carnecky <tom@dbservice.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-04 09:41:25 +10:00
Peter Hutterer
f80332a04d dix: for core events, pass the core filter into DeliverEventsToWindow
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-04 09:01:27 +10:00
Peter Hutterer
412e09e1e3 dix: Use GenericEvent instead of LASTEvent to check for core events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-03 11:13:54 +10:00
Adam Jackson
132b464d73 Remove a bunch of useless casts.
We've had void * for twenty years now people let's try to act like we
know how it works.
2009-01-22 02:11:16 -05:00
Daniel Stone
7af53799cc Input: Remove unused CoreProcess{Keyboard,Pointer}Event
Everything goes through XKB's Process{Keyboard,Pointer}Event on its way
through to ProcessOtherEvent now, so get rid of the old, useless functions.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:59 +11:00
Daniel Stone
4fa3872dc2 Input: Remove core keysyms from KeyClassRec
Instead of always keeping two copies of the keymap, only generate the
core keymap from the XKB keymap when we really need to, and use the XKB
keymap as the canonical keymap.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:59 +11:00
Daniel Stone
cf6a2fc2bd Input: Ignore modifiers in core input processing
Modifiers get cleared by the XKB code when we drop down into core input
processing, so just delete the dead code path to simplify things a bit.

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
6727ee9408 Input: Remove state from KeyClassRec
We already have state fully stored within XKB, so instead of duplicating it,
just generate the values to send to clients when required.

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
Peter Hutterer
646add4eb4 dix: remove XineramaCheckMotion, merge into CheckMotion.
For 5 lines difference, we don't need to duplicate the whole function. really.
2009-01-16 16:11:16 +10:00
Peter Hutterer
e76f904abe dix: remove "notyet" conditional compilation.
If it's "notyet" for 3 years, then "yet" won't arive anytime soon.
2009-01-16 16:11:16 +10:00
Thomas Jaeger
717a961528 Don't release grabs unless all buttons are up
Previously, only buttons <= 5 would count here, but the core protocol
allows for 255 buttons.

http://lists.freedesktop.org/archives/xorg/2009-January/042092.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-16 11:46:26 +10:00
Peter Hutterer
1ae529bef5 dix: replace manual check for event types with IsPointerEvent() 2009-01-15 15:28:29 +10: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
488d452951 dix: EnqueueEvent and PlayReleasedEvent need to handle DeviceMotionNotifies
No MotionNotify events in the processing anymore, so let's have them treat DMN
instead.

Reported by Thomas Jaeger.
2009-01-13 09:22:56 +10:00
Julien Cristau
54332e4732 dix: ANSI cleanups 2009-01-11 08:54:10 +01:00
Peter Hutterer
eb2d7b3d70 dix: move focus handling into enterleave.c.
This commit moves the focus handling from events.c into enterleave.c and
implements a model similar to the core enter/leave model.
For a full description of the model, see:
http://lists.freedesktop.org/archives/xorg/2008-December/041740.html

This commit also gets rid of the focusinout array in the WindowRec, ditching
it in favour of a local array that keeps the current focus window for each
device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-08 11:45:22 +10:00
Peter Hutterer
b72c6b083b dix: remove inputInfo.keyboard reference in QueryPointer handling.
PickKeyboard() is to be used instead.
2009-01-08 11:45:21 +10:00
Kim Woelders
30d2cfcd38 dix: Fix handling of do_not_propagate_mask window attribute.
This was broken in 32aa252e98.

Signed-off-by: Kim Woelders <kim@woelders.dk>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-08 11:45:21 +10:00
Peter Hutterer
6383bc93b2 dix: Init DeviceEnterLeave event's type before FixUpEventFromWindow (#19064)
X.Org Bug 19064 <http://bugs.freedesktop.org/show_bug.cgi?id=19064>
2008-12-15 11:24:52 +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
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
260e48c252 dix: remove confusing (and wrong) comment. VCP is not the only pointer.
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
6bdc963cda dix: split enter/leave event handling into core and device handling.
Device events always need to be delivered, core events only in some cases.
Let's keep them completely separate so we can adjust core event delivery.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-25 09:21:45 +10:00
Peter Hutterer
5e48f5e2dd dix: remove unused EnterLeaveSemaphoresIsset.
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-25 09:21:45 +10:00
Peter Hutterer
868fd503b7 dix: move Enter-Leave related functions into new enterleave.c
Preparation for the new core enter/leave model.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-25 09:21:45 +10:00
Fernando Carrijo
17bccff4ce [dix] Remove a duplicate statement.
Signed-off-by: James Cloos <cloos@jhcloos.com>
2008-11-14 12:36:20 -05:00
Peter Hutterer
f5841e9648 dix: don't store enter/leave and focus semaphores in a devPrivate.
We need them for each window, every time a window is allocated. Storing them
in a devPrivate is the wrong thing to do.

This also removes the unused ENTER_LEAVE_SEMAPHORE_ISSET macro.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2008-11-13 17:06:32 +10:00
Peter Hutterer
26f701704b dix: remove duplicate line in EnterLeaveEvent.
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-13 15:06:46 +10:00
Peter Hutterer
d91243beb6 dix: formatting fix. 2008-11-11 14:57:26 +10:00
Peter Hutterer
dde09076c5 dix: remove superfluous variable devgrab
grab == devgrab anyway, this is a leftover from the time when we had two
different grabs per device (core and XI grab).

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-11 14:52:54 +10:00
Fernando Carrijo
31005efb1b input: Remove useless conditional. 2008-11-10 13:23:45 -05:00
James Cloos
b3c7e62664 Remove some null statements.
Remove several doubled statement-terminal semicolons.

Reported by Fernando Carrijo.
2008-11-08 12:21:20 -05:00
Peter Hutterer
d972399566 Purge device-based WindowAccess code.
Really, this was a bad idea. It's not security, the UI features that would
have been cool (e.g. clicking through windows) aren't implemented anyway, and
there's nothing you can't achieve just by using plain XI anyway.

Requires inputproto 1.9.99.6.
2008-11-04 16:04:15 +10:30
Daniel Stone
f4036f6ace Remove XEvIE
It's unmaintained and has been broken for quite a while; MPX finally
smashed it completely.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-04 16:01:07 +10:30
Peter Hutterer
b6b26560d6 Move EXTENSION_BASE and EXTENSION_EVENT_BASE to misc.h. 2008-10-31 17:09:13 +10:30
Peter Hutterer
f781a752e6 Move MAX_DEVICES to misc.h, rename to MAXDEVICES for consistency. 2008-10-31 17:09:13 +10:30
Eamon Walsh
2809a56b4b xace: Fix an incorrect call to the RECEIVE_ACCESS hook. 2008-10-30 18:29:51 -04:00
Peter Hutterer
ad67e3f063 dix: remove duplicate code in ReleaseActiveGrabs
Spotted by Colin Harrison.
2008-10-13 13:50:40 +10:30
Adam Jackson
c6d6d3e87a Loader: Unexport a handful of consumerless symbols from dixsym. 2008-10-06 16:18:21 -04:00
Adam Jackson
0ce61e21d6 Remove the Must_have_memory hack.
Also remove an astonishing amount of misunderstanding of how casts work.
2008-10-03 17:51:19 -04:00
Tomas Carnecky
ebea78cdba Prepare for array-index based devPrivates.
TODO: static indices can be made just an int; some indices
can be combined.
2008-08-28 18:05:40 -04:00
Mathieu Bérard
9f9268821b The smart scheduler is not optional. 2008-08-11 13:52:38 -04:00
Tomas Carnecky
5532d63488 Redefine WindowTable as a fixed array
Instead of xalloc'ing it every server generation. The array is always
the same size (MAXSCREENS), anyway.
2008-08-05 01:17:32 +03:00
Peter Hutterer
7d9dece74f dix: fix up enter/leave system once again.
Two corrections
1. the "detail" field has NotifyVirtual, etc., not the "mode" field. This was
a clear bug.
2. don't set/unset the flags for NotifyGrab or NotifyUngrab. Clients are
expected to deal with multiple enter/leave events per window if the mode is
not NotifyNormal.

Testable with TCL menu boxes (such as used in gitk):
tk_optionMenu .menu globVar Val1 Val2 Val3 ValJunk
pack .menu

Thanks to Michel Dänzer for pointing this out.
2008-07-28 09:04:41 +09:30
Adam Jackson
d6228cb22a Shape extension is built-in and mandatory. 2008-07-24 15:46:08 -04:00
Søren Sandmann
b85392e66b Give priority to clients that are receiving expose and configure events 2008-07-17 23:25:29 -04:00
Peter Hutterer
acce270935 Xext: store the GenericMasks in the resource system.
This fixes a severe issue - when the client died the event mask didn't get
unregistered and a future event would dereference dangling pointers. By
storing the event masks in the resource system we can free them when the
client dies.
2008-07-10 16:02:55 +09:30
Peter Hutterer
f0c56ffd98 dix: don't dereference dev->key if it doesn't exist.
This may happen if we check for a passive grab on a floating pointer device.
2008-06-26 12:53:05 +09:30
Peter Hutterer
a81b5ce452 dix: free memory associated with the EventList. #16507
Un-deprecates CloseDownEvents.

X.Org Bug 16507 <http://bugs.freedesktop.org/show_bug.cgi?id=16507>
2008-06-25 20:03:31 +09:30
Peter Hutterer
3cc5ae6a4f dix: don't attempt to send Enter/Leave events if we have a keyboard.
Dereferencing into dev->valuator could crash the server, although it looks
like I could only reproduce this by having a keyboard send an event after it
was created and the WM was still replaying. Or so.
2008-06-19 17:23:56 +09:30
Michel Dänzer
068fa63496 dix: fix a crash when the client has a different byteorder.
Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-06-18 10:17:08 +09:30
Peter Hutterer
d21155a3e9 input: fix up usage of button->down, used to be a bitmask, is now an array.
device->button->down used to be a 32-byte bitmask with one bit for each
button. This has changed into a 256-byte array, with one byte assigned for
each button. Some of the callers were still using this array as a bitmask
however, this is fixed with this patch.

Thanks to Keith Packard for pointing this out. See also:
http://lists.freedesktop.org/archives/xorg/2008-June/036202.html
2008-06-18 10:17:08 +09:30
Peter Hutterer
6ab311c92d dix: Call RealizeCursor during InitializeSprite.
RealizeCursor should be called when the cursor is allocated. However, when the
root cursor is allocated, no devices exist yet, and thus RealizeCursor is
never called. This may lead to segfaults lateron in DDXes like Xnest that
actually need to do something for each cursor, and lateron rely on that
DDX-specific data for each cursor has been initialized.
2008-06-11 17:24:19 +09:30
Peter Hutterer
45b661c67a dix: Fix build with --disable-xinerama #16204
X.Org Bug 16204 <http://bugs.freedesktop.org/show_bug.cgi?id=16204>
2008-06-04 13:39:39 +09:30
Peter Hutterer
942086fc96 dix: ProcQueryPointer doesn't need special grab handling, PickPointer does it 2008-05-31 18:17:49 +09:30
Peter Hutterer
1d0438de17 Xi: remove RemoveOtherCoreGrabs()
PickPointer() returns grabbed devices, so we can't get a double grab anyway.
2008-04-25 16:28:58 +09:30
Peter Hutterer
b093bf3ec3 dix: don't search for grabbed devices, PickPointer does it for us now.
Follow-up to 93ee338307.
2008-04-25 15:15:31 +09:30
Peter Hutterer
6198bad07e dix: remove misleading (stale) comment 2008-04-25 15:02:44 +09:30
Peter Hutterer
93ee338307 dix: let PickPointer() return devices that are core-grabbed by the client.
If the client currently holds a core grab on any device, this device has
priority, even over the ClientPointer.
2008-04-25 15:02:08 +09:30
Peter Hutterer
c3659cb414 dix: always send FocusIn events if mode is NotifyUngrab.
In the case of a NotifyUngrab, the flag for the device may already be set but
we still need to send the FocusIn event.
2008-04-23 14:22:21 +09:30
Peter Hutterer
8190ef8754 Merge branch 'master' into mpx
Conflicts:

	Xext/EVI.c
	Xext/appgroup.c
	Xext/cup.c
	Xext/mitmisc.c
	Xext/sampleEVI.c
	dix/window.c
2008-04-22 18:04:05 +09:30
Peter Hutterer
1a9d7205cd Merge whot@wombat:~/potoroo/xserver into mpx 2008-04-14 16:25:58 +09:30
Peter Hutterer
755f9e5d78 dix: Ignore focus for passive grabs if the event is a pointer event. 2008-04-13 16:59:53 +09:30
Peter Hutterer
90f491cf8e Merge whot@wombat:~/potoroo/xserver into mpx 2008-04-11 08:29:52 +09:30
Peter Hutterer
04dff74ffd dix: Rework Enter/Leave semaphore system.
Instead of a simple counter, use bits to keep track of which device is where
etc. When device enters a window (or sets focus), the bit matching the device
is set, when it leaves again, it is unset. If there are 0 bits set, then
Leave/Enter/Focus events may be sent to the client.

Same theory as before, but this should get around the insanity with
Grab/Ungrab special cases. Those cases are basically untested though.
2008-04-10 19:22:59 +09:30
Peter Hutterer
a88386ee27 Xi: only DeliverFocusedEvents if the event is not a pointer event.
A pointer device may have a focus class, but even if so, pointer events must
be delivered to the sprite window, not the focus window.
2008-04-10 14:42:26 +09:30
Peter Hutterer
bce6091c6b dix: Extend IsKeyboardDevice() to not include pointer devices.
If a pointer devices has key classes as well, don't register it as a keyboard
device. Let's see how much that change will break.
2008-04-10 09:59:45 +09:30
Peter Hutterer
cc7dab2d04 dix: Dont deliver grabbed pointer events to a focus window.
If an pointer event is being processed during a device grab, don't deliver it
to the focus window, even if the device has a focus class. Reason being that
some pointers may have a focus class, thus killing drag-and-drop.
2008-04-10 09:58:50 +09:30
Jeremy Huddleston
3f51f493b6 XQuartz: Fix issue where clicking on an X11 window might send that event to an X11 window in another space.
(cherry picked from commit df21312c8b)
(cherry picked from commit 2d4194a8d1)
2008-04-08 17:03:18 -07:00
Magnus Vigerlöf
5ffbcfec3d dix: Ensure Proximity events don't kill the server.
Add Prox events to the if-clauses with the other events
that are usually sent from the input devices.
Ensure that the event deliverers won't try to deliver
events of type '0' (some extended events doesn't have
an equivalent core-type)

Small modification by Peter Hutterer.

Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-04-08 14:43:22 +09:30
Peter Hutterer
638a50552e dix: remove debug error message about XI->core type conversion. 2008-04-06 08:36:21 +09:30
Peter Hutterer
27b2127893 Xi: remove ungrab handling of ExtendedUngrabDevice request.
This can be done by UngrabDevice, no need for separate codepaths.
2008-02-25 17:00:42 +10:30
Peter Hutterer
77dba004a9 dix: add InputEventListLen and SetMinimumEventSize
The latter is used to increase the amount of allocated memory for the event
list. This will be needed for ClassesChangedEvents that can be of more or less
arbitrary size (larger than 32 anyway).
2008-02-19 15:52:35 +10:30
Peter Hutterer
3fe64d8d27 Move input event list initialisation and storage from DDX to DIX.
Rather than letting the DDX allocate the events, allocate them once in the DIX
and just pass it around when needed.

DDX should call GetEventList() to obtain this list and then pass it into
Get{Pointer|Keyboard}Events.
2008-02-18 18:46:01 +10:30
Peter Hutterer
1692dcf197 dix: print out event type if a bogus pointer event occurs. 2008-01-30 13:04:58 +10:30
Peter Hutterer
379f057646 Xext: add GEDeviceMaskIsSet (GE mask checking per device)
If a mask was set for the NULL device, then we pretend the mask is set for all
devices.
2008-01-25 10:27:26 +10:30
Peter Hutterer
6492d513c0 dix: if a client has a core grab, return the grab device on QueryPointer.
The correct thing would be to return the ClientPointer. However, if the client
for some reason has a core grab on another device (e.g. as result of a passive
grab), return the coordinates of the grabbed device instead.

This makes the use of nautilus a bit saner.
2008-01-18 21:44:22 +10:30
Peter Hutterer
cd2ad4c2ed dix: remove some superfluous lines in ProcChangeActivePointerGrab. 2008-01-18 20:11:55 +10:30
Peter Hutterer
8a925d201e dix: free the genericMasks when ungrabbing.
This finally plugs a memory hole created by grabs registering for generic
events.
2008-01-18 20:07:20 +10:30
Peter Hutterer
d323fd6420 dix: remove inputInfo.pointer refernce in EventSelectForWindow
If the window being changed is set as the motion hint window for any device,
the device's motion hint window is set to NULL. Which is kinda what the old
code did, except that it did it with only the VCP.
2008-01-18 19:18:07 +10:30
Peter Hutterer
883811c2be dix: remove inputInfo.pointer reference in TryClientEvents.
Unfortunately, this requires a change in the TCE API, and thus a change in all
callers. Tough luck.
2008-01-18 18:48:46 +10:30
Peter Hutterer
b0bf4308ac dix: print out an error when core type can't be converted.
Helps a bit in tracking down bugs.
2008-01-15 19:15:09 +10:30
Peter Hutterer
32aa252e98 dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.

Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.

Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!

Generic events don't fit into this yet, they cause me headaches.
2008-01-15 18:41:51 +10:30
Peter Hutterer
0969a9f749 dix: Emulate core events within CheckDeviceGrabs and ComputeFreezes.
This should restore the correct passive grab processing. When checking for
passive grabs, the core event is emulated and we check first for XI grabs on
the window, then for core grabs. Regardless of which event activates the grab,
the XI event is stored in the device's EQ.

When replaying the event, we take the XI event and replay it on the next
window, again including the emulation of the core event.
2008-01-15 11:31:12 +10:30
Peter Hutterer
a83a0c5a14 dix: remove obsolete comment.
Pairings don't exist anymore and the documented issue is a non-issue now.
2008-01-13 16:14:29 +10:30
Peter Hutterer
20ace6321a dix: don't try to confine cursor on screen restructure if there is no cursor.
Stops segfaulting when using xrandr. Yay.
2008-01-07 20:08:56 +10:30
Peter Hutterer
57a491e6d3 dix: init GrabPrivateKey to correct value.
Merge detritus from last pull.
2008-01-07 20:06:32 +10:30
Peter Hutterer
8da83836b6 Merge branch 'master' into mpx
Conflicts:

	XTrap/xtrapddmi.c
	Xext/security.c
	Xext/xprint.c
	Xext/xtest.c
	Xext/xvdisp.c
	Xi/exevents.c
	Xi/grabdevb.c
	Xi/grabdevk.c
	Xi/opendev.c
	Xi/ungrdev.c
	Xi/ungrdevb.c
	Xi/ungrdevk.c
	dix/cursor.c
	dix/devices.c
	dix/dixutils.c
	dix/events.c
	dix/getevents.c
	dix/main.c
	dix/window.c
	hw/xfree86/ramdac/xf86Cursor.c
	include/dix.h
	include/input.h
	include/inputstr.h
	mi/midispcur.c
	mi/miinitext.c
	mi/misprite.c
	render/animcur.c
	xfixes/cursor.c
	xkb/xkbAccessX.c
2008-01-03 17:04:54 +10:30
Peter Hutterer
d86e7f2ecc dix: when getting a bogus event, at least print out the type. 2007-12-11 17:49:16 +10:30
Peter Hutterer
447cd5d411 dix: update comments about inputInfo.pointer. 2007-12-04 19:09:37 +10:30
Peter Hutterer
f44d7dcb5f dix: change the filters to be per-device.
If we have one global filter, one pointer may change the filter value and
affect another pointer.

Reproduceable effect:
blackbox and xterm, start dragging xterm then click anywhere with the other
pointer (attached to different masterd device!).  The button release resets
the filter[Motion_Filter(button)] value, thus stopping dragging and no event
is sent to the client anymore.
Having the filters set per device gets around this.
2007-12-04 19:07:46 +10:30
Peter Hutterer
0931f40bf1 dix: comments, whitespaces, copyright fixes.
Removing my copyright message for now, should eventually be in line with the
rest of the messages.
2007-12-04 17:08:56 +10:30
Peter Hutterer
09c0c1a3cc dix: remove #ifdef XINPUT.
No escaping XINPUT anymore.
2007-12-04 16:51:52 +10:30
Peter Hutterer
9eb8ea9e61 dix: only freeze the paired MD on a grab, not all other devices. 2007-11-30 11:32:59 +10:30