📄 mouse_wheel.patch
字号:
-static int M_ps2(Gpm_Event *state, unsigned char *data)+/* A4 tech 4D mouse PS/2 michg@alphalink.com.au 2000/11/11 */+static int M_a4dps2(Gpm_EventExt *state, unsigned char *data) { static int tap_active=0; /* there exist glidepoint ps2 mice */ @@ -495,10 +615,40 @@ state->dy= -((data[0] & 0x20) ? data[2]-256 : data[2]); else state->dy = 0;+ + /* Wheels */+ switch(data[3] & 0x0f)+ { case 0x01: state->dw= 1; state->dw2 = 0; break;+ case 0x02: state->dw= 0; state->dw2 = 1; break;+ case 0x0f: state->dw=-1; state->dw2 = 0; break;+ case 0x0e: state->dw= 0; state->dw2 = -1; break; + default: state->dw= 0; state->dw2 = 0;+ }+ return 0; } -static int M_netmouse(Gpm_Event *state, unsigned char *data)+/*+static int R_imps2(Gpm_EventExt *state, int fd)+{+ unsigned char buffer[4];++ buffer[0] = ((state->buttons & GPM_B_LEFT) ? 0x01 : 0) |+ ((state->buttons & GPM_B_RIGHT) ? 0x02 : 0) |+ ((state->buttons & GPM_B_MIDDLE) ? 0x04 : 0);++ if (state->dx < 0) buffer[0] |= 0x10;+ if (state->dy > 0) buffer[0] |= 0x20;++ buffer[1] = ( state->dx >= 0) ? state->dx : 256+state->dx;+ buffer[2] = (-state->dy >= 0) ? -state->dy : 256-state->dy;+ buffer[3] = ( state->dw >= 0) ? state->dw : 256+state->dw; ++ return write(fd,buffer,4);+}+*/++static int M_netmouse(Gpm_EventExt *state, unsigned char *data) { /* Avoid this beasts if you can. They connect to normal PS/2 port, but their protocol is one byte longer... So if you have notebook@@ -533,6 +683,8 @@ state->dy= -((data[0] & 0x20) ? data[2]-256 : data[2]); else state->dy = 0;+ state->dw= 0;+ state->dw2= 0; return 0; } @@ -566,7 +718,7 @@ } #define GPM_B_BOTH (GPM_B_LEFT|GPM_B_RIGHT)-static int M_mman(Gpm_Event *state, unsigned char *data)+static int M_mman(Gpm_EventExt *state, unsigned char *data) { /* * the damned MouseMan has 3/4 bytes packets. The extra byte @@ -598,7 +750,10 @@ prev= ((data[0] & 0x20) >> 3) | ((data[0] & 0x10) >> 4); if (mytype->packetlen==4) b=data[3]>>4; }- ++ state->dw= 0;+ state->dw2= 0;+ if(mytype->packetlen==4) { if(b == 0) @@ -653,7 +808,7 @@ #define IsA(m) ((WacomModell==(-1))? 0:!strcmp(#m,wcmodell[WacomModell].name)) -static int M_wacom(Gpm_Event *state, unsigned char *data)+static int M_wacom(Gpm_EventExt *state, unsigned char *data) { static int ox=-1, oy; int x, y;@@ -694,7 +849,7 @@ if (!IsA(UltraPad)){ /* Tool out of active area */ ox=-1; state->buttons=0; - state->dx=state->dy=0; + state->dx=state->dy=state->dw=0; } return 0; /* nothing more to do so leave */@@ -729,6 +884,8 @@ state->dx= (x-ox) / (wmaxx / win.ws_col / wcmodell[WacomModell].treshold); state->dy= (y-oy) / (wmaxy / win.ws_row / wcmodell[WacomModell].treshold);+ state->dw= 0;+ state->dw2= 0; } ox=x; oy=y; @@ -756,7 +913,7 @@ #define CAL_Y_MAX 0xF40 #define CAL_Y_SIZE (CAL_Y_MAX - CAL_Y_MIN) -static int M_calus(Gpm_Event *state, unsigned char *data)+static int M_calus(Gpm_EventExt *state, unsigned char *data) { int x, y; @@ -767,7 +924,7 @@ + GPM_B_MIDDLE * ((data[0]>>3) & 1) + GPM_B_RIGHT * ((data[0]>>4) & 1); - state->dx = 0; state->dy = 0;+ state->dx = 0; state->dy = 0; state->dw= 0; state->dw2= 0; state->x = x < CAL_X_MIN ? 0 : x > CAL_X_MAX ? win.ws_col+1@@ -788,7 +945,7 @@ return 0; } -static int M_calus_rel(Gpm_Event *state, unsigned char *data)+static int M_calus_rel(Gpm_EventExt *state, unsigned char *data) { static int ox=-1, oy; int x, y;@@ -805,6 +962,8 @@ + GPM_B_RIGHT * ((data[0]>>4) & 1); state->dx = (x-ox)/5; state->dy = (oy-y)/5;+ state->dw = 0;+ state->dw2 = 0; ox=x; oy=y; return 0; }@@ -822,7 +981,7 @@ #define NCR_DELTA_X (NCR_RIGHT_X - NCR_LEFT_X) #define NCR_DELTA_Y (NCR_TOP_Y - NCR_BOTTOM_Y) -static int M_ncr(Gpm_Event *state, unsigned char *data)+static int M_ncr(Gpm_EventExt *state, unsigned char *data) { int x,y; @@ -831,6 +990,7 @@ state->dx = (signed char)data[1]; /* currently unused */ state->dy = (signed char)data[2];+ state->dw = 0; x = ((int)data[3] << 8) + (int)data[4]; y = ((int)data[5] << 8) + (int)data[6];@@ -864,7 +1024,7 @@ return 0; } -static int M_twid(Gpm_Event *state, unsigned char *data)+static int M_twid(Gpm_EventExt *state, unsigned char *data) { unsigned long message=0UL; int i,h,v; static int lasth, lastv, lastkey, key, lock=0, autorepeat=0;@@ -922,6 +1082,8 @@ { lasth = h; lastv = v; lock = 1; } state->dx = -(h-lasth); lasth = h; state->dy = -(v-lastv); lastv = v; + state->dw = 0;+ state->dw2 = 0; #elif defined(TWIDDLER_BALLISTIC) {@@ -996,7 +1158,7 @@ #ifdef HAVE_LINUX_JOYSTICK_H /* Joystick mouse emulation (David Given) */ -static int M_js(Gpm_Event *state, unsigned char *data)+static int M_js(Gpm_EventExt *state, unsigned char *data) { struct JS_DATA_TYPE *jdata = (void*)data; static int centerx = 0;@@ -1049,12 +1211,15 @@ if ((state->dy >= -1) && (state->dy <= 1)) state->dy = 0; + state->dw = 0;+ state->dw2 = 0;+ return 0; } #endif /* have joystick.h */ /* Synaptics TouchPad mouse emulation (Henry Davies) */-static int M_synaptics_serial(Gpm_Event *state, unsigned char *data)+static int M_synaptics_serial(Gpm_EventExt *state, unsigned char *data) { syn_process_serial_data (state, data); @@ -1063,14 +1228,14 @@ /* Synaptics TouchPad mouse emulation (Henry Davies) */-static int M_synaptics_ps2(Gpm_Event *state, unsigned char *data)+static int M_synaptics_ps2(Gpm_EventExt *state, unsigned char *data) { syn_process_ps2_data (state, data); return 0; } -static int M_mtouch(Gpm_Event *state, unsigned char *data)+static int M_mtouch(Gpm_EventExt *state, unsigned char *data) { /* * This is a simple decoder for the MicroTouch touch screen@@ -1150,7 +1315,7 @@ static int gunze_calib[4]; /* x0,y0 x1,y1 (measured at 1/8 and 7/8) */ static int gunze_debounce = 100; /* milliseconds: ignore shorter taps */ -static int M_gunze(Gpm_Event *state, unsigned char *data)+static int M_gunze(Gpm_EventExt *state, unsigned char *data) { /* * This generates button-1 events, by now.@@ -1257,7 +1422,7 @@ /* Genius Wizardpad tablet -- Matt Kimball (mkimball@xmission.com) */ static int wizardpad_width = -1; static int wizardpad_height = -1;-static int M_wp(Gpm_Event *state, unsigned char *data)+static int M_wp(Gpm_EventExt *state, unsigned char *data) { int x, y, pressure; @@ -1593,9 +1758,10 @@ struct Gpm_Type *type, int argc, char **argv) { struct termios tty;+ char rep1, rep2, rep3, rep4; /* accept "-o dtr", "-o rts" and "-o both" */- if (option_modem_lines(fd, argc, argv)) return NULL;+// if (option_modem_lines(fd, argc, argv)) return NULL; /* * Just put the device to 1200 baud. Thanks to Francois Chastrette@@ -1616,8 +1782,7 @@ * Don't read the silly initialization string. I don't want to see * the vendor name: it is only propaganda, with no information. */- - return type;+ return type; } /* intellimouse, ps2 version: Ben Pfaff and Colin Plumb */@@ -1991,12 +2156,18 @@ {"pnp", "Plug and pray. New mice may not run with '-t ms'.", "", M_bare, I_pnp, CS7 | STD_FLG, {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0},- {"imps2", "Microsoft Intellimouse (ps2) - 3 buttons, wheel unused",- "", M_ps2, I_imps2, STD_FLG,+ {"imps2", "Microsoft Intellimouse (ps2) - 3 buttons, wheel",+ "", M_imps2, I_imps2, STD_FLG, {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0},- {"ms3", "Microsoft Intellimouse (serial) - 3 buttons, wheel unused",+ {"ms3", "Microsoft Intellimouse (serial) - 3 buttons, wheel", "", M_ms3, I_pnp, CS7 | STD_FLG, {0xc0, 0x40, 0xc0, 0x00}, 4, 1, 0, 0, 0},+ {"a4dps2", "A4tech 4D (ps2) - 3 buttons and 2 wheels",+ "", M_a4dps2, I_imps2, CS7 | STD_FLG,+ {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0},+ {"a4d", "A4tech 4D (serial) - 3 buttons and 2 wheels",+ "", M_a4d, I_pnp, CS7 | STD_FLG,+ {0xc0, 0x40, 0xc0, 0x00}, 4, 1, 0, 0, 0}, {"netmouse", "Genius NetMouse - 2 buttons and 2 buttons 'up'/'down'.", "", M_netmouse, I_netmouse, CS7 | STD_FLG, {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0},@@ -2018,7 +2189,6 @@ {"brw", "Fellowes Browser - 4 buttons (and a wheel) (dual protocol?)", "", M_brw, I_pnp, CS7 | STD_FLG, {0xc0, 0x40, 0xc0, 0x00}, 4, 1, 0, 0, 0},- #ifdef HAVE_LINUX_JOYSTICK_H {"js", "Joystick mouse emulation", "Joystick", M_js, NULL, 0,diff -u -r gpm-1.19.3/mouse-test.c gpm-1.19.3.wheel/mouse-test.c--- gpm-1.19.3/mouse-test.c Tue Jan 18 09:23:00 2000+++ gpm-1.19.3.wheel/mouse-test.c Sat Nov 11 19:28:59 2000@@ -55,6 +55,7 @@ DEF_TYPE, DEF_DEV, DEF_SEQUENCE, DEF_BAUD, DEF_SAMPLE, DEF_DELTA, DEF_ACCEL, DEF_SCALE, DEF_SCALE /*scaley*/, DEF_TIME, DEF_CLUSTER, DEF_THREE, DEF_GLIDEPOINT_TAP,+ DEF_SIMWHEEL, (char *)NULL /* extra */, (Gpm_Type *)NULL };@@ -502,7 +503,7 @@ struct item *cur=*nextitem; int packetheads=0; int match=0;- Gpm_Event event;+ Gpm_EventExt event; if (packetsize!=cur->this->packetlen) {@@ -583,7 +584,7 @@ for (nextitem=&list; *nextitem; /* nothing */) { struct item *cur=*nextitem;- Gpm_Event event;+ Gpm_EventExt event; /* try to decode button press and release */ for (i=0;i<got;i++)@@ -627,7 +628,7 @@ for (nextitem=&list; *nextitem; /* nothing */) { struct item *cur=*nextitem;- Gpm_Event event;+ Gpm_EventExt event; /* try to decode button press and release */ for (i=0;i<got;i++)diff -u -r gpm-1.19.3/special.c gpm-1.19.3.wheel/special.c--- gpm-1.19.3/special.c Tue Jan 18 08:34:00 2000+++ gpm-1.19.3.wheel/special.c Sat Nov 11 19:11:28 2000@@ -65,7 +65,7 @@ * The return value is 0 if the event has been eaten, * 1 if the event is passed on */-int processSpecial(Gpm_Event *event)+int processSpecial(Gpm_EventExt *event) { char *command=NULL; int i; FILE *consolef;Only in gpm-1.19.3.wheel: stamp-hdiff -u -r gpm-1.19.3/synaptics.c gpm-1.19.3.wheel/synaptics.c--- gpm-1.19.3/synaptics.c Tue Jan 18 08:34:00 2000+++ gpm-1.19.3.wheel/synaptics.c Sat Nov 11 19:56:45 2000@@ -445,7 +445,7 @@ /* ** process_corner_taps */-void process_corner_taps (Gpm_Event *state, report_type report) +void process_corner_taps (Gpm_EventExt *state, report_type report) { int i = 0; @@ -512,7 +512,7 @@ ** ** Process the touchpad report. */-static void syn_process_data (Gpm_Event *state,+static void syn_process_data (Gpm_EventExt *state, report_type report) { location_type loc;@@ -1180,7 +1180,7 @@ ** ** Process the touchpad 6 byte report. */-void syn_process_serial_data (Gpm_Event *state,+void syn_process_serial_data (Gpm_EventExt *state, unsigned char *data) { report_type report;@@ -1195,7 +1195,7 @@ ** ** Process the touchpad 6 byte report. */-void syn_process_ps2_data (Gpm_Event *state,+void syn_process_ps2_data (Gpm_EventExt *state, unsigned char *data) { report_type report;diff -u -r gpm-1.19.3/synaptics.h gpm-1.19.3.wheel/synaptics.h--- gpm-1.19.3/synaptics.h Tue Jan 18 08:34:00 2000+++ gpm-1.19.3.wheel/synaptics.h Sat Nov 11 19:57:13 2000@@ -58,7 +58,7 @@ ** ** Process the touchpad 6 byte report. */-void syn_process_serial_data (Gpm_Event *state,+void syn_process_serial_data (Gpm_EventExt *state, unsigned char *data); @@ -68,7 +68,7 @@ ** ** Process the touchpad 6 byte report. */-void syn_process_ps2_data (Gpm_Event *state,+void syn_process_ps2_data (Gpm_EventExt *state, unsigned char *data); Only in gpm-1.19.3: t-mouse.elc
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -