ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] [PATCH] Turn off pointer warping


From: Tim Goodwin
Subject: [RP] [PATCH] Turn off pointer warping
Date: Wed Nov 6 06:30:08 2002

Here's a trivial patch that adds commands `warp off' to turn off
pointer warping, and `warp on' to turn it back on again.

My motivation was twofold.

First, I think pointer warping in general is evil.  My brain likes to
believe, acceleration notwithstanding, that there is a straightforward
connection between the position of the mouse on my desk, and the
position of the pointer on the screen.  For some reason :-), pointer
warping never causes the mouse to crawl across the desk...

Secondly, I often find myself using two applications, one of which is
largely keyboard based, the other largely mouse based.  For example, I
might be editing a web page in one frame, and viewing it in the other.
Using ratpoison makes this particularly nice: I can click "reload" in
the browser window without losing keyboard focus from the editor.  But
then I need to use the keyboard in the browser, perhaps to type in a
new URL.  I carefully position the pointer, then realise that the
browser doesn't have keyboard focus.  So I switch frames, and
ratpoison warps the pointer away (usually into the middle of the other
frame, 'cos I did the same thing in the other direction moments
before).  Aargh!  Much better just to leave the darned pointer where
it was, thank you very much.

Enjoy,

Tim.

diff -ur ratpoison-1.1.1/src/actions.c ratpoison-1.1.1.tjg/src/actions.c
--- ratpoison-1.1.1/src/actions.c       Sat Jul  6 22:31:05 2002
+++ ratpoison-1.1.1.tjg/src/actions.c   Thu Oct 31 10:15:46 2002
@@ -86,6 +86,7 @@
     {"unalias",                cmd_unalias,    arg_STRING},
     {"prevscreen",     cmd_prevscreen, arg_VOID},
     {"nextscreen",     cmd_nextscreen, arg_VOID},
+    {"warp",           cmd_warp,       arg_STRING},
     /address@hidden (tag required for genrpbindings) */
 
     /* Commands to set default behavior. */
@@ -2520,6 +2521,28 @@
     new_screen = num_screens - 1;
 
   set_active_frame (screens[new_screen].rp_current_frame);
+
+  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 -ur ratpoison-1.1.1/src/actions.h ratpoison-1.1.1.tjg/src/actions.h
--- ratpoison-1.1.1/src/actions.h       Sun Mar 24 06:04:41 2002
+++ ratpoison-1.1.1.tjg/src/actions.h   Thu Oct 31 10:19:44 2002
@@ -110,6 +110,7 @@
 char *cmd_defbarborder (int interactive, void *data);
 char *cmd_prevscreen (int interactive, void *data);
 char *cmd_nextscreen (int interactive, void *data);
+char *cmd_warp(int interactive, void *data);
 char *cmd_unalias (int interactive, void *data);
 
 void initialize_default_keybindings (void);
Only in ratpoison-1.1.1.tjg/src: config.h
diff -ur ratpoison-1.1.1/src/data.h ratpoison-1.1.1.tjg/src/data.h
--- ratpoison-1.1.1/src/data.h  Wed Mar 13 06:56:20 2002
+++ ratpoison-1.1.1.tjg/src/data.h      Thu Oct 31 10:20:30 2002
@@ -160,6 +160,7 @@
   int win_name;
 
   int startup_message;
+  int warp;
 };
 
 extern struct rp_defaults defaults;
diff -ur ratpoison-1.1.1/src/list.c ratpoison-1.1.1.tjg/src/list.c
--- ratpoison-1.1.1/src/list.c  Sat Jan 26 23:58:28 2002
+++ ratpoison-1.1.1.tjg/src/list.c      Thu Oct 31 10:18:05 2002
@@ -444,7 +444,8 @@
 
   /* Warp the cursor to the window's saved position. */
   if (last_win != NULL) save_mouse_position (last_win);
-  XWarpPointer (dpy, None, win->scr->root, 
+  if (defaults.warp)
+    XWarpPointer (dpy, None, win->scr->root, 
                0, 0, 0, 0, win->mouse_x, win->mouse_y);
   
   /* Swap colormaps */
diff -ur ratpoison-1.1.1/src/main.c ratpoison-1.1.1.tjg/src/main.c
--- ratpoison-1.1.1/src/main.c  Sun Jan 27 00:57:33 2002
+++ ratpoison-1.1.1.tjg/src/main.c      Thu Oct 31 10:16:33 2002
@@ -445,6 +445,7 @@
 
   defaults.win_name = 0;
   defaults.startup_message = 1;
+  defaults.warp = 1;
 }
 
 int



reply via email to

[Prev in Thread] Current Thread [Next in Thread]