diff options
author | Shawn Betts <sabetts@gmail.com> | 2009-04-13 05:33:47 -0700 |
---|---|---|
committer | Shawn Betts <sabetts@gmail.com> | 2009-04-13 05:33:47 -0700 |
commit | c7b3817c222952196b11825076c902d6dd1da455 (patch) | |
tree | cc974ae03a4d81818551df347479f10b369e0379 /src | |
parent | bd7aa51699f49cf7a67c403ba7f2ba3738fcf644 (diff) | |
download | ratpoison-c7b3817c222952196b11825076c902d6dd1da455.zip |
make ratinfo and ratrelinfo work with ratpoison -c and return coordinates relative to current frame when there's no window
* update docs
Diffstat (limited to 'src')
-rw-r--r-- | src/actions.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/actions.c b/src/actions.c index 3958938..4099392 100644 --- a/src/actions.c +++ b/src/actions.c @@ -3128,9 +3128,8 @@ cmd_ratinfo (int interactive, struct cmdarg **args) s = current_screen(); XQueryPointer (dpy, s->root, &root_win, &child_win, &mouse_x, &mouse_y, &root_x, &root_y, &mask); - marked_message_printf (0, 0, "%d %d", mouse_x, mouse_y ); - return cmdret_new (RET_SUCCESS, NULL); + return cmdret_new (RET_SUCCESS, "%d %d", mouse_x, mouse_y); } cmdret * @@ -3138,20 +3137,25 @@ cmd_ratrelinfo (int interactive, struct cmdarg **args) { rp_screen *s; rp_window *rpw; + rp_frame *f; Window root_win, child_win; int mouse_x, mouse_y, root_x, root_y; unsigned int mask; s = current_screen(); rpw = current_window(); + f = current_frame(); - if (!rpw) - return cmd_ratinfo (interactive, args); - - XQueryPointer (dpy, rpw->w, &root_win, &child_win, &mouse_x, &mouse_y, &root_x, &root_y, &mask); - marked_message_printf (0, 0, "%d %d", root_x, root_y ); + if (rpw) + XQueryPointer (dpy, rpw->w, &root_win, &child_win, &mouse_x, &mouse_y, &root_x, &root_y, &mask); + else + { + XQueryPointer (dpy, s->root, &root_win, &child_win, &mouse_x, &mouse_y, &root_x, &root_y, &mask); + root_x -= f->x; + root_y -= f->y; + } - return cmdret_new (RET_SUCCESS, NULL); + return cmdret_new (RET_SUCCESS, "%d %d", root_x, root_y); } cmdret * |