Openbox goes weird with R.A.T.5 Mad Catz

Problem: when you connect the Mad Catz R.A.T.5 mouse to a Linux box running openbox window manager, the window handling stops working. Sometimes mouse follow focus does not work, sometimes even  clicking a window cannot activate it. Sometimes clicking window borders does not work, sometimes clicking into windows is ignored.

Solution: This mouse has a mode button, which is not sending a normal ButtonPress and ButtonRelease event, but it simulates a kind of holding shift function. e.g. pressing mode means holding Button13 and releasing Button14 and 15. Next time you press mode it’s holding Button14 and releasing Button13. There are several different modes. Openbox does weird things when these buttons are kept pressed. So I configured the xinput events to ignore buttons 13,14,15 by adding this line to my .xsession file:

xinput --set-button-map "Mad Catz Mad Catz R.A.T.5 Mouse" 1 2 3 4 5 6 7 8 9 10 11 12 0 0 0

Version: tested with Debian 7.0