Add support for up to 32 mouse buttons.

My new mouse reports only up to 9 (skipping 6 and 9, it seems), but I
/have/ seen 32 button mice...
This commit is contained in:
Bill Currie 2012-07-02 16:33:57 +09:00
parent 3d56084f59
commit 7cd8806ec0
3 changed files with 54 additions and 6 deletions

View file

@ -348,6 +348,31 @@ typedef enum {
QFM_WHEEL_DOWN,
QFM_BUTTON6,
QFM_BUTTON7,
QFM_BUTTON8,
QFM_BUTTON9,
QFM_BUTTON10,
QFM_BUTTON11,
QFM_BUTTON12,
QFM_BUTTON13,
QFM_BUTTON14,
QFM_BUTTON15,
QFM_BUTTON16,
QFM_BUTTON17,
QFM_BUTTON18,
QFM_BUTTON19,
QFM_BUTTON20,
QFM_BUTTON21,
QFM_BUTTON22,
QFM_BUTTON23,
QFM_BUTTON24,
QFM_BUTTON25,
QFM_BUTTON26,
QFM_BUTTON27,
QFM_BUTTON28,
QFM_BUTTON29,
QFM_BUTTON30,
QFM_BUTTON31,
QFM_BUTTON32,
//
// joystick buttons

View file

@ -618,21 +618,19 @@ event_key (XEvent *event)
static void
event_button (XEvent *event)
{
int but;
unsigned but;
x_time = event->xbutton.time;
but = event->xbutton.button;
if (but > 32)
return;
if (but == 2)
but = 3;
else if (but == 3)
but = 2;
switch (but) {
case 1:
case 2:
case 3:
case 6:
case 7:
default:
Key_Event (QFM_BUTTON1 + but - 1, 0, event->type == ButtonPress);
break;
case 4:

View file

@ -393,6 +393,31 @@ keyname_t keynames[] = {
{ "M_WHEEL_DOWN", QFM_WHEEL_DOWN },
{ "M_BUTTON6", QFM_BUTTON6 },
{ "M_BUTTON7", QFM_BUTTON7 },
{ "M_BUTTON8", QFM_BUTTON8 },
{ "M_BUTTON9", QFM_BUTTON9 },
{ "M_BUTTON10", QFM_BUTTON10 },
{ "M_BUTTON11", QFM_BUTTON11 },
{ "M_BUTTON12", QFM_BUTTON12 },
{ "M_BUTTON13", QFM_BUTTON13 },
{ "M_BUTTON14", QFM_BUTTON14 },
{ "M_BUTTON15", QFM_BUTTON15 },
{ "M_BUTTON16", QFM_BUTTON16 },
{ "M_BUTTON17", QFM_BUTTON17 },
{ "M_BUTTON18", QFM_BUTTON18 },
{ "M_BUTTON19", QFM_BUTTON19 },
{ "M_BUTTON20", QFM_BUTTON20 },
{ "M_BUTTON21", QFM_BUTTON21 },
{ "M_BUTTON22", QFM_BUTTON22 },
{ "M_BUTTON23", QFM_BUTTON23 },
{ "M_BUTTON24", QFM_BUTTON24 },
{ "M_BUTTON25", QFM_BUTTON25 },
{ "M_BUTTON26", QFM_BUTTON26 },
{ "M_BUTTON27", QFM_BUTTON27 },
{ "M_BUTTON28", QFM_BUTTON28 },
{ "M_BUTTON29", QFM_BUTTON29 },
{ "M_BUTTON30", QFM_BUTTON30 },
{ "M_BUTTON31", QFM_BUTTON31 },
{ "M_BUTTON32", QFM_BUTTON32 },
{ "J_BUTTON1", QFJ_BUTTON1 },
{ "J_BUTTON2", QFJ_BUTTON2 },