Commit Graph

220 Commits

Author SHA1 Message Date
Peter Hutterer
8208b842b7 Xi: add IEventBase global variable. Stores event base for X Input events. 2008-04-29 14:19:42 +09:30
Peter Hutterer
46340b7406 Xi: change UpdateDeviceState to be _X_EXPORT. 2008-04-29 14:17:48 +09:30
Peter Hutterer
3a922c5d07 Xi: apply ValuatorEvent data to the device's valuators.
After UpdateDeviceState, the device has the current position in absolute
coordinates, the event has the correct valuator data to be delivered to the
client.
2008-04-29 11:18:35 +09:30
Peter Hutterer
b5004722a2 Xi: Only return VCP, VCK and floating SDs to Xi 1.x clients.
This is better than the approach implemented with
8973a3f798 which disabled XI altogether for 1.x.
Instead, return a device list that resembles a traditional XI setup on pre XI
2.0 servers. If the client tries to open a device other than a floating SD,
return a BadDevice error.
2008-04-28 10:26:01 +09:30
Peter Hutterer
684b5d8382 Xi: whoops, stray ! caused a bit of memory mess. 2008-04-26 19:55:59 +09:30
Peter Hutterer
87071b604c Revert "Xi: disable XI for clients < XI 2.0"
Turns out some programs don't like this change. gnome-settings-daemon crashes
hard if you tell it that XI doesn't exist. So, tell them we have XI, but leave
the other change (the one that pretends no devices are available).

This reverts commit 8973a3f798.
2008-04-26 19:37:57 +09:30
Peter Hutterer
7447a30fb2 Xi: if a pre-XI2 client tries to list the devices, pretend we don't have any.
XI 1.x isn't supported anymore, so let's pretend we don't have any devices.
This stops clients from opening them and thus stops interference.
2008-04-26 19:03:13 +09:30
Peter Hutterer
8973a3f798 Xi: disable XI for clients < XI 2.0
Sorry. With the huge changes in the device handling I honestly don't know how
to support XI and XI2 alongside. So let's just pretend XI doesn't exist if a
client doesn't request it supporting XI2.
2008-04-26 19:01:00 +09:30
Peter Hutterer
b304b0a65c Xi: add versioning support.
Remember the version the client sent to us, so we can adjust our replies
accordingly. This requires the client to use the {major|minor}Version fields
in the GetExtensionVersion request. However, they were padding before, so we
must assume they are garbage if nbytes is non-zero. If nbytes is zero, the
client is probably a new client and we can handle it correctly.
2008-04-26 17:47:15 +09:30
Peter Hutterer
be5ff2b8d8 Xi: remove some superflous code 2008-04-25 16:25:13 +09:30
Peter Hutterer
f5ac98747d Standardise copyright headers for all new files created as part of MPX. 2008-04-25 14:50:24 +09:30
Peter Hutterer
3fc67b4205 Xi: remove leftover chpkpair.h file.
Used to contain declarations for ChangePointerKeyboardPairing request
handling.
2008-04-25 14:30:46 +09:30
Peter Hutterer
c14b858aec Xi: fix two compiler warnings
unused variable in exevents.c
implicit declaration in warpdevp.c
2008-04-25 14:29:05 +09:30
Peter Hutterer
6015b7a812 Xi: handle requests through a dispatch handler.
Same principle as e.g. in the RandR extension, rather than having a load of
    if (type == XI_whatever)
use an array of function pointers.
2008-04-25 14:28:45 +09:30
Peter Hutterer
cb8cb87bc6 Xi: remove unused #define DISPATCH 2008-04-25 14:28:25 +09:30
Peter Hutterer
aa6687322d Xi: when copying button classes, copy xkb_acts as well.
This should be the last piece in the quest for the class copy.
2008-04-18 14:39:21 +09:30
Peter Hutterer
51c8fd69ec dix: free the unused device classes when closing a device.
This also requires to NULL-ify all pointers while we're actually using them,
otherwise we'd try to free them twice.
2008-04-15 15:09:40 +09:30
Peter Hutterer
4cf9c5909d Xi: fix up button count.
Some leftover code from the previously used alloc/free device classes left us
with a incorrect button count. So a button release didn't come through if
a different pointer was moved after the button press.
2008-04-15 13:56:11 +09:30
Peter Hutterer
6866e84e3c Xi: store feedback classes in devProviates system as well.
This is a follow-up to cb48d88085.
2008-04-13 19:57:51 +09:30
Peter Hutterer
cb48d88085 Xi: store unused classes in devPrivates.
Rather than freeing/allocing classes each time the device capabilities need to
swap, store them in the devPrivates system.
When a class is unused, it is pushed into the devPrivates, and later recovered
when needed again. This saves us a lot of memory allocations/frees, admittedly
on the cost of some memory.
2008-04-13 19:48:28 +09:30
Peter Hutterer
fde3c83662 Xi: copy the KeySyms.map over from the source. 2008-04-13 17:10:18 +09:30
Peter Hutterer
3c4c9938f3 Xi: Fix pointer handling in KeyClassRec copy.
We don't free the class anymore, so just store the previous pointers, do the
memcpy from the SD and then restore the pointers.
Plugs a memleak too, before xkbInfo was never freed.
2008-04-13 17:00:00 +09:30
Peter Hutterer
6faf5b97b9 Xi: fix up modifierKeyMap copying.
Setting it to NULL isn't correct either. The correct behaviour is to realloc
it to the size necessary (or newly alloc it/free it).  Otherwise we have a
memleak.
2008-04-13 16:28:31 +09:30
Peter Hutterer
415c6df0da Xi: copy feedback classes first, in some cases xkb relies on kbdfeed.
XkbInitIndicatorMap (in XkbInitDevice) calls XkbFindSrvLedInfo. This accesses
the devices kbdfeed struct, which is all nice and dandy if it is NULL. When
copying the device classes however, kbdfeed may not be NULL and thus
XkbFindSrvLedInfo goes on its merry way to do whatever it does.

By copying kbdfeed first, we avoid XkbFSLI to reference the "old" kbdfeed
struct of the previous SD.
2008-04-13 11:46:44 +09:30
Peter Hutterer
961f666090 Xi: modifierKeyMap needs to be set to NULL when copying classes.
Otherwise we have a double reference to the same memory area.
2008-04-13 09:31:16 +09:30
Peter Hutterer
bf6679cba4 Xi: copy the XkbSrvLedInfo too when copying device classes. 2008-04-13 09:29:32 +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
4824942527 Xi: dont copy FocusClassRec if the master already has one.
Blindly copying will override the focus setting of the master. If there's XI
applications running, they may set the SD focus, while leaving the
MD's focus as it was. In this case, after a class swap we still want to get
the MD's events to the same window as before.
2008-04-10 14:36:10 +09:30
Peter Hutterer
5a4c6621aa Xi: some extra checks for validity of kbd and mouse.
Floating SDs are paired with themselves, so the paired device may not be a
proper keyboard or mouse. Put some extra checks in to avoid dereferencing a
nullpointer later.
2008-04-10 08:29:05 +09:30
Peter Hutterer
e7211eb0b3 Xi: When attaching, check for ptr -> ptr and keybd -> keybd.
Some pointer devices have key classes (e.g. MS Optical Desktop 2000). The
previous test was performed as Error if ptr -> keybd or keybd -> ptr. This
doesnt work with such devices. New test is Succeed if ptr->ptr or
keybd->keybd.
2008-04-10 08:08:54 +09:30
Peter Hutterer
389dae73cc Xi: If device "to" has a class but "from" doesn't, free the class in "to". 2008-04-09 08:26:00 +09:30
Peter Hutterer
60c38d248c Xi: plug memory leak, free previous motion history before allocating new. 2008-04-09 07:47:34 +09:30
Peter Hutterer
ea05cf0813 Xi: check if source has a key class before copying. 2008-04-08 22:09:11 +09:30
Peter Hutterer
fd06e8f8c1 Merge branch 'master' into dcdc_rework
Conflicts:

	Xext/xevie.c
	dix/dispatch.c
2008-04-07 07:56:41 +09:30
Peter Hutterer
8f38feb3e4 Xi: add comments for DeepCopyDeviceClasses, ChangeMasterDeviceClasses. 2008-04-05 20:37:21 +10:30
Peter Hutterer
d0395a7530 Xi: realloc to->valuator instead of allocing it blindly. 2008-04-04 15:05:26 +10:30
Peter Hutterer
502689847b Xi: ALLOC_COPY_CLASS_IF should only alloc if to->field doesn't exist. 2008-04-04 15:01:53 +10:30
Peter Hutterer
035b1b6995 Xi: remove duplicate copying of kbdfeed and ptrfeed. 2008-04-04 15:00:06 +10:30
Peter Hutterer
52fc7aed18 Xi: only alloc memory for feedback classes if it doesn't already exist. 2008-04-04 14:47:23 +10:30
Peter Hutterer
4eb87c8693 Xi: don't free device classes before copying them.
First commit in a series to come.
2008-04-04 14:20:37 +10:30
Peter Hutterer
8e562fe26f Xi: remove false memset from DeepCopyDeviceClasses.
It's wrong, needs to be different, but I haven't had enough coffee to figure
out what it needs to do yet.
2008-03-05 15:11:41 +10:30
Peter Hutterer
7b4f3616f7 Xi: add deviceid to QueryDevicePointer request.
Why not, we had the padding anyway.
Suggested by Jim Gettys on the X.Org mailing list.
2008-03-04 18:29:15 +10:30
Peter Hutterer
4f2cd0ed96 Merge branch 'master' into mpx
This merge reverts Magnus' device coorindate scaling changes. MPX core event
generation is very different, so we can't scale in GetPointerEvents.

Conflicts:

	Xi/opendev.c
	dix/devices.c
	dix/dixfonts.c
	dix/getevents.c
	dix/resource.c
	dix/window.c
	hw/xfree86/common/xf86Xinput.c
	mi/mipointer.c
	xkb/ddxBeep.c
	xkb/ddxCtrls.c
	xkb/ddxKeyClick.c
	xkb/ddxList.c
	xkb/ddxLoad.c
	xkb/xkb.c
	xkb/xkbAccessX.c
	xkb/xkbEvents.c
	xkb/xkbInit.c
	xkb/xkbPrKeyEv.c
	xkb/xkbUtils.c
2008-03-04 18:11:10 +10:30
Eamon Walsh
27bcf40cda XACE: Fix instances of DixUnknownAccess at hook callsites. 2008-02-28 16:43:43 -05:00
Peter Hutterer
453661a9e1 Xi: swap the control attached to a ChangeDeviceControl request. Bug #14170
Just swapping the request's data isn't enough, we need to swap the actual
control as well.

X.Org Bug 14170 <http://bugs.freedesktop.org/show_bug.cgi?id=14170>
2008-02-28 15:47:26 +10:30
Peter Hutterer
ce9fb2f8c4 Xi: MDs return the paired device's ID in attached field of ListInputDevices. 2008-02-26 13:51:19 +10:30
Peter Hutterer
d61f481a44 Xi: remove GetPairedPointer handling.
obsolete, ListInputDevices provides this information now.
2008-02-25 17:52:45 +10: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
09a8fc5c7a Xi: make SizeDeviceInfo public and re-use from CreateClassesChangedEvent. 2008-02-18 18:42:46 +10:30
Peter Hutterer
088067c891 Xi: even if ChangeDeviceHierarchy fails, we may need to send an event.
Changes are committed instantly, so if at least one change was successful, we
must send an event to the client, even if subsequent ones fail.
2008-02-18 16:46:07 +10:30