Commit Graph

4411 Commits

Author SHA1 Message Date
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
Peter Hutterer
70b4087c4d dix: don't unconditionally update valuators during key events.
Master may not have valuators, device may not have valuators.
2007-11-12 13:10:39 +10:30
Peter Hutterer
23365d2865 dix: allow grab modifier device to be NULL.
This can happen if we check for a passive core grab and our device is a
floating slave device. Doesn't really change anything as SDs can't send core
events but it stops the server from segfaulting.
2007-11-12 13:08:38 +10:30
Peter Hutterer
5a7a65a3c9 mi: avoid SIGABRT by setting master_event to NULL. 2007-11-12 12:37:39 +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
c0a0580578 Xext: add simple macro to easily check a generic event's type. 2007-11-09 23:07:10 +10:30
Peter Hutterer
5bbc468b70 dix: grabbing an attached SD sets it floating for the duration of the grab. 2007-11-09 14:32:06 +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
cb75f09146 dix: calloc root window's Generic Event mask, stops segfaults. 2007-11-09 14:31:41 +10:30
Peter Hutterer
59b304d8a2 dix, mi: stop segfaults when a floating device emits events.
For pointers: don't try to set master->valuator fields if there is no master.
For keyboards: check if device is valid before trying to access the fields in
miPointerGetScreen (btw. this disables DGA events for floating keyboards).

Also stop the hideous number of ErrorFs if we request the paired device for a
floating dev.
2007-11-08 15:44:18 +10:30
Peter Hutterer
3063f0c667 mi: change the device id to the master devices' when duplicating the event.
Move the event duplication into a CopyGetMasterEvent(), makes the code a bit
better to read.
2007-11-08 11:51:03 +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
Peter Hutterer
15944b8f02 mi: duplicate event before processing it, so master has original values
Event values may get changed in the event processing stage, so we need to
duplicate it to pump different events through for slave and master device.
2007-11-07 11:33:24 +10:30
Eamon Walsh
d7c5e8bfc1 Modified performance patches from Arjan van de Ven <arjan@infradead.org>
Subject: [PATCH] fix some performance gaps in Xace

The XaceHook function is used in several hotpaths.
The problem with it (performance wise) is twofold:
 * The XaceHook function has a big switch() statement for the hook number in it
 * The XaceHook function uses varargs to reassemble the final dispatch arguments again

Both are expensive operations... for something that is known at compile time

This patch turns the hotpath XaceHook call into a direct call to avoid
the switch and varargs; this gives me over 10% performance gain
on the x11perf benchmark.
2007-11-06 16:26:09 -05:00
Dodji Seketeli
aaa50b6411 resync with 'master' 2007-11-06 16:26:25 +01:00
Dodji Seketeli
868e303630 Xephyr: fix a crash when using xrandr twice
* hw/kdrive/ephyr/ephyr.c:
          (ephyrScreenFini): don't forget to
          free shadowfb data (if necessary) upon server is reset.
2007-11-06 16:24:46 +01:00
Elvis Pranskevichus
ddce48ede0 Config: D-Bus: Fix dbus_bus_request_name failure check
The code in connect_hook incorrectly checks for dbus_bus_request_name failure.
The dbus_bus_request_name error indicator is -1, not 0. This leads
to subsequent assertion failure in libdbus.
2007-11-06 09:40:36 +00:00
Adam Jackson
58332894c0 Export the server ABI versions from xorg-server.pc 2007-11-05 17:18:46 -05:00
Dodji Seketeli
632c33c5c1 pull 'master' 2007-11-05 17:53:04 +01:00
Dodji Seketeli
4113f040c5 GL: fix crash at mesa destruction time
* GL/glx/glxglcore.c:
         (_glXMesaScreenDestroy): delete the same amount of visuals
         that those which were created in createMesaVisuals().
2007-11-05 17:33:01 +01:00
Daniel Stone
dda10c9066 Remove all traces of external RGB database (and Speedo)
Remove all references to an external RGB database (which hasn't been enabled
for a very long time).  Also get rid of some references to Speedo fonts.
2007-11-05 16:28:35 +00:00
Dodji Seketeli
6ff79ea5f7 Xephyr: fix some DRI build breakage 2007-11-05 16:46:49 +01:00
Daniel Stone
5e363500c8 OS: Remove ALLOCATE_LOCAL from os.h
Remove ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK from os.h, and
remove the include of Xalloca.h as well.
2007-11-05 14:38:28 +00:00
Daniel Stone
83e5d9e75d DIX: Remove last alloca call
Replace with heap allocations.
2007-11-05 14:36:54 +00:00
Daniel Stone
1179ddea94 EXA: Remove usage of alloca
Replace with heap allocations.
2007-11-05 14:36:36 +00:00
Daniel Stone
1eb6a1d0d2 XTrap: Remove usage of alloca
Replace with xalloc/xfree.
2007-11-05 14:34:47 +00:00