diff -ur ratpoison-oldbranch/AUTHORS ratpoison-oldbranch-patched/AUTHORS --- ratpoison-oldbranch/AUTHORS 2005-02-03 19:08:14.000000000 +0100 +++ ratpoison-oldbranch-patched/AUTHORS 2005-02-06 13:08:14.000000000 +0100 @@ -20,7 +20,7 @@ Gergely Nagy Henrik Enberg Jonathan Walther -Martin Samuelsson +Martin Samuelsson Mike Meyer Nicklas Lindgren Pasi Kallinen diff -ur ratpoison-oldbranch/doc/ratpoison.texi ratpoison-oldbranch-patched/doc/ratpoison.texi --- ratpoison-oldbranch/doc/ratpoison.texi 2005-02-03 19:08:15.000000000 +0100 +++ ratpoison-oldbranch-patched/doc/ratpoison.texi 2005-02-06 13:27:35.000000000 +0100 @@ -1293,6 +1293,10 @@ Display a help screen that lists all bound keystrokes. @end deffn address@hidden Command keypress @var{key} +Act as the given key was pressed and send it to the current window. address@hidden deffn + @deffn Command license Display ratpoison's license. By default, this is bound to @kbd{C-t V}. @end deffn diff -ur ratpoison-oldbranch/src/actions.c ratpoison-oldbranch-patched/src/actions.c --- ratpoison-oldbranch/src/actions.c 2005-02-03 19:08:17.000000000 +0100 +++ ratpoison-oldbranch-patched/src/actions.c 2005-02-06 14:04:24.000000000 +0100 @@ -218,6 +218,7 @@ add_command ("hsplit", cmd_h_split, 1, 0, 0, "Split: ", arg_STRING); add_command ("info", cmd_info, 0, 0, 0); + add_command ("keypress", cmd_keypress, 1, 1, 1); add_command ("kill", cmd_kill, 0, 0, 0); add_command ("lastmsg", cmd_lastmsg, 0, 0, 0); add_command ("license", cmd_license, 0, 0, 0); @@ -993,6 +994,37 @@ } cmdret * +cmd_keypress (int interactive, struct cmdarg **args) +{ + struct rp_key *key; + XEvent ev1, ev; + ev = rp_current_event; + + fprintf(stderr, "debug\n", args[0]); + + if (current_window() == NULL) + return cmdret_new (NULL, RET_FAILURE); + + ev1.xkey.type = KeyPress; + ev1.xkey.display = dpy; + ev1.xkey.window = current_window()->w; + + key = parse_keydesc (args[0]->string); + ev1.xkey.state = rp_mask_to_x11_mask (key->state); + if(!(ev1.xkey.keycode = XKeysymToKeycode (dpy, key->sym))) + return cmdret_new (NULL, RET_FAILURE); + + XSendEvent (dpy, current_window()->w, False, KeyPressMask, &ev1); + + /* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, 't'), True, 0); */ + + XSync (dpy, False); + + return cmdret_new (NULL, RET_SUCCESS); +} + + +cmdret * cmd_meta (int interactive, struct cmdarg **args) { XEvent ev1, ev; @@ -1004,6 +1036,7 @@ 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); diff -ur ratpoison-oldbranch/src/actions.h ratpoison-oldbranch-patched/src/actions.h --- ratpoison-oldbranch/src/actions.h 2005-02-03 19:08:17.000000000 +0100 +++ ratpoison-oldbranch-patched/src/actions.h 2005-02-06 13:38:43.000000000 +0100 @@ -126,6 +126,7 @@ RP_CMD (h_split); RP_CMD (help); RP_CMD (info); +RP_CMD (keypress); RP_CMD (kill); RP_CMD (last); RP_CMD (lastmsg);