[haiku-commits] haiku: hrev53835 - src/add-ons/input_server/devices/mouse

  • From: Adrien Destugues <pulkomandy@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 6 Feb 2020 02:29:17 -0500 (EST)

hrev53835 adds 1 changeset to branch 'master'
old head: 0a3f71b26fe1be1ab72128d788d06a15e38e154f
new head: ffd6c2f4bd56e878bbefd56affb3afd289c1d5f5
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=ffd6c2f4bd56+%5E0a3f71b26fe1

----------------------------------------------------------------------------

ffd6c2f4bd56: 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 <waddlesplash@xxxxxxxxx>

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53835
Commit:      ffd6c2f4bd56e878bbefd56affb3afd289c1d5f5
URL:         https://git.haiku-os.org/haiku/commit/?id=ffd6c2f4bd56
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Wed Feb  5 15:13:28 2020 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Thu Feb  6 07:29:13 2020 UTC

----------------------------------------------------------------------------

1 file changed, 14 insertions(+), 5 deletions(-)
.../devices/mouse/MouseInputDevice.cpp            | 19 ++++++++++++++-----

----------------------------------------------------------------------------

diff --git a/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 
b/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp
index 4e81432f2a..76ef0a41ef 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 @@ MouseDevice::UpdateTouchpadSettings(const BMessage* 
message)
 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 @@ MouseDevice::_BuildShortName() const
        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 ";


Other related posts:

  • » [haiku-commits] haiku: hrev53835 - src/add-ons/input_server/devices/mouse - Adrien Destugues