summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsabetts <sabetts>2002-11-20 09:06:12 +0000
committersabetts <sabetts>2002-11-20 09:06:12 +0000
commit94c5b929a7c3e0f84499210b97093a3015151100 (patch)
treeaa936e07612be6b858709ea6242e610e7c2ba58f
parentc2ffdb2c8f4bb27811cda997371732967321cb82 (diff)
downloadratpoison-94c5b929a7c3e0f84499210b97093a3015151100.zip
* 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
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog15
-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
7 files changed, 48 insertions, 2 deletions
diff --git a/AUTHORS b/AUTHORS
index ae64486..74dd4fa 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -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>
diff --git a/ChangeLog b/ChangeLog
index 2ee6b09..735dbe2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);
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