Commit Graph

208 Commits

Author SHA1 Message Date
Peter Hutterer
fbf4b5f16a dix: set dst->mapWidth when allocating a new map. 2008-06-05 08:53:34 +09:30
Peter Hutterer
5a3d06b8f4 xkb: delete default rules when devices are closed.
We only have one set of default rules options in xkb. When the second keyboard
is brought up with Xkb options specified, these new options overwrite the old.
In future server generations, the rules used for the VCK are a mixture of the
default ones and ones previously specified for other keyboards. Simply
resetting the xkb default rules to NULL avoids this issue.

Reproducable by setting XkbLayout "de" and XkbVariant "nodeadkeys". In the
second server generation, the VCK has "us(nodeadkeys)". This again produces a
SIGABRT when the first key is hit.

I could not figure out why the SIGABRT happens. This patch is avoiding the
issue rather than fixing it.
2008-06-02 10:27:05 +09:30
Peter Hutterer
62c1a32976 dix: null out dummyDev, otherwise Xephyr dereferences random pointers.
SendEventToAllWindow eventually causes a IsInterferingGrab(), which attempts
to dereference dev->deviceGrab.grab.
2008-05-31 17:42:05 +09:30
Peter Hutterer
1883485edd If core motion history is required, scale back to screen coords and INT16. 2008-05-26 17:22:25 +09:30
Peter Hutterer
0877de13ac Remove GetMotionProc from ValuatorClassRec.
With the MD/SD device hierarchy we need control over the generation of the
motion history as well as the conversion later before posting it to the
client. So let's not let the drivers change it.

No x.org driver currently uses it anyway, linuxwacom doesn't either so dumping
it seems safe enough.
2008-05-25 22:49:54 +09:30
Peter Hutterer
6c9e9f8a40 input: instead of lastx/y, use a last.valuators[] array on the device.
During GetPointerEvents (and others), we need to access the last coordinates
posted for this device from the driver (not as posted to the client!). Lastx/y
is ok if we only have two axes, but with more complex devices we also need to
transition between all other axes.

ABI break, recompile your input drivers.
2008-05-23 12:01:37 +09:30
Peter Hutterer
1a3f351c50 dix: when floating a device, create a new cursor sprite.
This is essentially necessary to allow calls to miPointerGetSprite etc. to
work for floating slave devices.
2008-05-22 23:25:20 +09:30
Peter Hutterer
7a550cefd9 dix: shut up two compiler warnings. 2008-05-20 11:07:39 +09:30
Peter Hutterer
937e5aae33 dix: don't undisplay cursor if we don't own a sprite.
Sometimes we didn't have a cursor when coming back from suspend. Reason was
that the suspend caused the server to lose the device that was attached to the
VCP, and a RemoveDevice() would then set the cursor to NULL.
Solution: only set the cursor to NULL if we actually own the sprite.
2008-05-14 22:30:15 +09:30
Peter Hutterer
00db0f35ac dix: InitAndStartDevices doesn't need a window parameter.
Leftover from the old pointer-keyboard pairing code, obsolete and gone now.
2008-05-14 15:29:28 +09:30
Peter Hutterer
da728f2127 dix: don't use serverClient in AddInputDevice, use the one supplied instead.
We pass in the client that wants to create the device anyway, lets use the
parameter instead of hardcoding the serverClient.

Wow. I hope this is merge detritus, otherwise it'd be a sign that I didn't
have enough coffee that day.
2008-05-14 15:17:05 +09:30
Peter Hutterer
1fc1a2897e Remove UndisplayCursor API.
We can achieve the same thing by simply displaying a NullCursor, there's no
need for a separate API.
2008-05-13 11:17:02 +09:30
Peter Hutterer
a0e6a7d4f5 dix: resize EQ to minimum size to avoid reallocs during SIGIO.
When a new device is added, calculate the event size needed if a DCCE event is
sent and set the EQ's event size to this minimum. This avoids reallocs when a
event is sent (which may happen during a SIGIO).
2008-04-30 17:57:48 +09:30
Peter Hutterer
ffaccc2dc9 input: replace -1 as default axis limit with NO_AXIS_LIMIT define.
This allows easier refacturing of the coordinate limit handling. Grepping for
-1 is boring.
2008-04-30 11:49:11 +09:30
Peter Hutterer
53dba5381f dix: if alloc of a master keyboard fails, remove the master pointer. 2008-04-28 11:37:52 +09:30
Peter Hutterer
d9c38e84cc dix: remove pairingClient definition.
This variable was used originally to determine which client is allowed to
change the pointer-keyboard pairing. For now, we just let anyone change it and
see how that works out.
2008-04-25 14:29:26 +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
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
48d33ab9b6 dix: float attached devices _before_ disabling the master.
It also helps if we're actually providing the correct argument to
AttachDevice...
2008-04-15 14:29:53 +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
6d22a9615a dix: Call DeleteInputDeviceRequest from CloseDownDevices (#14418)
The DDX (xfree86 anyway) maintains its own device list in addition to the one
in the DIX. CloseDevice will only remove it from the DIX, not the DDX. If the
server then restarts (last client disconnects), the DDX devices are still
there, will be re-initialised, then the hal devices come in and are added too.
This repeats until we run out of device ids.

This also requires us to strdup() the default pointer/keyboard in
checkCoreInputDevices.

X.Org Bug 14418 <http://bugs.freedesktop.org/show_bug.cgi?id=14418>
2008-04-11 18:45:32 +09:30
Peter Hutterer
b4380d8030 dix: don't free MDs classes on init.
The device classes aren't deleted anymore on a class change, so there's no
need to store the MD's original classes. We should however restore the MD to
sane defaults when disconnecting the last device, consider this as TODO item.
2008-04-10 19:25:43 +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
8e0a652930 dix: When floating, set sprite to NULL before calling InitializeSprite.
InitializeSprite won't create a new one if it already exists, with the result
of overwriting the master's sprite. This master sprite is then assigned to the
floating slave, and freed when the slave is reattached later.
Setting the sprite to NULL forces InitializeSprite to alloc a new one, and
this one can be freed without further repercussions.
2008-04-10 08:25:36 +09:30
Peter Hutterer
b46a009186 dix: sprite may be NULL, don't dereference it then.
In some rare cases (e.g. when the init fails) a device's sprite is NULL,
dereferencing it to xfree the spriteTrace is a bad idea then.
2008-04-06 09:02:57 +09: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
Peter Hutterer
2257e20900 dix: set dev->key to NULL after freeing it in CloseDevice. (Bug #12830)
Otherwise XkbRemoveResourceClient may try to dereference it lateron.

X.Org Bug 12830 <http://bugs.freedesktop.org/show_bug.cgi?id=12830>
2008-02-27 17:32:29 +10:30
Peter Hutterer
23ae68a4c7 dix: before copying the classes the first time, set the VCK's classes to NULL.
XkbFinishDeviceInit does the following:
  xkbi->kbdProc= pXDev->kbdfeed->CtrlProc;
  pXDev->kbdfeed->CtrlProc= XkbDDXKeybdCtrlProc;

If we directly copy the device classes for the VCK, pXDev->kbdfeed->CtrlProc
at the time of copying is still XbkDDXKeybdCtrlProc. So at some point
XkbDDXKeybdCtrlProc is called, and calls itself, and calls itself, and...

Setting the device's classes to NULL seems to fix things. The memory isn't
lost, it gets stored into the devPrivates and freed at device closing time.
2008-02-26 15:35:28 +10:30
Peter Hutterer
750d702676 dix: Ensure enough memory for ClassesChangedEvent for a new device.
Before we enable the device through the driver, we size it up and make sure
that the events in the event list contain enough bytes for a possible
ClassesChangedEvent lateron.
2008-02-19 17:23:51 +10:30
Eamon Walsh
ae43d835bd XACE: Change access modes for some device-related requests.
Opening a device is not really "reading" it.
Requests that globally configure a device should require "manage" access.
2008-02-13 20:20:49 -05:00
Peter Hutterer
ba315ae5dd Xi: add XACE hooks for device creation (ChangeDeviceHierarchy)
AddInputDevice checks for permissions already, so all we do is modify a few
callers to let AID sort it out.
2008-01-21 23:44:07 +10:30
Peter Hutterer
38bf01bd1c Merge branch 'master' into mpx 2008-01-10 13:38:46 +10:30
Peter Hutterer
4e85c7c322 Xi: keep a counter of buttons down to avoid duplicate press/release events.
If two devices are attached to the same master device, pressing button 1 on
each of them leads to two button presses from the same device. Some apps
really don't like that.

So we just put a counter in place and only send the first press and the last
release.
2008-01-09 17:36:39 +10:30
Peter Hutterer
e4a214e40d dix: don't free device's devPrivates manually, dixFreePrivates does it.
Merge detritus from last pull.
2008-01-04 13:32:53 +10:30
Peter Hutterer
b2da44c76d dix: DoChangeKeyboardControl shouldn't be using inputInfo.keyboard. 2008-01-03 18:51:44 +10:30
Peter Hutterer
c7e9b67c54 dix: free ClassesRec when a BadAlloc occurs during CoreKeyboardProc. 2008-01-03 18:09:56 +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
Daniel Stone
24105cf658 Input: Don't reinit devices
If a device is already initialised (i.e. the virtual core devices) during
IASD, don't init them again.  This fixes a leak.
2007-12-28 15:51:36 +02:00
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
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
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
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
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
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
Eamon Walsh
1603130236 Merge branch 'master' into XACE-SELINUX
Conflicts:

	Xext/xace.c
	Xext/xace.h
2007-11-14 13:35:50 -05:00
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