From bd7aa51699f49cf7a67c403ba7f2ba3738fcf644 Mon Sep 17 00:00:00 2001 From: Shawn Betts Date: Mon, 13 Apr 2009 05:19:46 -0700 Subject: fix segfault in banishrel and make it banish to the corner of the frame when there's no window * update documentation --- doc/ratpoison.1 | 2 +- doc/ratpoison.texi | 2 +- src/actions.c | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/ratpoison.1 b/doc/ratpoison.1 index ef2acc9..12c31e0 100644 --- a/doc/ratpoison.1 +++ b/doc/ratpoison.1 @@ -228,7 +228,7 @@ Banish the rat cursor to the lower right corner of the screen. .cmd banishrel Banish the rat cursor to the lower right corner of the curren window. If there isn't a window in the current frame, it banishes the rat cursor -to the lower right corner of the screen. +to the lower right corner of the frame. .cmd chdir [ directory ] If the optional argument is given, change the current directory of ratpoison to \fIdirectory\fP. diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi index faf61c6..179b7e7 100644 --- a/doc/ratpoison.texi +++ b/doc/ratpoison.texi @@ -1467,7 +1467,7 @@ Banish the mouse to the lower right corner of the screen. @deffn banishrel Banish the rat cursor to the lower right corner of the curren window. If there isn't a window in the current frame, it banishes the rat cursor -to the lower right corner of the screen. +to the lower right corner of the frame. @end deffn @deffn Command chdir diff --git a/src/actions.c b/src/actions.c index 7e587b7..3958938 100644 --- a/src/actions.c +++ b/src/actions.c @@ -3106,15 +3106,15 @@ cmd_banish (int interactive, struct cmdarg **args) cmdret * cmd_banishrel (int interactive, struct cmdarg **args) { - rp_screen *s; - rp_window *w; + rp_screen *s = current_screen(); + rp_window *w = current_window(); + rp_frame *f = current_frame(); - s = current_screen(); - w = current_window(); - if (!w) - cmd_banish (interactive, args); + if (w) + XWarpPointer (dpy, None, w->w, 0, 0, 0, 0, w->x + w->width - 2, w->y + w->height - 2); + else + XWarpPointer (dpy, None, s->root, 0, 0, 0, 0, f->x + f->width, f->y + f->height); - XWarpPointer (dpy, None, w->w, 0, 0, 0, 0, w->x + w->width - 2, w->y + w->height - 2); return cmdret_new (RET_SUCCESS, NULL); } -- cgit v1.2.3