Support for more than 9 buttons, please?
Brought to you by:
jcatki
Currently imwheel supports up to 9 buttons (i.e. two normal
buttons, wheel, two horizontal scroll buttons and two thumb
buttons). There are mice with more than 9 buttons (i.e. 3 thumb
buttons). They generate just normal button events for button 10
etc. Could you please support them?
You could use hexadecimal notation for the -b switch, and
everything else should be not a problem.
Logged In: YES
user_id=1011944
I have make a patch to do that (not using hexadicimal
notation, cf new "man imwheel"), based on the 0.9.9
(complete) version. (that maybe work at earlier versions, if
the source are complete (with man) and are not too many
different, oubviously).
here is the patch :
diff -urN imwheel-0.9.9-old/imwheel.1 imwheel-0.9.9/imwheel.1
--- imwheel-0.9.9-old/imwheel.1 2000-11-04
14:46:10.000000000 +0100
+++ imwheel-0.9.9/imwheel.1 2006-01-29 04:56:38.000000000 +0100
@@ -47,18 +47,18 @@
.fi
.RE
-A \fIbutton-spec\fP of "45" will limit the grabbed buttons
for only wheel up and down.
+A \fIbutton-spec\fP of "4 5" will limit the grabbed buttons
for only wheel up and down.
.br
-A \fIbutton-spec\fP of "67" may be useful to use actual
buttons 6 and 7 as wheel up
+A \fIbutton-spec\fP of "6 7" may be useful to use actual
buttons 6 and 7 as wheel up
and down, and limit the grab to only those two buttons.
.br
A \fIbutton-spec\fP of "0" turns off any defined mapping,
thus allowing for skips in
the \fIbutton-spec\fP for something that doesn't exist on
your mouse.
.br
-A \fIbutton-spec\fP of "45006" may be for normal wheel
up/down and a thumb button, but
+A \fIbutton-spec\fP of "4 5 0 0 6" may be for normal wheel
up/down and a thumb button, but
no horizontal wheel axis.
.br
-The default \fIbutton-spec\fP is "45678".
+The default \fIbutton-spec\fP is "4 5 6 7 8".
.br
See also xmodmap(1).
.RE
diff -urN imwheel-0.9.9-old/imwheel.1.html
imwheel-0.9.9/imwheel.1.html
--- imwheel-0.9.9-old/imwheel.1.html 2000-11-04
14:49:57.000000000 +0100
+++ imwheel-0.9.9/imwheel.1.html 2006-01-29
04:56:51.000000000 +0100
@@ -65,10 +65,10 @@
</DL>
-A <I>button-spec</I> of "45" will limit the
grabbed buttons for only wheel up and down.
+A <I>button-spec</I> of "4 5" will limit the
grabbed buttons for only wheel up and down.
<BR>
-A <I>button-spec</I> of "67" may be useful to use
actual buttons 6 and 7 as wheel up
+A <I>button-spec</I> of "6 7" may be useful to
use actual buttons 6 and 7 as wheel up
and down, and limit the grab to only those two buttons.
<BR>
@@ -76,11 +76,11 @@
the <I>button-spec</I> for something that doesn't exist on
your mouse.
<BR>
-A <I>button-spec</I> of "45006" may be for normal
wheel up/down and a thumb button, but
+A <I>button-spec</I> of "4 5 0 0 6" may be for
normal wheel up/down and a thumb button, but
no horizontal wheel axis.
<BR>
-The default <I>button-spec</I> is "45678".
+The default <I>button-spec</I> is "4 5 6 7 8".
<BR>
See also <A
HREF="http://jonatkins.org/cgi-bin/man2html.cgi?1+xmodmap">xmodmap</A>(1).
diff -urN imwheel-0.9.9-old/util.c imwheel-0.9.9/util.c
--- imwheel-0.9.9-old/util.c 2000-10-31 13:06:05.000000000 +0100
+++ imwheel-0.9.9/util.c 2006-01-29 04:56:13.000000000 +0100
@@ -196,7 +196,7 @@
void getOptions(int argc, char **argv, char *opts, const
struct option *options)
{
- int ch,i,j,killold=False,invalidOpts=False;
+ int ch,i,j,k,l,killold=False,invalidOpts=False;
while((ch=getopt_long_only(argc,argv,opts,options,&i))>=0)
{
@@ -262,14 +262,23 @@
break;
case 'b':
memset(buttons,0,NUM_BUTTONS*sizeof(int));
- for(j=0;optarg[j] && j<NUM_BUTTONS;j++)
+ k=0;
+ l=0;
+ for(j=0;optarg[j] && j<NUM_BUTTONS*4;j++)
{
- if(optarg[j]<'0' || optarg[j]>'9')
+
+ if(optarg[j]==' ' || optarg[j+1]=='\0')
{
- fprintf(stderr,"imwheel: ERROR: buttons: #%d: %c is
not a number!\n",j,optarg[j]);
- exit(1);
+ if(optarg[j+1]!='\0') { optarg[j]='\0';}
+ buttons[k]=atoi(optarg+l);
+ if(buttons[k]< 0 || buttons[k]> MAX_BUTTONS)
+ {
+ fprintf(stderr,"imwheel: ERROR: buttons: #%d: %s is
a number out of range !\n",k,optarg+l);
+ exit(1);
+ }
+ l+=strlen(optarg+l)+1;
+ k++;
}
- buttons[j]=optarg[j]-'0';
}
break;
case 'h':
diff -urN imwheel-0.9.9-old/util.h imwheel-0.9.9/util.h
--- imwheel-0.9.9-old/util.h 2000-06-21 12:44:43.000000000 +0200
+++ imwheel-0.9.9/util.h 2006-01-29 04:56:23.000000000 +0100
@@ -11,6 +11,7 @@
#define PIDFILE PIDDIR"/imwheel.pid"
#define NUM_BUTTONS 5
+#define MAX_BUTTONS 16
#define STATE_MASK
(ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)
#define NUM_STATES 3
#define MAX_MASKTRANS 8
Logged In: NO
Jean Jacques Brucker <jjbrucker@free.fr> has patched Imwheel
version 0.9.9 for Mandriva to recognize more than 9 buttons
by spacing out the -b "button_spec" line similar to that
which xmodmap uses.
It's not difficult to port to version 1.0pre12. I've done
it myself. I'm not comfortable submitting my patch as I
also added several other non-generic modifications to add
five more buttons specific to my mouse, a Logitech MX1000.
The main problem I've got s that Xorg itself is blocking two
of the buttons and I can't test them...
You can get the original patch from the
imwheel-0.9.9-9mdk.src.rpm from Mandriva cooker.
Logged In: NO
Jean Jacques Brucker <jjbrucker@free.fr> has patched Imwheel
version 0.9.9 for Mandriva to recognize more than 9 buttons
by spacing out the -b "button_spec" line similar to that
which xmodmap uses.
It's not difficult to port to version 1.0pre12. I've done
it myself. I'm not comfortable submitting my patch as I
also added several other non-generic modifications to add
five more buttons specific to my mouse, a Logitech MX1000.
The main problem I've got s that Xorg itself is blocking two
of the buttons and I can't test them...
You can get the original patch from the
imwheel-0.9.9-9mdk.src.rpm from Mandriva cooker.
Logged In: YES
user_id=1685785
Originator: NO
I've modified the patch posted by jbar so that it works with imwheel-1.0.0._pre12.ebuild and lets you configure Button4-16. Note: I took jbar's patch as is, but without the man page section. If you need the man page corrections, you can copy jbar's lines for that.
I've got a mouse with a horizontal and a vertical wheel and two thumb buttons. It sends additional button codes for the horizontal wheel (e.g. one Button6 event when pressed once, many Button11 events while held down). So for the horizontal scroll wheel, you can reconfigure Button11 to emit a Button6 event which in turn sends the desired key event. The Button6 and Button7 events seem to be swapped in some applications (like Mozilla Firefox).
~/.imwheelrc:
...
None, Button6, Left, 5
None, Button11, Button6
...
Simply start imwheel with something like `imwheel -k -b "0 0 10 11 8 9 6 7"'.
--- util.c.old 2007-08-29 17:59:02.000000000 +0200
+++ util.c 2007-08-30 00:14:29.000000000 +0200
@@ -51,14 +51,24 @@
typedef void (*sighandler_t)(int);
-int buttons[NUM_BUTTONS+1]={4,5,6,7,8,9,0};
+int buttons[NUM_BUTTONS+1]={4,5,6,7,8,9,10,11,12,13,14,15,16,0};
const char *button_names[]={
"Up",
"Down",
"Left",
"Right",
"Thumb1",
- "Thumb2"
+ "Thumb2",
+ "Thumb3",
+ "Thumb4",
+ "Thumb5",
+ "Thumb6",
+ "Thumb7",
+ "Thumb8",
+ "Thumb9",
+ "Thumb10",
+ "Thumb11",
+ "Thumb12"
};
int statebits[STATE_MASK+1];
char *wname=NULL;
@@ -219,7 +229,7 @@
void getOptions(int argc, char **argv, char *opts, const struct option *options)
{
- int ch,i,j,killold=False,invalidOpts=False;
+ int ch,i,j,k,l,killold=False,invalidOpts=False;
while((ch=getopt_long_only(argc,argv,opts,options,&i))>=0)
{
@@ -297,14 +307,24 @@
break;
case 'b':
memset(buttons,0,NUM_BUTTONS*sizeof(int));
- for(j=0;optarg[j] && j<NUM_BUTTONS;j++)
+ k=0;
+ l=0;
+ for(j=0;optarg[j] && j<NUM_BUTTONS*4;j++)
{
- if(optarg[j]<'0' || optarg[j]>'9')
+ if(optarg[j]==' ' || optarg[j+1]=='\0')
{
- fprintf(stderr,"imwheel: ERROR: buttons: #%d: %c is not a number!\n",j,optarg[j]);
- exit(1);
+ if(optarg[j+1]!='\0') {
+ optarg[j]='\0';
+ }
+ buttons[k]=atoi(optarg+l);
+ if(buttons[k]< 0 || buttons[k]> MAX_BUTTONS)
+ {
+ fprintf(stderr,"imwheel: ERROR: buttons: #%d: %s is a number out of range !\n",k,optarg+l);
+ exit(1);
+ }
+ l+=strlen(optarg+l)+1;
+ k++;
}
- buttons[j]=optarg[j]-'0';
}
break;
case 'h':
--- util.h.old 2007-08-29 17:59:06.000000000 +0200
+++ util.h 2007-08-30 00:11:13.000000000 +0200
@@ -10,7 +10,8 @@
#define PIDFILE PIDDIR"/imwheel.pid"
-#define NUM_BUTTONS 6
+#define NUM_BUTTONS 16
+#define MAX_BUTTONS 16
#define STATE_MASK (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)
#define NUM_STATES 3
#define MAX_MASKTRANS 8