diff options
author | sabetts <sabetts> | 2004-11-17 17:12:04 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2004-11-17 17:12:04 +0000 |
commit | d92174dc9e0c0f5fa91ac6e57cb320261f4a905d (patch) | |
tree | 5bbbed82b5fbaea7a01990d13dfda18358e46c16 | |
parent | 6314f28b1fd06837738e1628bb278e1a0a821180 (diff) | |
download | ratpoison-d92174dc9e0c0f5fa91ac6e57cb320261f4a905d.zip |
*** empty log message ***
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | doc/ratpoison.1 | 7 | ||||
-rw-r--r-- | doc/ratpoison.texi | 12 | ||||
-rw-r--r-- | src/actions.c | 95 |
4 files changed, 124 insertions, 10 deletions
@@ -1,8 +1,24 @@ -2004-11-17 Shawn Betts <katia_dilkina@verizon.net> +2004-11-17 Shawn Betts <sabetts@vcn.bc.ca> + + * src/actions.c (cmd_rathold): new function + +2004-11-17 Bernhard R. Link <brlink@debian.org> + + * src/actions.c: (initialize_default_keybindings): Added + default keybindings for focusleft,fcousup,focusright,focusdown. + (cmd_resize): Added support for multiple keybindings + per action. Added arrow keys, escape and vi-like h,j,k,l + to the keys used for resizing. + + * doc/ratpoison.1: Documented C-t arrow key + * doc/ratpoison.texi: Documented C-t arrow key, + fixed description of C-t f + +2004-11-17 Shawn Betts <sabetts@vcn.bc.ca> * contrib/rpws: use env to find out where bash is -2004-11-11 Shawn Betts <katia_dilkina@verizon.net> +2004-11-11 Shawn Betts <sabetts@vcn.bc.ca> * contrib/genrpbindings: fix up path to ratpoison binary diff --git a/doc/ratpoison.1 b/doc/ratpoison.1 index b7dacf2..46feffa 100644 --- a/doc/ratpoison.1 +++ b/doc/ratpoison.1 @@ -111,7 +111,14 @@ Banish the mouse to the lower right corner of the screen. Display a help screen .TP .B C\-t f, C\-t C\-f +Select a frame by number. +.TP +.B C\-t F Indicate which frame is the current frame. ++.TP ++.B C\-t arrow key ++Move to the frame adjoining the current frame in the ++given direction. .SH COMMANDS ratpoison can be controlled with commands (so called colon\-commands). The summary of available commands is listed below: diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi index 7433e99..c9a35b8 100644 --- a/doc/ratpoison.texi +++ b/doc/ratpoison.texi @@ -1063,6 +1063,18 @@ select a frame by number. @item C-t F Indicate which frame is the current frame. +@item C-t Down +Move to the frame below the current frame. + +@item C-t Left +Move to the frame left of the current frame. + +@item C-t Right +Move to the frame right of the current frame. + +@item C-t Up +Move to the frame above the current frame. + @end table @node Hooks, The Status Bar, Keystrokes, Top diff --git a/src/actions.c b/src/actions.c index 8f4ea6f..6612a8e 100644 --- a/src/actions.c +++ b/src/actions.c @@ -469,6 +469,10 @@ initialize_default_keybindings (void) add_keybinding (XK_S, RP_CONTROL_MASK, "hsplit", map); add_keybinding (XK_Tab, 0, "focus", map); add_keybinding (XK_Tab, RP_META_MASK, "focuslast", map); + add_keybinding (XK_Left, 0, "focusleft", map); + add_keybinding (XK_Right, 0, "focusright", map); + add_keybinding (XK_Up, 0, "focusup", map); + add_keybinding (XK_Down, 0, "focusdown", map); add_keybinding (XK_Q, 0, "only", map); add_keybinding (XK_R, 0, "remove", map); add_keybinding (XK_f, 0, "fselect", map); @@ -1758,6 +1762,40 @@ cmd_shrink (int interactive, char *data) return NULL; } +typedef struct resize_binding resize_binding; + +struct resize_binding +{ + struct rp_key key; + enum resize_action {RESIZE_UNKNOWN=0, RESIZE_VGROW, RESIZE_VSHRINK, + RESIZE_HGROW, RESIZE_HSHRINK, RESIZE_TO_WINDOW, + RESIZE_ABORT, RESIZE_END } action; +}; + +static resize_binding resize_bindings[] = + { {{INPUT_ABORT_KEY, INPUT_ABORT_MODIFIER}, RESIZE_ABORT}, + {{RESIZE_VGROW_KEY, RESIZE_VGROW_MODIFIER}, RESIZE_VGROW}, + {{RESIZE_VSHRINK_KEY, RESIZE_VSHRINK_MODIFIER}, RESIZE_VSHRINK}, + {{RESIZE_HGROW_KEY, RESIZE_HGROW_MODIFIER}, RESIZE_HGROW}, + {{RESIZE_HSHRINK_KEY, RESIZE_HSHRINK_MODIFIER}, RESIZE_HSHRINK}, + {{RESIZE_SHRINK_TO_WINDOW_KEY,RESIZE_SHRINK_TO_WINDOW_MODIFIER},RESIZE_TO_WINDOW}, + {{RESIZE_END_KEY, RESIZE_END_MODIFIER}, RESIZE_END}, +/* Some more default keys + * (after the values from conf.h, so that they have lower priority): + * first the arrow keys: */ + {{XK_Escape, 0}, RESIZE_ABORT}, + {{XK_Down, 0}, RESIZE_VGROW}, + {{XK_Up, 0}, RESIZE_VSHRINK}, + {{XK_Right, 0}, RESIZE_HGROW}, + {{XK_Left, 0}, RESIZE_HSHRINK}, +/* some vi-like bindings: */ + {{XK_j, 0}, RESIZE_VGROW}, + {{XK_k, 0}, RESIZE_VSHRINK}, + {{XK_l, 0}, RESIZE_HGROW}, + {{XK_h, 0}, RESIZE_HSHRINK}, + {{0, 0}, RESIZE_UNKNOWN} }; + + char * cmd_resize (int interactive, char *data) { @@ -1784,24 +1822,31 @@ cmd_resize (int interactive, char *data) while (1) { + struct resize_binding *binding; + show_frame_message (" Resize frame "); nbytes = read_key (&c, &mod, buffer, sizeof (buffer)); /* Convert the mask to be compatible with ratpoison. */ mod = x11_mask_to_rp_mask (mod); - if (c == RESIZE_VGROW_KEY && mod == RESIZE_VGROW_MODIFIER) + for (binding = resize_bindings; binding->action; binding++) + { + if (c == binding->key.sym && mod == binding->key.state) + break; + } + + if (binding->action == RESIZE_VGROW) resize_frame_vertically (current_frame(), defaults.frame_resize_unit); - else if (c == RESIZE_VSHRINK_KEY && mod == RESIZE_VSHRINK_MODIFIER) + else if (binding->action == RESIZE_VSHRINK) resize_frame_vertically (current_frame(), -defaults.frame_resize_unit); - else if (c == RESIZE_HGROW_KEY && mod == RESIZE_HGROW_MODIFIER) + else if (binding->action == RESIZE_HGROW) resize_frame_horizontally (current_frame(), defaults.frame_resize_unit); - else if (c == RESIZE_HSHRINK_KEY && mod == RESIZE_HSHRINK_MODIFIER) + else if (binding->action == RESIZE_HSHRINK) resize_frame_horizontally (current_frame(), -defaults.frame_resize_unit); - else if (c == RESIZE_SHRINK_TO_WINDOW_KEY - && mod == RESIZE_SHRINK_TO_WINDOW_MODIFIER) + else if (binding->action == RESIZE_TO_WINDOW) resize_shrink_to_window (current_frame()); - else if (c == INPUT_ABORT_KEY && mod == INPUT_ABORT_MODIFIER) + else if (binding->action == RESIZE_ABORT) { rp_frame *cur; @@ -1812,7 +1857,7 @@ cmd_resize (int interactive, char *data) } break; } - else if (c == RESIZE_END_KEY && mod == RESIZE_END_MODIFIER) + else if (binding->action == RESIZE_END) { frameset_free (bk); break; @@ -1948,6 +1993,40 @@ cmd_ratclick (int interactive, char *data) return NULL; } +char * +cmd_rathold (int interactive, char *data) +{ + int button = 1; + char *command; + + if (data != NULL) + { + char *tmp; + tmp = strtok(data, " "); + command = strtok(NULL, ""); + if (!tmp || !command) + { + message ("rathold: invalid argument"); + return NULL; + } + button = strtol(tmp, NULL, 10); + } + else + { + message ("rathold: Needs at least 1 argument. "); + return NULL; + } + + + if (!strcmp(command, "down")) + XTestFakeButtonEvent(dpy, button, True, CurrentTime); + else if(!strcmp(command,"up")) + XTestFakeButtonEvent(dpy, button, False, CurrentTime); + else + marked_message_printf (0, 0, "rathold: %s invalid argument", command); + + return NULL; +} char * cmd_curframe (int interactive, char *data) |