Comment 2 for bug 925293

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Ideally I think you'd only care if <alt>someotherkey happened if a passive grab was activated on that other key.

So for example in X we have XGrabKey which allows you to specify a key and modifiers (or just a keycode which happens to be a modifier) which makes a keyboard grab activate as soon as that key is pressed. This means that you get the KeyPress and KeyRelease, but *only* for that key, unless you do a full keyboard grab (but note that there's a race condition here between when the key itself is grabbed and when the plugin explicitly grabs the full keyboard. At least in compiz, the rule now is that if you didn't request for the keyboard to be grabbed, it will be ungrabbed as soon as your action callback is finished.

I think that, the best way to handle this case is to keep a watch on which keybindings are still being held down and whether or not a window lost focus due to a grab (eg FocusOut with NotifyGrab on the xevent->xfocus.mode) - this would most likely mean that some other keybinding in either compiz or another application was activated, and in that case, we should send CompAction::StateCancel to the original action rather than CompAction::StateTerminate.