[haiku-commits] Change in haiku[master]: input_server: use a better name for trackpoint devices

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 5 Feb 2020 15:23:39 +0000

From Adrien Destugues <pulkomandy@xxxxxxxxx>:

Adrien Destugues has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/2209 ;)


Change subject: input_server: use a better name for trackpoint devices
......................................................................

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
---
M src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp
1 file changed, 14 insertions(+), 5 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/09/2209/1

diff --git a/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 
b/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp
index 4e81432..76ef0a4 100644
--- a/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp
+++ b/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp
@@ -300,12 +300,18 @@
 char*
 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 deviceName;
        BString name;

        int32 slash = string.FindLast("/");
-       string.CopyInto(name, slash + 1, string.Length() - slash);
-       int32 index = atoi(name.String()) + 1;
+       string.CopyInto(deviceName, slash + 1, string.Length() - slash);
+       // 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);
        string.CopyInto(name, previousSlash + 1, slash - previousSlash - 1);
@@ -313,15 +319,18 @@
        if (name == "ps2")
                name = "PS/2";

-       if (name.Length() < 4)
+       if (name.Length() <= 4)
                name.ToUpper();
        else
                name.Capitalize();

-       if (string.FindFirst("touchpad") >= 0) {
+       if (deviceName.FindFirst("touchpad") >= 0) {
                name << " Touchpad ";
+       } else if (deviceName.FindFirst("trackpoint") >= 0) {
+               // That's always PS/2, so don't keep the bus name
+               name = "Trackpoint ";
        } else {
-               if (string.FindFirst("intelli") >= 0)
+               if (deviceName.FindFirst("intelli") >= 0)
                        name.Prepend("Extended ");

                name << " Mouse ";

--
To view, visit https://review.haiku-os.org/c/haiku/+/2209
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Ia67e57c449e0ad292ce573b50a1e533d84c90d68
Gerrit-Change-Number: 2209
Gerrit-PatchSet: 1
Gerrit-Owner: Adrien Destugues <pulkomandy@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: input_server: use a better name for trackpoint devices - Gerrit