diff options
author | sabetts <sabetts> | 2004-11-12 01:55:03 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2004-11-12 01:55:03 +0000 |
commit | 309035ba7dfc194e45cd807d77b0837410719db8 (patch) | |
tree | 2944bd51f3a1e170171f769e8e70aeccdf7eb5a5 /src/actions.c | |
parent | dd6464d797e904ccb4ad35057d5d0907a871728f (diff) | |
download | ratpoison-309035ba7dfc194e45cd807d77b0837410719db8.zip |
* src/actions.c (cmd_ratclick): new function
(cmd_ratrelwarp): likewise
(cmd_ratwarp): likewise
(user_commands): new commands ratclick, ratrelwarp, ratwarp.
* contrib/genrpbindings: add common lisp bindings
Diffstat (limited to 'src/actions.c')
-rw-r--r-- | src/actions.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/actions.c b/src/actions.c index 6040d96..8f4ea6f 100644 --- a/src/actions.c +++ b/src/actions.c @@ -21,6 +21,7 @@ #include <unistd.h> #include <sys/wait.h> #include <X11/keysym.h> +#include <X11/extensions/XTest.h> #include <string.h> #include <strings.h> #include <time.h> @@ -88,6 +89,9 @@ static user_command user_commands[] = {"prev", cmd_prev, arg_VOID}, {"prevscreen", cmd_prevscreen, arg_VOID}, {"quit", cmd_quit, arg_VOID}, + {"ratwarp", cmd_ratwarp, arg_VOID}, + {"ratrelwarp", cmd_ratrelwarp, arg_VOID}, + {"ratclick", cmd_ratclick, arg_VOID}, {"readkey", cmd_readkey, arg_STRING}, {"redisplay", cmd_redisplay, arg_VOID}, {"remhook", cmd_remhook, arg_STRING}, @@ -1879,6 +1883,73 @@ cmd_banish (int interactive, char *data) } char * +cmd_ratwarp (int interactive, char *data) +{ + rp_screen *s; + int x, y; + + s = current_screen (); + + if (data == NULL) + { + message("ratwarp: 2 arguments required"); + return NULL; + } + + if (sscanf(data, "%d %d", &x, &y) < 2 || x < 0 || y < 0) + { + message("ratwarp: Invalid arguments"); + return NULL; + } + + XWarpPointer (dpy, None, s->root, 0, 0, 0, 0, x, y); + return NULL; +} + +char * +cmd_ratrelwarp (int interactive, char *data) +{ + rp_screen *s; + int x, y; + + s = current_screen (); + + if (data == NULL) + { + message("ratrelwarp: 2 arguments required"); + return NULL; + } + + if (sscanf(data, "%d %d", &x, &y) < 2) + { + message("ratrelwarp: Invalid arguments"); + return NULL; + } + + XWarpPointer (dpy, None, None, 0, 0, 0, 0, x, y); + return NULL; +} + +char * +cmd_ratclick (int interactive, char *data) +{ + int button = 1; + + if (data != NULL) + { + if (sscanf (data, "%d", &button) < 1 || button < 1 || button > 3) + { + message("ratclick: invalid argument"); + } + } + + XTestFakeButtonEvent(dpy, button, True, CurrentTime); + XTestFakeButtonEvent(dpy, button, False, CurrentTime); + return NULL; +} + + +char * cmd_curframe (int interactive, char *data) { show_frame_indicator(); |