How to prohibit user to change OS window focus for some time on Linux

view story

http://stackoverflow.com – I am on Ubuntu. I write a script that needs OS window focus to be set on 3rd party application (Firefox browser). Currently I switch focus to Firefox using XDoTool and then do mouse clicks/key presses that require window focus. But user may accidentally change window focus manually. I'd want to prohibit user to change focus for those several seconds when those mouse clicks/key presses are done. Can I do it? (HowTos)