Commit Graph

4440 Commits

Author SHA1 Message Date
Peter Hutterer
eace88989c include: never overwrite realInputProc with enqueueInputProc. Bug #13511
In some cases (triggered by a key repeat during a sync grab) XKB unwrapping
can overwrite the device's realInputProc with the enqueueInputProc. When the
grab is released and the events are replayed, we end up in an infinite loop.
Each event is replayed and in replaying pushed to the end of the queue again.

This fix is a hack only. It ensures that the realInputProc is never
overwritten with the enqueueInputProc.

This fixes Bug #13511 (https://bugs.freedesktop.org/show_bug.cgi?id=13511)
2007-12-19 16:20:36 +10:30
Peter Hutterer
9f6ae61ad1 dix: set the correct number of valuators in valuator events.
(first_valuator + num_valuators) must never be larger than the number of axes,
otherwise DIX freaks out. And from looking at libXI, anything larger than 6 is
wrong too.
2007-12-18 13:57:15 +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
3a058456e0 mi: unify ErrorFs, prepend [mi] 2007-12-07 20:23:36 +10:30
Peter Hutterer
c5acf401da mi: unify last two ErrorF's in mieq.c 2007-12-07 20:19:43 +10:30
Peter Hutterer
117458d2db mi: change infamous "Tossed event ..." error for something more explanatory.
Few whitespace errors fixed.
Two ErrorF's prefixed with [mi].
2007-12-07 20:18:49 +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
28b93d74a1 ephyr: miPointerWarpCursor needs the device parameter.
Thanks to Mitchell Quille for spotting it.
2007-12-03 14:35:33 +10:30
Peter Hutterer
004876355b dix: Remove RegisterPairingClient and UnregisterPairingClient. 2007-12-03 14:32:23 +10:30
Peter Hutterer
6216abe0c1 dix: avoid activating the VCP/VCK twice.
This may set dev->key-xkbinfo to NULL, causing a segfault in xkb code lateron.
Spotted by David Huggins-Daines.
2007-11-30 11:34:24 +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
Peter Hutterer
e4fe0a3cb7 xkb: swap a LookupKeyboardDevice over in favour of GetPairedDevice
The former always returns the VCK, which is obviously wrong if we have
multiple devices.
2007-11-29 10:14:38 +10:30
Peter Hutterer
0f2398d06c Xi: set DeviceXXXState's length fields to the correct size of the struct.
Setting it to the size of a pointer is an interesting but equally wrong
approach. Luckily Xlib never used this field anyway so nobody got hurt so far.

Spotted by Simon Thum.
2007-11-27 10:22:44 +10:30
Peter Hutterer
a4edfbef02 mi: only call UpdateSpriteForScreen if the screen actually changed.
If we call it unconditionally, we flip the dev->spriteInfo->sprite permanently
when using XTestFakeInput (once in CheckMotion as called from the
processInputProc, another time in UpdateSpriteForScreen when we actually warp
the cursor). USFS also updates to the screen's root window unconditionally,
which is not really what we want if we haven't changed screen at all.
2007-11-24 16:16:48 +10:30
Peter Hutterer
bf3198c8c5 dix: fix typo 2007-11-24 15:00:57 +10:30
Peter Hutterer
5dabe448bd dix: Add special treatment of NotifyUngrab for enter/leave events.
In some cases (e.g. using x2x) the previous model broke, with a window ending
not counting down to 0 anymore. Special treatment for NotifyUngrab seems to
help here.

Current solution: If a NotifyGrab is to be sent ignore it. If a NotifyUngrab
enter is sent, only adjust the semaphore if it is on 0. Likewise, do the same
for a NotifyUngrab leave if the semaphore is on 1. This seems to work alright
so far.
2007-11-24 15:00:43 +10:30
Peter Hutterer
691da03131 Xi: allocate motion history for master device.
We're still missing out on the actual content of the history but at least this
way we don't segfault.
2007-11-22 17:59:48 +10:30
Peter Hutterer
f9269bebae DeviceIntRec: move lastx/lasty from valuator into DeviceIntRec.
We free the ValuatorClassRec quite regularly. If a SIGIO is handled while
we're swapping device classes, we can bring the server down when we try to
access lastx/lasty of the master device.
2007-11-22 17:30:14 +10:30
Peter Hutterer
9ed43eff48 Xi: allow clients to specify pure client id in SetClientPointer.
If no window was found with the given ID, try if there's a client with the ID.
Allows us to set the CP for apps that don't open windows (e.g. x2x).
2007-11-21 17:16:27 +10:30
Peter Hutterer
33f1568992 xtest: switch an inputInfo.pointer over to PickPointer.
Couple of whitespace fixes too.
2007-11-21 16:14:49 +10:30
Peter Hutterer
e5dd7a9579 Xext: Scruffy the janitor don't like no "register" keywords. 2007-11-21 15:59:31 +10:30
Peter Hutterer
bad96e5a86 dix: getevents.c remove trailing whitespaces. 2007-11-18 15:13:45 +10:30
Peter Hutterer
75e5e9f88c Xi: add missing XI_DeviceClassesChangedMask to XI filters array. 2007-11-18 15:12:50 +10:30
Peter Hutterer
12dd6e9911 dix: reset MD's devPrivate classes to NULL before device initialisation.
XkbInitKeyboardDefviceStruct may call FatalError if it fails. FatalError then
cleans up all the devices, resulting in a segfault if the pointer is
uninitialised.
2007-11-16 17:23:09 +10:30
Peter Hutterer
be3321c2e9 dix: Free both current classes and original classes when closing an MD. 2007-11-16 12:12:41 +10:30
Peter Hutterer
3c39dd19ec Xi: Deep-copy full list of FeedbackClasses.
All feedback classes are linked lists and the whole list has to be duplicated,
not just the first entry.

Xkb stuff still missing.
2007-11-16 12:12:14 +10:30
Peter Hutterer
497862df2f dix: explicitly float all attached SDs before closing down devices.
Some drivers flush on shutdown, if our SD is still attached we'd be trying to
route an event through a non-existing device.
2007-11-16 11:20:22 +10:30
Peter Hutterer
9de1ebe2a8 dix: Fix up class restoring when last SD disconnects.
Old code was fundamentally broken, fixes now are:
- free the MDs current device classes
- copy the device classes instead of flipping the pointers
- check for the old MD, not the new one.
2007-11-16 10:45:28 +10:30
Peter Hutterer
83926cb8be Xi: Only alloc modifierKeyMap if <slave device>->maxKeysPerModifier > 0
Sometimes (e.g. on my debian ppc box) maxKeysPerModifier of the SD is 0. So we
try to malloc(0), bringing the whole server down with a FatalError because it
looks as if the malloc failed. This is bad, so only alloc if we actually have
something to alloc.
2007-11-15 17:41:07 +10:30
Peter Hutterer
070195dbf8 Xi: fix up sloppy class copying causing segfaults. 2007-11-15 16:27:18 +10:30
Peter Hutterer
53539688ca dix: SetKeySymMap should alloc the map if dst doesn't have one already. 2007-11-15 16:23:48 +10:30
Peter Hutterer
b40646dc10 dix: Add FreeDeviceClass and FreeFeedbackClass for centralised xfree.
Ensures that we only have one way of freeing a device class to avoid leaks in
ChangeMasterDeviceClasses and other places.
2007-11-15 15:43:44 +10:30
Peter Hutterer
18833d648f Xi: reset xkb-stuff to NULL after copying (DeepCopyDeviceClasses)
Having two devices point to the same xkb stuff causes SIGABRTs.

Also, don't init a MD's xkbInfo unless the SD has an xkbInfo.
2007-11-15 12:13:59 +10:30
Peter Hutterer
1635832c16 Revert "xkb: disable xkb key repeats (temporarily)"
This reverts commit 2b1d946392.
2007-11-15 11:35:07 +10:30
Peter Hutterer
b05246696d Xi: free XkbSrvLedInfos as well when freeing an MD's device classes. 2007-11-15 11:31:43 +10:30
Peter Hutterer
c758e5a664 dix: Make sure core MDs copy their initial classes before they are used.
Anything in dev->key, dev->valuator etc. of a MD must always be a copy of the
original class. The intial classes of an MD (the ones set up before an SD is
attached) as well, as we may have to restore them if no SD is attached
anymore.
2007-11-15 10:47:20 +10:30
Peter Hutterer
a08665d4d3 mi: don't call SwitchCoreKeyboard, we switch during event processing now. 2007-11-15 10:42:29 +10:30
Peter Hutterer
64711a0948 Xi: When switching MD classes, make a deep copy instead of pointer flip.
Turns out it's really really hard synchronising device state across multiple
duplicated events if they all share the same struct. So instead of doing so,
when the SD changes deep-copy all it's classes into the MD. The MD then has
the same capabilities, but the state can be set separately. This should fix
xkb, key state, repeat etc. problems.

Updating the device state allows us to remove the SwitchCoreKeyboard from the
event gathering, it's all done during event processing now.
2007-11-15 10:41:34 +10:30
Peter Hutterer
cc4586df60 Xi: toggle the public.devPrivate as well when switching device classes.
The master needs to have the same devPrivate as the slave, in case a client
issues a request that goes down to the driver.
Example: if a driver wants to ring the keyboard bell, it'll pick a keyboard.
The KeyClassPtr will direct it to the matching method in the driver, but
because the MD doesn't have the devPrivate set the driver segfaults.
Even if all drivers were updated to not dereference the nullpointer, nothing
would actually ever happen.

To avoid this, we flip the master's public.devPrivate to the last SDs
devPrivate.
2007-11-14 14:27:52 +10:30
Peter Hutterer
b44c1118f3 dix: Return Success from ProcBell if no BellProc is set.
We must not return BadDevice, this causes applications to crash. If no
BellProc is set, just quietly do nothing and report a Success.
2007-11-14 14:08:21 +10:30
Peter Hutterer
240b10fa9c Xi: Move updating the device state from POE into separate function.
POE now only deals with processing the event and calling the appropriate
delivery methods. Actually modifying the device state is done in
UpdateDeviceState. This separation should make it easier to avoid setting the
state twice when master events are processed.
2007-11-14 13:38:56 +10:30
Peter Hutterer
0bdfeb55fc Xi: remove RegisterPairingClient handling. Deprecated with device hierarchy. 2007-11-13 17:31:20 +10:30
Peter Hutterer
e96d926d64 Xi: remove trailing whitespaces. 2007-11-13 17:14:35 +10:30
Peter Hutterer
5031238aad dix: remove trailing/wrong whitespaces from devices.c and events.c 2007-11-13 16:58:23 +10:30
Peter Hutterer
c703849e79 dix: Attach spriteInfoRec to same memory block as the DeviceIntRec.
No need to alloc a separate one, we never do anything special with it anyway.
2007-11-13 16:50:18 +10:30
Peter Hutterer
51239f87ce dix: Send MappingNotify when keyboard maps change.
If a slave device is attached to a master device, then we need to send a
mapping notify to the client.
Mapping notify needs to be sent if
 - different slave device but on same master
 - different master

This gives you funny behaviour with the ClientPointer. When a
MappingNotify is sent to the client, the client usually responds with a
GetKeyboardMapping. This will retrieve the ClientPointer's keyboard mapping,
regardless of which keyboard sent the last mapping notify request. So
depending on the CP setting, your keyboard may change layout in each app...
2007-11-13 11:26:16 +10:30
Peter Hutterer
2b1d946392 xkb: disable xkb key repeats (temporarily)
Haven't quite figured out yet how to make these repeats work. Because we share
the class between devices, the key state is already set when we process the
master device's event, causing a repeat on each event.
2007-11-13 09:51:33 +10:30