If it helps, I don't seem to have the screensaver issue on my Mac, but I do seem to remember a time where Windows did that when I was using my controller. (I believe it was a Gravis.) It might have something to do with the controller driver as well.
Or here's a thought... and you've probably already tried this, but what about running in Full Screen?
The joypad is a Saitek p2500 Rumble:
as for the driver it seems well supported by Linux: I simply plugged the USB cable in and it recognized it instantly with no problem and all functions working..
What I described is the window mode behaviour, in fullscreen is even worse
: when the screensaver starts the fullscreen switch to window mode and I'm unable to do anything from moving the mouse to press a key on the keyboard.
It seems not responding at all but I can still enter tty and kill mame process via console and reenter my desktop and restart mame.