summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-05-26 22:13:34 +0000
committerDana Jansens <danakj@orodu.net>2007-05-26 22:13:34 +0000
commit5e9e266722826fbd5907df1bf900864ab23f6539 (patch)
tree8750a5187dd73edaa93433be6d8d5c459abd6aaa /openbox
parent4a45cabd4fb99ac787a3f84f89541e1c76e578b4 (diff)
change in how things are ungrabbed to avoid grabwhilenotify. don't ungrab every key press. just ungrab the passive grab when there is no active grab and we are going to move focus.
this should be less intrusive and seems to work
Diffstat (limited to 'openbox')
-rw-r--r--openbox/action.c8
-rw-r--r--openbox/client.c6
-rw-r--r--openbox/event.c19
-rw-r--r--openbox/event.h3
-rw-r--r--openbox/keyboard.c8
5 files changed, 27 insertions, 17 deletions
diff --git a/openbox/action.c b/openbox/action.c
index 4bb292ef..39da39a5 100644
--- a/openbox/action.c
+++ b/openbox/action.c
@@ -1216,11 +1216,9 @@ void action_execute(union ActionData *data)
if (data->execute.path) {
cmd = g_filename_from_utf8(data->execute.path, -1, NULL, NULL, NULL);
if (cmd) {
- /* If there is an interactive action going on, then cancel it
- to release the keyboard, so that the run application
- can grab the keyboard if it wants to. */
- if (keyboard_interactively_grabbed())
- keyboard_interactive_cancel();
+ /* If there is a keyboard grab going on then we need to cancel
+ it so the application can grab things */
+ event_cancel_all_key_grabs();
if (!g_shell_parse_argv (cmd, NULL, &argv, &e)) {
g_message(_("Failed to execute '%s': %s"),
diff --git a/openbox/client.c b/openbox/client.c
index ffbcd5ca..bf772336 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -2540,8 +2540,7 @@ gboolean client_hide(ObClient *self)
actions should not rely on being able to move focus during an
interactive grab.
*/
- if (keyboard_interactively_grabbed())
- keyboard_interactive_cancel();
+ event_cancel_all_key_grabs();
}
frame_hide(self->frame);
@@ -3526,8 +3525,7 @@ gboolean client_focus(ObClient *self)
actions should not rely on being able to move focus during an
interactive grab.
*/
- if (keyboard_interactively_grabbed())
- keyboard_interactive_cancel();
+ event_cancel_all_key_grabs();
xerror_set_ignore(TRUE);
xerror_occured = FALSE;
diff --git a/openbox/event.c b/openbox/event.c
index cb739339..e7ef27fb 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -1837,6 +1837,25 @@ static gboolean is_enter_focus_event_ignored(XEvent *e)
return FALSE;
}
+void event_cancel_all_key_grabs()
+{
+ if (keyboard_interactively_grabbed())
+ keyboard_interactive_cancel();
+ else if (menu_frame_visible)
+ menu_frame_hide_all();
+ else if (grab_on_keyboard())
+ ungrab_keyboard();
+ else
+ /* If we don't have the keyboard grabbed, then ungrab it with
+ XUngrabKeyboard, so that there is not a passive grab left
+ on from the KeyPress. If the grab is left on, and focus
+ moves during that time, it will be NotifyWhileGrabbed, and
+ applications like to ignore those! */
+ if (!keyboard_interactively_grabbed())
+ XUngrabKeyboard(ob_display, CurrentTime);
+
+}
+
gboolean event_time_after(Time t1, Time t2)
{
g_assert(t1 != CurrentTime);
diff --git a/openbox/event.h b/openbox/event.h
index 542115fb..29f621d5 100644
--- a/openbox/event.h
+++ b/openbox/event.h
@@ -43,6 +43,9 @@ void event_enter_client(struct _ObClient *client);
till now. */
void event_ignore_all_queued_enters();
+/*! End *all* active and passive grabs on the keyboard */
+void event_cancel_all_key_grabs();
+
/* Halts any focus delay in progress, use this when the user is selecting a
window for focus */
void event_halt_focus_delay();
diff --git a/openbox/keyboard.c b/openbox/keyboard.c
index 2c60ac3d..218e251a 100644
--- a/openbox/keyboard.c
+++ b/openbox/keyboard.c
@@ -311,14 +311,6 @@ void keyboard_event(ObClient *client, const XEvent *e)
else {
keyboard_reset_chains(0);
- /* If we don't have the keyboard grabbed, then ungrab it with
- XUngrabKeyboard, so that there is not a passive grab left
- on from the KeyPress. If the grab is left on, and focus
- moves during that time, it will be NotifyWhileGrabbed, and
- applications like to ignore those! */
- if (!keyboard_interactively_grabbed())
- XUngrabKeyboard(ob_display, e->xkey.time);
-
action_run_key(p->actions, client, e->xkey.state,
e->xkey.x_root, e->xkey.y_root,
e->xkey.time);