dix: Enable core devices in InitCoreDevices already.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Peter Hutterer 2008-11-21 12:39:55 +10:00
parent d939f2482e
commit e078901a4e
3 changed files with 10 additions and 24 deletions

View File

@ -593,8 +593,6 @@ CorePointerProc(DeviceIntPtr pDev, int what)
* Both devices are not tied to physical devices, but guarantee that there is * Both devices are not tied to physical devices, but guarantee that there is
* always a keyboard and a pointer present and keep the protocol semantics. * always a keyboard and a pointer present and keep the protocol semantics.
* *
* The devices are activated but not enabled.
*
* Note that the server MUST have two core devices at all times, even if there * Note that the server MUST have two core devices at all times, even if there
* is no physical device connected. * is no physical device connected.
*/ */
@ -605,6 +603,12 @@ InitCoreDevices(void)
&inputInfo.pointer, &inputInfo.pointer,
&inputInfo.keyboard) != Success) &inputInfo.keyboard) != Success)
FatalError("Failed to allocate core devices"); FatalError("Failed to allocate core devices");
if (inputInfo.pointer->inited && inputInfo.pointer->startup)
EnableDevice(inputInfo.pointer);
if (inputInfo.keyboard->inited && inputInfo.keyboard->startup)
EnableDevice(inputInfo.keyboard);
} }
/** /**
@ -619,7 +623,7 @@ InitCoreDevices(void)
* *
* @return Success or error code on failure. * @return Success or error code on failure.
*/ */
int void
InitAndStartDevices() InitAndStartDevices()
{ {
DeviceIntPtr dev, next; DeviceIntPtr dev, next;
@ -630,31 +634,14 @@ InitAndStartDevices()
ActivateDevice(dev); ActivateDevice(dev);
} }
if (!inputInfo.keyboard) { /* In theory, this cannot happen */
ErrorF("[dix] No core keyboard\n");
return BadImplementation;
}
if (!inputInfo.pointer) { /* In theory, this cannot happen */
ErrorF("[dix] No core pointer\n");
return BadImplementation;
}
/* Now enable all devices */
if (inputInfo.pointer->inited && inputInfo.pointer->startup)
EnableDevice(inputInfo.pointer);
if (inputInfo.keyboard->inited && inputInfo.keyboard->startup)
EnableDevice(inputInfo.keyboard);
/* enable real devices */ /* enable real devices */
for (dev = inputInfo.off_devices; dev; dev = next) for (dev = inputInfo.off_devices; dev; dev = next)
{ {
DebugF("(dix) enabling device %d\n", dev->id); DebugF("(dix) enabling device %d\n", dev->id);
next = dev->next; next = dev->next;
if (dev->inited && dev->startup) if (dev->inited && dev->startup)
(void)EnableDevice(dev); EnableDevice(dev);
} }
return Success;
} }
/** /**

View File

@ -361,8 +361,7 @@ int main(int argc, char *argv[], char *envp[])
InitCoreDevices(); InitCoreDevices();
InitInput(argc, argv); InitInput(argc, argv);
if (InitAndStartDevices() != Success) InitAndStartDevices();
FatalError("failed to initialize core devices");
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);

View File

@ -239,7 +239,7 @@ extern Bool ActivateDevice(
extern Bool DisableDevice( extern Bool DisableDevice(
DeviceIntPtr /*device*/); DeviceIntPtr /*device*/);
extern int InitAndStartDevices(void); extern void InitAndStartDevices(void);
extern void CloseDownDevices(void); extern void CloseDownDevices(void);