hopefully fixed iroster behavior

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15199 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2005-11-28 17:14:54 +00:00
parent 4bd3c01eaa
commit 0b64aa6472
3 changed files with 24 additions and 7 deletions

View File

@ -678,13 +678,14 @@ AddOnManager::HandleFindDevices(BMessage* message, BMessage* reply)
CALLED();
const char *name = NULL;
input_device_type type;
if (message->FindString("device", &name) != B_OK
|| gInputServer->GetDeviceInfo(name, &type) != B_OK)
return B_NAME_NOT_FOUND;
reply->AddString("device", name);
reply->AddInt32("type", type);
if (message->FindString("device", &name) == B_OK) {
if (gInputServer->GetDeviceInfo(name, &type) != B_OK)
return B_NAME_NOT_FOUND;
reply->AddString("device", name);
reply->AddInt32("type", type);
} else {
gInputServer->GetDeviceInfos(reply);
}
return B_OK;
}

View File

@ -1054,6 +1054,21 @@ InputServer::GetDeviceInfo(const char* name, input_device_type *_type,
}
status_t
InputServer::GetDeviceInfos(BMessage *msg)
{
CALLED();
BAutolock lock(fInputDeviceListLocker);
for (int32 i = fInputDeviceList.CountItems() - 1; i >= 0; i--) {
InputDeviceListItem* item = (InputDeviceListItem*)fInputDeviceList.ItemAt(i);
msg->AddString("device", item->Name());
msg->AddInt32("type", item->Type());
}
return B_OK;
}
status_t
InputServer::UnregisterDevices(BInputServerDevice& serverDevice,
input_device_ref **devices)

View File

@ -135,6 +135,7 @@ class InputServer : public BApplication {
status_t GetDeviceInfo(const char* name, input_device_type *_type,
bool *_isRunning = NULL);
status_t GetDeviceInfos(BMessage *msg);
status_t UnregisterDevices(BInputServerDevice& serverDevice,
input_device_ref** devices = NULL);
status_t RegisterDevices(BInputServerDevice& serverDevice,