Commit Graph

150 Commits

Author SHA1 Message Date
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
d0308b6465 Xi: specify correct struct when calculating size of GetDeviceControl reply.
This doesn't change much, as the struct previously given has the same size as
the ones now anyway. Still, we should be pendantic.

Thanks to Simon Thum for reporting.
2007-12-19 18:18:10 +10:30
Eamon Walsh
c8feb73f58 Merge branch 'master' into XACE-SELINUX
Conflicts:

	Xext/EVI.c
	Xext/bigreq.c
	Xext/cup.c
	Xext/dpms.c
	Xext/fontcache.c
	Xext/mitmisc.c
	Xext/xcmisc.c
	Xext/xf86bigfont.c
	Xext/xtest.c
	configure.ac
	dbe/dbe.c
	hw/darwin/darwin.h
	hw/darwin/darwinEvents.c
	hw/darwin/iokit/xfIOKit.h
	hw/darwin/iokit/xfIOKitCursor.c
	hw/darwin/quartz/fullscreen/fullscreen.c
	hw/darwin/quartz/fullscreen/quartzCursor.c
	hw/darwin/quartz/quartz.c
	hw/darwin/quartz/quartzCommon.h
	hw/darwin/quartz/quartzCursor.c
	hw/darwin/quartz/xpr/dri.c
	hw/darwin/quartz/xpr/dristruct.h
	hw/darwin/quartz/xpr/xprCursor.c
	hw/darwin/quartz/xpr/xprFrame.c
	hw/xfree86/modes/xf86RandR12.c
	include/cursor.h
	miext/rootless/rootlessCommon.h
	miext/rootless/rootlessScreen.c
	miext/rootless/rootlessWindow.c
	render/picturestr.h

Trying to pick up the pieces from the darwin churn here...
2007-12-13 18:38:25 -05:00
Daniel Stone
0fccb24aa9 ProcessOtherEvent: Don't do double translation of button events
We already deal with the button mapping in GetPointerEvents, so don't
do the remapping again in ProcessOtherEvent.
2007-12-05 18:29:54 +00:00
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
edebe76cfd 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.
(cherry picked from commit 0f2398d06c)
2007-11-27 13:15:28 +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
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
Eamon Walsh
17b0c729b5 registry: Remove registry code from XInput extension.
Moving all the names into dix/registry.c
2007-11-20 18:46:43 -05:00
Peter Hutterer
75e5e9f88c Xi: add missing XI_DeviceClassesChangedMask to XI filters array. 2007-11-18 15:12:50 +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
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
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
b05246696d Xi: free XkbSrvLedInfos as well when freeing an MD's device classes. 2007-11-15 11:31:43 +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
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
a05f43bf3e dix: When the last slave is removed, set master to the original classes.
DeviceClassesChangedEvent is sent to the client, where device == new slave.
2007-11-12 11:35:18 +10:30
Peter Hutterer
7a81bafc9b Xi, dix: Add ability to change MD classes + send event when doing so.
Each time a different slave device sends through a master, an
DeviceClassesChangedEvent is enqueued. When this event is processed, all
classes of the matching master device are changed, and the event is sent to
the clients.

Next time the master is queried, it thus shows the evclasses of the last slave
device. The original classes are stored in the devPrivates.

TODO: if all slave devices are removed, the master's original classes need to
be restored.
2007-11-09 23:10:24 +10:30
Peter Hutterer
676b26ca3e Xi: notify the clients when the device hierarchy has been changed. 2007-11-09 14:31:54 +10:30
Peter Hutterer
180220f284 Xi: return BadDevice for slave devices on ProcXSetClientPointer
Also clean up to return error codes instead of sending the error manually.
2007-11-08 10:00:35 +10:30
Peter Hutterer
184a7b8917 Merge branch 'mpx' into mdsd
Conflicts:

	Xi/opendev.c
2007-11-08 09:34:35 +10:30
Peter Hutterer
0b729051c0 Merge branch 'master' into mpx
Conflicts:

	Xi/extinit.c
	Xi/grabdev.c
	Xi/setmode.c
	Xi/ungrdev.c
	dix/devices.c
	dix/events.c
	dix/getevents.c
	include/dix.h
	mi/midispcur.c
	mi/misprite.c
	xkb/xkbActions.c
	xkb/xkbEvents.c
	xkb/xkbPrKeyEv.c
2007-11-07 15:37:23 +10:30
Peter Hutterer
a8808ac3d0 Xi: don't call CheckMotion for slave devices.
This essentially disables enter/leave for slave devices, but re-enables them
for master devices. Which is a good thing after all.
2007-11-07 11:42:58 +10:30
Eamon Walsh
a52c9b2a59 Merge branch 'master' into XACE-SELINUX
Conflicts:

	dix/dispatch.c
	dix/property.c
	hw/xfree86/common/xf86VidMode.c
	include/xkbsrv.h
	render/glyph.c
	xkb/xkbActions.c
2007-11-05 19:08:36 -05:00
Daniel Stone
fb32bb9839 Xi: Remove usage of alloca
Replace with xalloc/xfree.
2007-11-05 14:34:46 +00:00
Peter Hutterer
d9caa469b9 Xi: allow VCP/VCK to be OpenDevice'd as well.
All devices deserve to be equal. Except master devices, they are a bit more
equal than the others.
2007-10-19 15:26:09 +09:30
Peter Hutterer
155e2c559e Xi: advertise as XInput v2 capable 2007-10-19 14:37:07 +09:30
Peter Hutterer
5ba738935f Xi: remove ChangePointerKeyboardPairing in favour of ChangeDeviceHierarchy. 2007-10-19 14:36:37 +09:30
Peter Hutterer
6dcde0e9c1 Xi: set master device's id in ListDevices Reply. 2007-10-19 11:28:50 +09:30
Peter Hutterer
cfcc6e14b9 Xi: return all master devices as type IsXPointer/Keyboard when listing devs.
Slave devices are reported as IsXExtensionPointer/Keyboard.
2007-10-19 11:28:44 +09:30
Eamon Walsh
6107a24503 dix: Add client parameter to AddPassiveGrabsToList(). 2007-10-18 12:24:55 -04:00
Peter Hutterer
ae9fc10ade Xi: don't send core events for slave devices. 2007-10-17 10:41:04 +09:30
Peter Hutterer
e9f149fb56 Fix up detritus from removing GetPairedPointer/Keyboard. 2007-10-16 14:24:20 +09:30
Eamon Walsh
5277a6ff58 registry: Register Input extension protocol names. 2007-10-15 14:14:37 -04:00
Peter Hutterer
113011221a Xi, xfree86: Remove leftovers of the XI wrapper code. 2007-10-01 21:42:01 +09:30
Eamon Walsh
8b54865720 xace: add hooks + new access codes: XKB extension.
Removes "LookupKeyboardDevice" and "LookupPointerDevice" in favor of
inputInfo.keyboard and inputInfo.pointer, respectively; all use cases
are non-XI compliant anyway.
2007-09-28 13:34:18 -04:00
Eamon Walsh
5c03d13181 xace: add new hooks + access controls: XInput extension.
Introduces new dix API to lookup a device, dixLookupDevice(), which
replaces LookupDeviceIntRec and LookupDevice.
2007-09-28 08:02:00 -04:00
Peter Hutterer
a511c445de Remove generation of core events, long live XI!
Let the drivers only generate XI events and put those into the event queue.
When processing events, generate core events as needed. This fixes a number of
problems with XKB and the DIX in general.

The previous approach was to put core events and XI events as separate events
into the event queue. When being processed, the server had no knowledge of
them coming from the same device state change. Anything that would then change
the state of the device accordingly was in danger of changing it twice,
leading to some funny (i.e. not funny at all) results.

Emulating core events while processing XI events fixes this, there is only one
path that actually changes the device state now. Although we have to be
careful when replaying events from synced devices, otherwise we may lose
events.

Note: XI has precedence over core for passive grabs, but core events are
delivered to the client first.

This removes the wrapping added in 340911d724
2007-09-28 18:46:41 +09:30
Eamon Walsh
3b114f2603 Input: Properly swap DevicePresenceNotify events. 2007-09-26 07:26:59 -04:00
Eamon Walsh
31a7994ac7 Input: Return errors to the dispatcher instead of sending them ourself.
Also fixed two "unused variable: stuff" warnings.
2007-09-26 07:26:59 -04:00
Peter Hutterer
3342b5ad47 Xi: fix the wrapper code for processInputProc wrapping.
Followup to [1].
If a core grab causes the device to freeze, it overwrites the processInputProc
of the device. [1] would then overwrite this while unwrapping, the device
does not thaw anymore.
Changing this to only re-wrap if the processInputProc hasn't been changed
during the event handling.

[1] 340911d724
2007-09-26 18:03:21 +09:30
Peter Hutterer
55fd50273e Xi: unify ErrorFs. Prefix all with [Xi]. 2007-09-26 15:15:34 +09:30
Peter Hutterer
340911d724 Wrap core event handling through ProcessOtherEvents.
When processing events from the EQ, _always_ call the processInputProc of the
matching device. For XI devices, this proc is wrapped in three layers.
Core event handling is wrapped by XI event handling, which is wrapped by XKB.
A core event now passes through XKB -> XI -> DIX.

This gets rid of a sync'd grab problem: with the previous code, core events
did disappear during a sync'd device grab on account of mieqProcessInputEvents
calling the processInputProc of the VCP/VCK instead of the actual device. This
lead to the event being processed as normal instead of being enqueued for
later replaying.
2007-09-26 15:12:49 +09:30