input_server: use a better name for trackpoint devices
Now that the names are visible in Input preferences, let's try to have better ones Change-Id: Ia67e57c449e0ad292ce573b50a1e533d84c90d68 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2209 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
0a3f71b26f
commit
ffd6c2f4bd
@@ -300,12 +300,18 @@ MouseDevice::UpdateTouchpadSettings(const BMessage* message)
|
|||||||
char*
|
char*
|
||||||
MouseDevice::_BuildShortName() const
|
MouseDevice::_BuildShortName() const
|
||||||
{
|
{
|
||||||
|
// TODO It would be simpler and better to use B_GET_DEVICE_NAME, but...
|
||||||
|
// - This is currently called before the device is open
|
||||||
|
// - We need to implement that in our input drivers first
|
||||||
BString string(fPath);
|
BString string(fPath);
|
||||||
|
BString deviceName;
|
||||||
BString name;
|
BString name;
|
||||||
|
|
||||||
int32 slash = string.FindLast("/");
|
int32 slash = string.FindLast("/");
|
||||||
string.CopyInto(name, slash + 1, string.Length() - slash);
|
string.CopyInto(deviceName, slash + 1, string.Length() - slash);
|
||||||
int32 index = atoi(name.String()) + 1;
|
// FIXME the device name may be more than just a number (for example
|
||||||
|
// ibm_trackpoint_0)
|
||||||
|
int32 index = atoi(deviceName.String()) + 1;
|
||||||
|
|
||||||
int32 previousSlash = string.FindLast("/", slash);
|
int32 previousSlash = string.FindLast("/", slash);
|
||||||
string.CopyInto(name, previousSlash + 1, slash - previousSlash - 1);
|
string.CopyInto(name, previousSlash + 1, slash - previousSlash - 1);
|
||||||
@@ -313,15 +319,18 @@ MouseDevice::_BuildShortName() const
|
|||||||
if (name == "ps2")
|
if (name == "ps2")
|
||||||
name = "PS/2";
|
name = "PS/2";
|
||||||
|
|
||||||
if (name.Length() < 4)
|
if (name.Length() <= 4)
|
||||||
name.ToUpper();
|
name.ToUpper();
|
||||||
else
|
else
|
||||||
name.Capitalize();
|
name.Capitalize();
|
||||||
|
|
||||||
if (string.FindFirst("touchpad") >= 0) {
|
if (deviceName.FindFirst("touchpad") >= 0) {
|
||||||
name << " Touchpad ";
|
name << " Touchpad ";
|
||||||
|
} else if (deviceName.FindFirst("trackpoint") >= 0) {
|
||||||
|
// That's always PS/2, so don't keep the bus name
|
||||||
|
name = "Trackpoint ";
|
||||||
} else {
|
} else {
|
||||||
if (string.FindFirst("intelli") >= 0)
|
if (deviceName.FindFirst("intelli") >= 0)
|
||||||
name.Prepend("Extended ");
|
name.Prepend("Extended ");
|
||||||
|
|
||||||
name << " Mouse ";
|
name << " Mouse ";
|
||||||
|
|||||||
Reference in New Issue
Block a user