summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--NEWS4
-rw-r--r--doc/ratpoison.texi14
-rw-r--r--src/actions.c27
4 files changed, 42 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index ab73722..3121b9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-04-09 Shawn <sabetts@monk.lamenet>
+
+ * src/actions.c (init_user_commands): add KEY argument to meta command.
+ (cmd_meta): optionally use the KEY passed in as an argument.
+
2005-03-05 <sabetts@localhost>
* src/ratpoison.h (check_child_procs): new prototype
diff --git a/NEWS b/NEWS
index 3d4b919..12ccd64 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@ Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
+* Changes since 1.4.0-beta2
+** meta takes a key argument
+This can be used to stuff keys.
+
* Changes since 1.4.0-beta1
** RATPOISON environment variable
RATPOISON is set to the location of the ratpoison binary. This is
diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi
index 074ec65..1794232 100644
--- a/doc/ratpoison.texi
+++ b/doc/ratpoison.texi
@@ -1334,8 +1334,18 @@ Display a help screen that lists all bound keystrokes.
Display ratpoison's license. By default, this is bound to @kbd{C-t V}.
@end deffn
-@deffn Command meta
-Send a @kbd{C-t} to the current window.
+@deffn Command meta @var{key}
+@var{key} is an optional argument. When @var{key} is omitted, send a
+@kbd{C-t} to the current window. Otherwise, send the key described by
+@var{key} to the current window.
+
+For example, if your @samp{Emacs} window is focused,
+
+@example
+meta M-x
+@end example
+
+Would cause emacs to prompt for an extended command.
@end deffn
@deffn Command prompt @var{prompt}
diff --git a/src/actions.c b/src/actions.c
index 8f016fe..acf8426 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -227,7 +227,8 @@ init_user_commands()
"Keymap: ", arg_KEYMAP);
add_command ("listhook", cmd_listhook, 1, 1, 1,
"Hook: ", arg_HOOK);
- add_command ("meta", cmd_meta, 0, 0, 0);
+ add_command ("meta", cmd_meta, 1, 0, 0,
+ "key: ", arg_KEY);
add_command ("msgwait", cmd_msgwait, 1, 0, 0,
"", arg_NUMBER);
add_command ("newkmap", cmd_newkmap, 1, 1, 1,
@@ -1009,18 +1010,32 @@ cmd_source (int interactive, struct cmdarg **args)
cmdret *
cmd_meta (int interactive, struct cmdarg **args)
{
+ cmdret *ret = NULL;
+ struct rp_key key;
XEvent ev1, ev;
ev = rp_current_event;
if (current_window() == NULL)
return cmdret_new (RET_FAILURE, NULL);
- ev1.xkey.type = KeyPress;
- ev1.xkey.display = dpy;
- ev1.xkey.window = current_window()->w;
- ev1.xkey.state = rp_mask_to_x11_mask (prefix_key.state);
- ev1.xkey.keycode = XKeysymToKeycode (dpy, prefix_key.sym);
+ ev1.xkey.type = KeyPress;
+ ev1.xkey.display = dpy;
+ ev1.xkey.window = current_window()->w;
+
+ if (args[0])
+ {
+ if((ret = parse_keydesc (ARG_STRING(0), &key)))
+ return ret;
+ ev1.xkey.state = rp_mask_to_x11_mask (key.state);
+ if(!(ev1.xkey.keycode = XKeysymToKeycode (dpy, key.sym)))
+ return cmdret_new (RET_FAILURE, "meta: Couldn't convert keysym to keycode");
+ }
+ else
+ {
+ ev1.xkey.state = rp_mask_to_x11_mask (prefix_key.state);
+ ev1.xkey.keycode = XKeysymToKeycode (dpy, prefix_key.sym);
+ }
XSendEvent (dpy, current_window()->w, False, KeyPressMask, &ev1);
/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, 't'), True, 0); */