dix: Make InitCoreDevices use AllocMasterDevice.
Also change naming a bit, append "pointer" and "keyboard" to master devices instead of -ptr and -keybd.
This commit is contained in:
parent
299573f461
commit
1d9ebbac8c
|
@ -485,68 +485,27 @@ CorePointerProc(DeviceIntPtr pDev, int what)
|
||||||
void
|
void
|
||||||
InitCoreDevices(void)
|
InitCoreDevices(void)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev;
|
|
||||||
|
|
||||||
if (CoreDevicePrivatesGeneration != serverGeneration) {
|
if (CoreDevicePrivatesGeneration != serverGeneration) {
|
||||||
CoreDevicePrivatesIndex = AllocateDevicePrivateIndex();
|
CoreDevicePrivatesIndex = AllocateDevicePrivateIndex();
|
||||||
CoreDevicePrivatesGeneration = serverGeneration;
|
CoreDevicePrivatesGeneration = serverGeneration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inputInfo.keyboard) {
|
if (AllocMasterDevice("Virtual core",
|
||||||
dev = AddInputDevice(CoreKeyboardProc, TRUE);
|
&inputInfo.pointer,
|
||||||
if (!dev)
|
&inputInfo.keyboard) == BadAlloc)
|
||||||
FatalError("Failed to allocate core keyboard");
|
FatalError("Failed to allocate core devices");
|
||||||
dev->name = strdup("Virtual core keyboard");
|
|
||||||
#ifdef XKB
|
|
||||||
dev->public.processInputProc = ProcessOtherEvent;
|
|
||||||
dev->public.realInputProc = ProcessOtherEvent;
|
|
||||||
if (!noXkbExtension)
|
|
||||||
XkbSetExtension(dev, ProcessKeyboardEvent);
|
|
||||||
#else
|
|
||||||
dev->public.processInputProc = ProcessKeyboardEvent;
|
|
||||||
dev->public.realInputProc = ProcessKeyboardEvent;
|
|
||||||
#endif
|
|
||||||
dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
|
|
||||||
dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
|
|
||||||
dev->coreEvents = TRUE;
|
|
||||||
dev->spriteInfo->spriteOwner = FALSE;
|
|
||||||
if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex))
|
|
||||||
FatalError("Couldn't allocate keyboard devPrivates\n");
|
|
||||||
dev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL;
|
|
||||||
dev->u.lastSlave = NULL;
|
|
||||||
dev->isMaster = TRUE;
|
|
||||||
(void)ActivateDevice(dev);
|
|
||||||
|
|
||||||
inputInfo.keyboard = dev;
|
if (!AllocateDevicePrivate(inputInfo.keyboard, CoreDevicePrivatesIndex))
|
||||||
}
|
FatalError("Couldn't allocate keyboard devPrivates\n");
|
||||||
|
inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = NULL;
|
||||||
|
|
||||||
if (!inputInfo.pointer) {
|
if (!AllocateDevicePrivate(inputInfo.pointer, CoreDevicePrivatesIndex))
|
||||||
dev = AddInputDevice(CorePointerProc, TRUE);
|
FatalError("Couldn't allocate pointer devPrivates\n");
|
||||||
if (!dev)
|
inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = NULL;
|
||||||
FatalError("Failed to allocate core pointer");
|
|
||||||
dev->name = strdup("Virtual core pointer");
|
ActivateDevice(inputInfo.keyboard);
|
||||||
#ifdef XKB
|
ActivateDevice(inputInfo.pointer);
|
||||||
dev->public.processInputProc = ProcessOtherEvent;
|
|
||||||
dev->public.realInputProc = ProcessOtherEvent;
|
|
||||||
if (!noXkbExtension)
|
|
||||||
XkbSetExtension(dev, ProcessPointerEvent);
|
|
||||||
#else
|
|
||||||
dev->public.processInputProc = ProcessPointerEvent;
|
|
||||||
dev->public.realInputProc = ProcessPointerEvent;
|
|
||||||
#endif
|
|
||||||
dev->deviceGrab.ActivateGrab = ActivatePointerGrab;
|
|
||||||
dev->deviceGrab.DeactivateGrab = DeactivatePointerGrab;
|
|
||||||
dev->coreEvents = TRUE;
|
|
||||||
dev->spriteInfo->spriteOwner = TRUE;
|
|
||||||
if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex))
|
|
||||||
FatalError("Couldn't allocate pointer devPrivates\n");
|
|
||||||
dev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL;
|
|
||||||
dev->u.lastSlave = NULL;
|
|
||||||
dev->isMaster = TRUE;
|
|
||||||
(void)ActivateDevice(dev);
|
|
||||||
|
|
||||||
inputInfo.pointer = dev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2389,9 +2348,9 @@ AllocMasterDevice(char* name, DeviceIntPtr* ptr, DeviceIntPtr* keybd)
|
||||||
if (!pointer)
|
if (!pointer)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
pointer->name = xcalloc(strlen(name) + strlen("-ptr") + 1, sizeof(char));
|
pointer->name = xcalloc(strlen(name) + strlen(" pointer") + 1, sizeof(char));
|
||||||
strcpy(pointer->name, name);
|
strcpy(pointer->name, name);
|
||||||
strcat(pointer->name, "-ptr");
|
strcat(pointer->name, " pointer");
|
||||||
|
|
||||||
#ifdef XKB
|
#ifdef XKB
|
||||||
pointer->public.processInputProc = ProcessOtherEvent;
|
pointer->public.processInputProc = ProcessOtherEvent;
|
||||||
|
@ -2414,9 +2373,9 @@ AllocMasterDevice(char* name, DeviceIntPtr* ptr, DeviceIntPtr* keybd)
|
||||||
if (!keyboard)
|
if (!keyboard)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
keyboard->name = xcalloc(strlen(name) + strlen("-keybd") + 1, sizeof(char));
|
keyboard->name = xcalloc(strlen(name) + strlen(" keyboard") + 1, sizeof(char));
|
||||||
strcpy(keyboard->name, name);
|
strcpy(keyboard->name, name);
|
||||||
strcat(keyboard->name, "-keybd");
|
strcat(keyboard->name, " keyboard");
|
||||||
|
|
||||||
#ifdef XKB
|
#ifdef XKB
|
||||||
keyboard->public.processInputProc = ProcessOtherEvent;
|
keyboard->public.processInputProc = ProcessOtherEvent;
|
||||||
|
|
Loading…
Reference in New Issue