diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | src/actions.c | 23 | ||||
-rw-r--r-- | src/actions.h | 1 | ||||
-rw-r--r-- | src/data.h | 3 | ||||
-rw-r--r-- | src/list.c | 6 | ||||
-rw-r--r-- | src/main.c | 1 |
7 files changed, 48 insertions, 2 deletions
@@ -21,3 +21,4 @@ Doug Kearns <djkea2@mugc.its.monash.edu.au> Mike Meyer <mwm@mired.org> Ben Leslie <benno@sesgroup.net> Dan Aloni <da-x@gmx.net> +Tim Goodwin <tjg@star.le.ac.uk> @@ -1,3 +1,18 @@ +2002-11-20 Shawn Betts <sabetts@sfu.ca> + + * src/main.c (init_defaults): set pointer warping to on by + default. + + * src/list.c (give_window_focus): only warp the pointer if the + warp setting is turned on. + + * src/data.h (struct rp_defaults): new member, warp. + + * src/actions.h (cmd_ward): new prototype + + * src/actions.c (user_command): new command "warp" + (cmd_warp): new function + 2002-10-18 Shawn Betts <sabetts@sfu.ca> * src/actions.c (read_split): a negative number means subtract the diff --git a/src/actions.c b/src/actions.c index 579d2ad..61c785c 100644 --- a/src/actions.c +++ b/src/actions.c @@ -86,6 +86,7 @@ static user_command user_commands[] = {"unalias", cmd_unalias, arg_STRING}, {"prevscreen", cmd_prevscreen, arg_VOID}, {"nextscreen", cmd_nextscreen, arg_VOID}, + {"warp", cmd_warp, arg_STRING}, /*@end (tag required for genrpbindings) */ /* Commands to set default behavior. */ @@ -2571,3 +2572,25 @@ cmd_prevscreen (int interactive, void *data) return NULL; } + +char * +cmd_warp (int interactive, void *data) +{ + if (data == NULL && !interactive) + return xsprintf ("%s", defaults.warp ? "on":"off"); + + if (data == NULL) + { + message (" warp; one argument required "); + return NULL; + } + + if (!strcasecmp (data, "on")) + defaults.warp = 1; + else if (!strcasecmp (data, "off")) + defaults.warp = 0; + else + message (" warp; Invalid argument "); + + return NULL; +} diff --git a/src/actions.h b/src/actions.h index 0503484..397e0f4 100644 --- a/src/actions.h +++ b/src/actions.h @@ -111,6 +111,7 @@ char *cmd_defbarborder (int interactive, void *data); char *cmd_prevscreen (int interactive, void *data); char *cmd_nextscreen (int interactive, void *data); char *cmd_unalias (int interactive, void *data); +char *cmd_warp(int interactive, void *data); void initialize_default_keybindings (void); rp_action* find_keybinding (KeySym keysym, int state); @@ -160,6 +160,9 @@ struct rp_defaults int win_name; int startup_message; + + /* Pointer warping toggle. */ + int warp; }; extern struct rp_defaults defaults; @@ -444,8 +444,10 @@ give_window_focus (rp_window *win, rp_window *last_win) /* Warp the cursor to the window's saved position. */ if (last_win != NULL) save_mouse_position (last_win); - XWarpPointer (dpy, None, win->scr->root, - 0, 0, 0, 0, win->mouse_x, win->mouse_y); + + if (defaults.warp) + XWarpPointer (dpy, None, win->scr->root, + 0, 0, 0, 0, win->mouse_x, win->mouse_y); /* Swap colormaps */ if (last_win != NULL) XUninstallColormap (dpy, last_win->colormap); @@ -449,6 +449,7 @@ init_defaults () defaults.win_name = 0; defaults.startup_message = 1; + defaults.warp = 1; } int |