Mouse focus and keyboard error in windows

I had the same issue when plugging in my Cyborg RAT 7 mouse. To fix this (at least for my mouse, maybe yours too), add this to /etc/X11/xorg.conf (create the file if it's not there):

Section "InputClass"
    Identifier "Mouse Remap"
    MatchProduct "Saitek Cyborg R.A.T.7 Mouse"
    MatchDevicePath "/dev/input/event*"
    Option "ButtonMapping" "1 2 3 4 5 6 7 2 9 10 11 12 0 0 0"
EndSection

Log out and log back in and your mouse should work fine. Change the MatchProduct line and ButtonMapping (if necessary) to match your mouse.