summaryrefslogtreecommitdiff
path: root/openbox/action.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-05-12 19:26:48 +0000
committerDana Jansens <danakj@orodu.net>2007-05-12 19:26:48 +0000
commitfce33883f4828d5dcdc0452f1474fed9a6ff2e2f (patch)
treef80c86a6012482aea960cad9d5d030215e01705e /openbox/action.c
parent1a23a1bb8b9999cc447946f21abf4905411f4d4e (diff)
fix for running actions that end up wanting to grab the keyboard. make a nicer comment about what is going on.
Diffstat (limited to 'openbox/action.c')
-rw-r--r--openbox/action.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/openbox/action.c b/openbox/action.c
index 8e7b56a3..931cff39 100644
--- a/openbox/action.c
+++ b/openbox/action.c
@@ -1101,12 +1101,20 @@ void action_run_list(GSList *acts, ObClient *c, ObFrameContext context,
}
}
- if (!inter) {
- /* sometimes when we execute another app as an action,
- it won't work right unless we XUngrabKeyboard first,
- even though we grabbed the key/button Asychronously.
- e.g. "gnome-panel-control --main-menu" */
- grab_keyboard(FALSE);
+ if (!inter && button == 0) {
+ /* Ungrab the keyboard before running the action, if it was
+ not from a mouse event.
+
+ We have to do this because a key press causes a passive
+ grab on the keyboard, and so if the action we are running
+ wants to grab the keyboard, it will fail if the button is still
+ held down (which is likely).
+
+ Use the X function not out own, because we're not considering
+ a grab to be in place at all so our function won't try ungrab
+ anything.
+ */
+ XUngrabKeyboard(ob_display, time);
}
for (it = acts; it; it = g_slist_next(it)) {
@@ -1138,8 +1146,9 @@ void action_run_list(GSList *acts, ObClient *c, ObFrameContext context,
{
/* interactive actions are not queued */
a->func(&a->data);
- } else if ((context == OB_FRAME_CONTEXT_CLIENT ||
- (c && c->type == OB_CLIENT_TYPE_DESKTOP &&
+ } else if (c &&
+ (context == OB_FRAME_CONTEXT_CLIENT ||
+ (c->type == OB_CLIENT_TYPE_DESKTOP &&
context == OB_FRAME_CONTEXT_DESKTOP)) &&
(a->func == action_focus ||
a->func == action_activate ||