summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actions.c23
-rw-r--r--src/actions.h1
-rw-r--r--src/data.h3
-rw-r--r--src/list.c6
-rw-r--r--src/main.c1
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);
diff --git a/src/data.h b/src/data.h
index bba9f29..eae7df7 100644
--- a/src/data.h
+++ b/src/data.h
@@ -160,6 +160,9 @@ struct rp_defaults
int win_name;
int startup_message;
+
+ /* Pointer warping toggle. */
+ int warp;
};
extern struct rp_defaults defaults;
diff --git a/src/list.c b/src/list.c
index a78eb57..a2370d3 100644
--- a/src/list.c
+++ b/src/list.c
@@ -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);
diff --git a/src/main.c b/src/main.c
index 5980ce1..d5d5417 100644
--- a/src/main.c
+++ b/src/main.c
@@ -449,6 +449,7 @@ init_defaults ()
defaults.win_name = 0;
defaults.startup_message = 1;
+ defaults.warp = 1;
}
int