Fixed mouse device naming, it now iterates from 1 :)
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9405 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -117,6 +117,7 @@ MouseInputDevice::~MouseInputDevice()
|
|||||||
status_t
|
status_t
|
||||||
MouseInputDevice::InitFromSettings(void *cookie, uint32 opcode)
|
MouseInputDevice::InitFromSettings(void *cookie, uint32 opcode)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
mouse_device *device = (mouse_device *)cookie;
|
mouse_device *device = (mouse_device *)cookie;
|
||||||
|
|
||||||
// retrieve current values
|
// retrieve current values
|
||||||
@@ -233,41 +234,41 @@ status_t
|
|||||||
MouseInputDevice::HandleMonitor(BMessage *message)
|
MouseInputDevice::HandleMonitor(BMessage *message)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
int32 opcode = 0;
|
int32 opcode = 0;
|
||||||
status_t status;
|
status_t status;
|
||||||
if ((status = message->FindInt32("opcode", &opcode)) < B_OK)
|
if ((status = message->FindInt32("opcode", &opcode)) < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
if ((opcode != B_ENTRY_CREATED)
|
if ((opcode != B_ENTRY_CREATED)
|
||||||
&& (opcode != B_ENTRY_REMOVED))
|
&& (opcode != B_ENTRY_REMOVED))
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
|
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
BPath path;
|
BPath path;
|
||||||
dev_t device;
|
dev_t device;
|
||||||
ino_t directory;
|
ino_t directory;
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
|
|
||||||
message->FindInt32("device", &device);
|
message->FindInt32("device", &device);
|
||||||
message->FindInt64("directory", &directory);
|
message->FindInt64("directory", &directory);
|
||||||
message->FindString("name", &name);
|
message->FindString("name", &name);
|
||||||
|
|
||||||
entry_ref ref(device, directory, name);
|
entry_ref ref(device, directory, name);
|
||||||
|
|
||||||
if ((status = entry.SetTo(&ref)) != B_OK)
|
if ((status = entry.SetTo(&ref)) != B_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((status = entry.GetPath(&path)) != B_OK)
|
if ((status = entry.GetPath(&path)) != B_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((status = path.InitCheck()) != B_OK)
|
if ((status = path.InitCheck()) != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
if (opcode == B_ENTRY_CREATED)
|
if (opcode == B_ENTRY_CREATED)
|
||||||
AddDevice(path.Path());
|
AddDevice(path.Path());
|
||||||
else
|
else
|
||||||
RemoveDevice(path.Path());
|
RemoveDevice(path.Path());
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -432,12 +433,12 @@ get_short_name(const char *longName)
|
|||||||
BString name;
|
BString name;
|
||||||
|
|
||||||
int32 slash = string.FindLast("/");
|
int32 slash = string.FindLast("/");
|
||||||
int32 previousSlash = string.FindLast("/", slash) + 1;
|
string.CopyInto(name, slash + 1, string.Length() - slash);
|
||||||
string.CopyInto(name, slash, string.Length() - slash);
|
int32 index = atoi(name.String()) + 1;
|
||||||
|
|
||||||
int32 deviceIndex = atoi(name.String()) + 1;
|
int32 previousSlash = string.FindLast("/", slash);
|
||||||
string.CopyInto(name, previousSlash, slash - previousSlash);
|
string.CopyInto(name, previousSlash + 1, slash - previousSlash - 1);
|
||||||
name << " mouse " << deviceIndex;
|
name << " Mouse " << index;
|
||||||
|
|
||||||
return strdup(name.String());
|
return strdup(name.String());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user