dix: Change AllocMaster into AllocDevicePair, allow creation of SDs too.

Allocating a slave device is essentially the same as allocating a master device.
Hence we rename AllocMaster to AllocDevicePair and provided the ability to
indicate if a master or slave device pair is required.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Benjamin Close 2009-04-16 15:33:30 +10:00 committed by Peter Hutterer
parent e2e5932bda
commit 826a5bff01
3 changed files with 15 additions and 10 deletions

View File

@ -108,7 +108,7 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
strncpy(name, (char*)&c[1], c->namelen);
rc = AllocMasterDevice(client, name, &ptr, &keybd);
rc = AllocDevicePair(client, name, &ptr, &keybd, TRUE);
if (rc != Success)
{
xfree(name);

View File

@ -545,9 +545,9 @@ CorePointerProc(DeviceIntPtr pDev, int what)
void
InitCoreDevices(void)
{
if (AllocMasterDevice(serverClient, "Virtual core",
&inputInfo.pointer,
&inputInfo.keyboard) != Success)
if (AllocDevicePair(serverClient, "Virtual core",
&inputInfo.pointer, &inputInfo.keyboard,
TRUE) != Success)
FatalError("Failed to allocate core devices");
if (ActivateDevice(inputInfo.pointer) != Success ||
@ -2270,12 +2270,16 @@ GetPairedDevice(DeviceIntPtr dev)
/**
* Create a new master device (== one pointer, one keyboard device).
* Create a new device pair (== one pointer, one keyboard device).
* Only allocates the devices, you will need to call ActivateDevice() and
* EnableDevice() manually.
* Either a master or a slave device can be created depending on
* the value for master.
*/
int
AllocMasterDevice(ClientPtr client, char* name, DeviceIntPtr* ptr, DeviceIntPtr* keybd)
AllocDevicePair (ClientPtr client, char* name,
DeviceIntPtr* ptr, DeviceIntPtr* keybd,
Bool master)
{
DeviceIntPtr pointer;
DeviceIntPtr keyboard;
@ -2299,7 +2303,7 @@ AllocMasterDevice(ClientPtr client, char* name, DeviceIntPtr* ptr, DeviceIntPtr*
pointer->spriteInfo->spriteOwner = TRUE;
pointer->u.lastSlave = NULL;
pointer->isMaster = TRUE;
pointer->isMaster = master;
keyboard = AddInputDevice(client, CoreKeyboardProc, TRUE);
if (!keyboard)
@ -2321,7 +2325,7 @@ AllocMasterDevice(ClientPtr client, char* name, DeviceIntPtr* ptr, DeviceIntPtr*
keyboard->spriteInfo->spriteOwner = FALSE;
keyboard->u.lastSlave = NULL;
keyboard->isMaster = TRUE;
keyboard->isMaster = master;
/* The ClassesRec stores the device classes currently not used. */

View File

@ -468,10 +468,11 @@ extern _X_EXPORT int AttachDevice(ClientPtr client,
extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
extern _X_EXPORT int AllocMasterDevice(ClientPtr client,
extern _X_EXPORT int AllocDevicePair(ClientPtr client,
char* name,
DeviceIntPtr* ptr,
DeviceIntPtr* keybd);
DeviceIntPtr* keybd,
Bool master);
extern _X_EXPORT void DeepCopyDeviceClasses(DeviceIntPtr from,
DeviceIntPtr to);