diff options
Diffstat (limited to 'src')
-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 |
5 files changed, 32 insertions, 2 deletions
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 |