summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsabetts <sabetts>2004-11-12 01:55:03 +0000
committersabetts <sabetts>2004-11-12 01:55:03 +0000
commit309035ba7dfc194e45cd807d77b0837410719db8 (patch)
tree2944bd51f3a1e170171f769e8e70aeccdf7eb5a5 /src
parentdd6464d797e904ccb4ad35057d5d0907a871728f (diff)
downloadratpoison-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')
-rw-r--r--src/actions.c71
-rw-r--r--src/actions.h3
2 files changed, 74 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();
diff --git a/src/actions.h b/src/actions.h
index 62e5df5..b55a5d3 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -125,6 +125,9 @@ char *cmd_delkmap (int interactive, char *data);
char *cmd_definekey (int interactive, char *data);
char *cmd_set (int interactive, char *data);
char *cmd_sselect(int interactive, char *data);
+char *cmd_ratwarp (int interactive, char *data);
+char *cmd_ratclick (int interactive, char *data);
+char * cmd_ratrelwarp (int interactive, char *data);
rp_keymap *find_keymap (char *name);
void initialize_default_keybindings (void);