Wacom Mouse Button Source Patch

2005-03-20
2013-06-03
  • Daphne Pfister
    Daphne Pfister
    2005-03-20

    I've noticed that XDarwin does not handle the Wacom mouse buttons correctly. I was able to get them to work with the following changes to XServer.m. I tested this patch with a Wacom Intuos 2 tablet and a programmable wireless logitech 3 button mouse with scrollwheel under OS X 10.3.8 and using xev.

    http://homepage.mac.com/daphnediane/XServer.patch

     
    • Thanks for the patch! I have experimented with this patch and it looks very promising. However, I wonder about this part of it:

      +        case NSOtherMouseUp:
      +        {
      +            int hwButton = [anEvent buttonNumber];
      +
      +            if (hwButton == 1) {
      +                // Some programmable mice will use this event even for left buttons

      Since you are just copying code from the NSLeftMouse case and anEvent will respond to [anEvent buttonNumber] for NSLeftMouse events as well, it seems best just to combine the two cases. However, buttonNumber of 1 means the right mouse button. The left mouse button has buttonNumber == 0. What case exactly does this special code for NSOtherMouse cover? I don't think the mouse would work which didn't generate an NSLeftMouse event for a mouse click/release would really work with most Cocoa apps since most of them will not pay attention to NSOtherMouse events.

      I'm tempted to think what we really should do is just to ditch the NSSystemDefined case as you have done and catch this instead with NSOtherMouse events. However, I don't see why we would need a special case for NSOtherMouse in case buttonNumber is 0 or 1.

      Any thoughts?

       
    • Daphne Pfister
      Daphne Pfister
      2005-04-01

      Coming from an X11 background I was under the mistaken impression that button number 1 was left, 2 was middle and 3 was right. Yeah it should be possible to combine the NSLeftMouse, NSRightMouse and NSOtherMouse into general mouse down and mouse up case. A function would be needed to map the Mac button numbers into X11 button number. Something like 0->1, 1->3, 2-2.

      One issue is what happens with mac button 3 and higher. For example the mouse with my Wacom tablet has 5 buttons and a scroll wheel. Using the scroll wheel sends a NSScrollWhell event which gets mapped into buttons 4 and 5. Should Mac button 3 be converted say to button 6, etc?

      As for the special case in the NSOtherMouse cases, I don't think it's needed. I traced done the problem I was having to a configuration problem with my wireless mouse. I had the middle/scroll wheel button set to send a left click instead of a middle click. Which for some reason was sending NSOtherMouse events instead of NSLeftMouse events.

       
      • I committed a simplified version of your patch to CVS. Let me know if it works correctly for you.

        >One issue is what happens with mac button 3 and higher.

        Good question. For this patch, I preserved the existing behavior that button 3 and higher would just get mapped as button+1. Thus you would not get any "new" buttons unless you had a 6 or more button mouse. If I recall correctly there may be an issue with more than 5 virtual mouse buttons, but I don't have a mouse with enough real buttons to test it with.

         
        • Daphne Pfister
          Daphne Pfister
          2005-04-23

          I've noticed no trouble with this patch and using my Wacom tablet. I also did changing the code slightly for using the extra buttons as 6 and 7 also and didn't see a problem there, but I could see how some apps might not know how to deal with more than 5 button numbers.