summaryrefslogtreecommitdiff
path: root/src/actions.c
diff options
context:
space:
mode:
authorShawn Betts <sabetts@gmail.com>2009-04-13 05:50:35 -0700
committerShawn Betts <sabetts@gmail.com>2009-04-13 05:50:35 -0700
commita4de27cea6f5bf937f9b282f0195c0e4763a185f (patch)
tree82da8bff604464d0ae1a6136200df4cc1abd5395 /src/actions.c
parentc7b3817c222952196b11825076c902d6dd1da455 (diff)
downloadratpoison-a4de27cea6f5bf937f9b282f0195c0e4763a185f.zip
grab the keyboard and pointer in cmd_resize
* fixes a bug that hangs rp: in resize mode, click firefox and rp hangs
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/actions.c b/src/actions.c
index 4099392..da14648 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1022,6 +1022,20 @@ parse_keydesc (char *s, struct rp_key *key)
return NULL;
}
+static void
+grab_rat (void)
+{
+ XGrabPointer (dpy, current_screen()->root, True, 0,
+ GrabModeAsync, GrabModeAsync,
+ None, current_screen()->rat, CurrentTime);
+}
+
+static void
+ungrab_rat (void)
+{
+ XUngrabPointer (dpy, CurrentTime);
+}
+
/* Unmanage window */
cmdret *
cmd_unmanage (int interactive, struct cmdarg **args)
@@ -2998,8 +3012,6 @@ cmd_resize (int interactive, struct cmdarg **args)
unsigned int mod;
KeySym c;
struct list_head *bk;
- Window focus;
- int revert;
/* If we haven't got at least 2 frames, there isn't anything to
scale. */
@@ -3010,8 +3022,8 @@ cmd_resize (int interactive, struct cmdarg **args)
bk = screen_copy_frameset (s);
/* Get ready to read keys. */
- XGetInputFocus (dpy, &focus, &revert);
- set_window_focus (s->key_window);
+ grab_rat();
+ XGrabKeyboard (dpy, s->key_window, False, GrabModeAsync, GrabModeAsync, CurrentTime);
while (1)
{
@@ -3061,7 +3073,8 @@ cmd_resize (int interactive, struct cmdarg **args)
free (bk);
hide_frame_indicator ();
- set_window_focus (focus);
+ ungrab_rat();
+ XUngrabKeyboard (dpy, CurrentTime);
}
else
{
@@ -5192,20 +5205,6 @@ cmd_gdelete (int interactive, struct cmdarg **args)
return cmdret_new (RET_SUCCESS, NULL);
}
-static void
-grab_rat (void)
-{
- XGrabPointer (dpy, current_screen()->root, True, 0,
- GrabModeAsync, GrabModeAsync,
- None, current_screen()->rat, CurrentTime);
-}
-
-static void
-ungrab_rat (void)
-{
- XUngrabPointer (dpy, CurrentTime);
-}
-
cmdret *
cmd_readkey (int interactive, struct cmdarg **args)
{