3

XGrabPointer prevents Alt+Tab application switching

view full story
linux-howto

http://www.linuxquestions.org – I'm writing a game for Linux using Xlib whereby when a window becomes active it will take control of the mouse using XGrabPointer. The idea being that if the users switches applications through Alt+Tab the game will relinquish the mouse with a call to XUngrabPointer. The game is using the FocusIn event to determine when it has been activated and needs to grab the mouse, and likewise uses the FocusOut event to release the mouse. This causes a problem because for some reason an Alt+Tab from the keyboards generates two FocusOut events and then a FocusIn event causing the game to take control and no application switching occurs. If the game does not grab the mouse, then application switching works fine. What is needed so that application switching can work while the game has control of the mouse? I am running Fedora 12 on an Intel Core2 Duo machine. I am also using Compiz as the window manager. (HowTos)