Sawfish
Advertisement
Browse all patches

Sawfish has a problem with many buttons. See below and read [1] and [2].

If this is fixed, then this patch can go trunk.

Workarond is described in Common Issues.

Author[]

Jeremy Bryan Smith

Synopsis[]

I have a "Kensington Expert Mouse Pro" USB trackball device, which in addition to 4 regular mouse buttons, mouse wheel up/down and mouse wheel button, has 6 "extra" buttons (for a grand total of 13).

In the past, X did not seem to support those extra buttons and so I was using a separate program I wrote to configure the buttons, but after upgrading to Xorg 7.1, I noticed that xev was registering those extra buttons. So I quickly opened Sawfish Configurator to set them up. Unfortunately, Sawfish could only recognize 9 buttons. I was able to modify the source so that Sawfish recognizes these buttons (see attachment), but now I have another problem.

When I click on the root window, Sawfish recognizes the button clicks and performs my configured actions. However, if I click on any window other than the root with buttons 9, 11, 12, and 13, the window is given focus and my Sawfish command is not executed. I would expect it to act the same as the others: execute the programmed command and do not set focus to any window. All of my 6 "extra" buttons (8-13) are configured to switch to workspaces 1-6, respectively. Any ideas?

Patch testing[]

  1. Copy/paste the patch listed below into some file, eg. TEST.diff.
  2. If you don't have sawfish sources yet, have one, as described get it from GIT repo.
  3. Go into the directory where sawfish sources reside, eg. cd sawfish
  4. Test if the patch applies cleanly with this command:
    patch -p1 --ignore-whitespace --dry-run < TEST.diff
    in case of problems try also: -p0 or -p2
  5. If it applies cleanly, then remove the --dry-run from above command and run it again, otherwise ask on the mailing list.
  6. Compile sawfish: ./autogen.sh && make
  7. Install it for testing, but it depends on your linux distribution.
    1. It is always better to install sawfish as your distribution package, but it is different for each distribution.
    2. So you may try make install, which will install sawifish in /usr/local/share/sawfish/ (if you have write access). But then make sure that you run the correct version and delete it from that directory afterwards, to avoid any conflicts.
  8. Se also

PS: edit this template if you feel that those instructions can be improved.

Patch[]

--- sawfish/src/keys.h.13buttons	2004-12-06 15:52:30.000000000 -0700
+++ sawfish/src/keys.h	2006-12-27 11:20:28.000000000 -0700
@@ -105,6 +105,38 @@ enum {
 # define Button9Mask (1<<16)
 #endif
 
+#ifndef Button10
+# define Button10 10
+#endif
+#ifndef Button10Mask
+# define Button10Mask (1<<17)
+#endif
+
+#ifndef Button11
+# define Button11 11
+#endif
+#ifndef Button11Mask
+# define Button11Mask (1<<18)
+#endif
+
+
+#ifndef Button12
+# define Button12 12
+#endif
+#ifndef Button12Mask
+# define Button12Mask (1<<19)
+#endif
+
+
+#ifndef Button13
+# define Button13 13
+#endif
+#ifndef Button13Mask
+# define Button13Mask (1<<20)
+#endif
+
+
+
 #if !defined (Button6)
 # define EV_MOD_BUTTON_MASK (Button1Mask | Button2Mask | Button3Mask \
 			     | Button4Mask | Button5Mask)
@@ -119,10 +151,31 @@ enum {
 # define EV_MOD_BUTTON_MASK (Button1Mask | Button2Mask | Button3Mask \
 			     | Button4Mask | Button5Mask | Button6Mask \
                              | Button7Mask | Button8Mask)
-#else
+#elif !defined (Button10)
 # define EV_MOD_BUTTON_MASK (Button1Mask | Button2Mask | Button3Mask \
 			     | Button4Mask | Button5Mask | Button6Mask \
 			     | Button7Mask | Button8Mask | Button9Mask)
+#elif !defined (Button11)
+# define EV_MOD_BUTTON_MASK (Button1Mask | Button2Mask | Button3Mask \
+			     | Button4Mask | Button5Mask | Button6Mask \
+			     | Button7Mask | Button8Mask | Button9Mask \
+			     | Button10Mask)
+#elif !defined (Button12)
+# define EV_MOD_BUTTON_MASK (Button1Mask | Button2Mask | Button3Mask \
+			     | Button4Mask | Button5Mask | Button6Mask \
+			     | Button7Mask | Button8Mask | Button9Mask \
+			     | Button10Mask | Button11Mask)
+#elif !defined (Button13)
+# define EV_MOD_BUTTON_MASK (Button1Mask | Button2Mask | Button3Mask \
+			     | Button4Mask | Button5Mask | Button6Mask \
+			     | Button7Mask | Button8Mask | Button9Mask \
+			     | Button10Mask | Button11Mask | Button12Mask)
+#else
+# define EV_MOD_BUTTON_MASK (Button1Mask | Button2Mask | Button3Mask \
+			     | Button4Mask | Button5Mask | Button6Mask \
+			     | Button7Mask | Button8Mask | Button9Mask \
+			     | Button10Mask | Button11Mask | Button12Mask \
+			     | Button13Mask)
 #endif
 
 �
--- sawfish/src/keys.c.13buttons	2006-12-26 15:51:31.000000000 -0700
+++ sawfish/src/keys.c	2006-12-27 11:20:28.000000000 -0700
@@ -97,7 +97,7 @@ DEFSYM(super_keysyms, "super-keysyms");
 static void grab_keymap_event (repv km, long code, long mods, bool grab);
 static void grab_all_keylist_events (repv map, bool grab);
 
-static int all_buttons[9] = { Button1, Button2, Button3, Button4, Button5, Button6, Button7, Button8, Button9 };
+static int all_buttons[13] = { Button1, Button2, Button3, Button4, Button5, Button6, Button7, Button8, Button9, Button10, Button11, Button12, Button13 };
 
 /* locks: currently LockMask, num_lock, and scroll_lock */
 static int total_lock_combs, all_lock_mask;
@@ -275,6 +275,18 @@ translate_event(u_long *code, u_long *mo
 	case Button9:
 	    *mods |= Button9Mask;
 	    break;
+	case Button10:
+	    *mods |= Button10Mask;
+	    break;
+	case Button11:
+	    *mods |= Button11Mask;
+	    break;
+	case Button12:
+	    *mods |= Button12Mask;
+	    break;
+	case Button13:
+	    *mods |= Button13Mask;
+	    break;
 	}
 	ret = TRUE;
 	break;
@@ -350,6 +362,10 @@ translate_event_to_x_button (repv ev, u_
 	    { Button7, Button7Mask },
 	    { Button8, Button8Mask },
 	    { Button9, Button9Mask },
+	    { Button10, Button10Mask },
+	    { Button11, Button11Mask },
+	    { Button12, Button12Mask },
+	    { Button13, Button13Mask },
 	    { 0, 0 }
 	};
 	int i;
@@ -677,6 +693,10 @@ static struct key_def default_mods[] = {
     { "Button7",  Button7Mask },
     { "Button8",  Button8Mask },
     { "Button9",  Button9Mask },
+    { "Button10", Button10Mask},
+    { "Button11", Button11Mask},
+    { "Button12", Button12Mask},
+    { "Button13", Button13Mask},
     { "Any",      EV_MOD_ANY },
     { "Release",  EV_MOD_RELEASE },
     { 0, 0 }

Community's reasons for inclusion or rejection[]

Patch submitters, please vote also! Yes, obviosuly your vote will be positive, but it's the place to give your explanation why this patch is good for all Sawfish users, and why it is correct - good reasons for inclusion.

When voting anonymously please write your name, so that it can be associated with your posts on the mailing list. If you are logged in you can sign yourself by typing four tilda characters: ~~~~.

  • No vote: no. Unfortunately there seems to be a problem with the way support for more than five buttons was implemented, see this message and related discussion. That problem should be fixed first, then it should be easy to extend to even more buttons. - Tkorvola 01:40, 2 December 2007 (UTC)
  • Wtf vote: pondering. sawfish handles many buttons in a wrong way, by not applying this patch I hope to motivate someone to produce a good patch that will fix the problem. See thread mentioned in a vote above. Until then it will stay as submitted but not rejected, so we will remember the problem and perhaps the submitted patch will be changed to a better one. Janek Kozicki 23:50, 18 January 2008 (UTC)
Advertisement