📄 imwheel_new.patch
字号:
case '2': opt_three=-1; break; case '3': opt_three=1; break;Only in gpm-1.19.3: installdiff -r -u gpm-1.19.3.original/liblow.c gpm-1.19.3/liblow.c--- gpm-1.19.3.original/liblow.c Tue Jul 18 22:06:06 2000+++ gpm-1.19.3/liblow.c Mon Sep 25 07:03:30 2000@@ -6,6 +6,8 @@ * Copyright (C) 1998 Ian Zimmerman <itz@rahul.net> * * xterm management is mostly by jtklehto@stekt.oulu.fi (Janne Kukonlehto)+ * imps2 wheel support: Michael Glickman <xsadp@yahoo.com> 2000/09/24+ * Influenced by Jonathan Atkin's patch * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by@@ -72,6 +74,7 @@ void *gpm_data=NULL; int gpm_zerobased=0; int gpm_visiblepointer=0;+int gpm_supply_dw = 0; int gpm_mx, gpm_my; /* max x and y (1-based) to fit margins */ unsigned char _gpm_buf[6*sizeof(short)];@@ -400,7 +403,7 @@ } /*-------------------------------------------------------------------*/-int Gpm_GetEvent(Gpm_Event *event)+int Gpm_GetEventExt(Gpm_Event *event) { int count; MAGIC_P((int magic));@@ -408,6 +411,7 @@ if (!gpm_flag) return 0; #ifdef GPM_USE_MAGIC+ if ((count=read(gpm_fd,&magic,sizeof(int)))!=sizeof(int)) { if (count==0)@@ -421,7 +425,7 @@ } #endif - if ((count=read(gpm_fd,event,sizeof(Gpm_Event)))!=sizeof(Gpm_Event))+ if ((count=read(gpm_fd,event,sizeof(Gpm_Event))) != sizeof(Gpm_Event)) { #ifndef GPM_USE_MAGIC if (count==0)@@ -442,10 +446,20 @@ return -1; } + event->x -= gpm_zerobased; event->y -= gpm_zerobased; return 1;+}++int Gpm_GetEvent(Gpm_Event *event)+{ Gpm_Event tmp_event;+ int rc; + rc = Gpm_GetEventExt(&tmp_event);+ if (event != NULL)+ memcpy(event, &tmp_event, sizeof(Gpm_EventOld));+ return rc; } diff -r -u gpm-1.19.3.original/libxtra.c gpm-1.19.3/libxtra.c--- gpm-1.19.3.original/libxtra.c Tue Jan 18 09:23:00 2000+++ gpm-1.19.3/libxtra.c Mon Sep 25 07:03:53 2000@@ -5,6 +5,8 @@ * Copyright (C) 1998 Ian Zimmerman <itz@rahul.net> * * xterm management is mostly by Miguel de Icaza+ * imps2 wheel support: Michael Glickman <xsadp@yahoo.com> 2000/09/24+ * Influenced by Jonathan Atkin's patch * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by@@ -87,14 +89,14 @@ * The return value is the number of buttons, as known to the server, * the ePtr, if any, is filled with information on the current state. */-int Gpm_GetSnapshot(Gpm_Event *ePtr)+int Gpm_GetSnapshotExt(Gpm_Event *ePtr) { Gpm_Connect conn; Gpm_Event event; fd_set sillySet; struct timeval to={0,0}; int i;-+ if (!gpm_ver_i) { if (0 == Gpm_GetServerVersion(NULL)) {@@ -129,14 +131,25 @@ return 0; write(gpm_fd,&conn,sizeof(Gpm_Connect)); - if ((i=Gpm_GetEvent(ePtr))!=1)- return -1;+ if (Gpm_GetEventExt(ePtr)!=1) return -1; i=ePtr->type; ePtr->type=0; return i; /* number of buttons */ }++int Gpm_GetSnapshot(Gpm_Event *ePtr)+{+ int rc;+ Gpm_Event eTmp;+ rc = Gpm_GetSnapshotExt(&eTmp); + if (ePtr)+ memcpy(ePtr, &eTmp, sizeof(Gpm_EventOld));+ return rc; + +} /* Local Variables: */ /* c-indent-level: 2 */ /* End: */+diff -r -u gpm-1.19.3.original/mev.c gpm-1.19.3/mev.c--- gpm-1.19.3.original/mev.c Tue Jan 18 09:23:00 2000+++ gpm-1.19.3/mev.c Fri Sep 22 00:40:36 2000@@ -94,11 +94,11 @@ { if (opt_fit) Gpm_FitEvent(event); - printf("mouse: event 0x%02X, at %2i,%2i (delta %2i,%2i), "+ printf("mouse: event 0x%02X, at %2i,%2i (delta %2i,%2i,%2i), " "buttons %i, modifiers 0x%02X\r\n", event->type, event->x, event->y,- event->dx, event->dy,+ event->dx, event->dy, event->dw, event->buttons, event->modifiers); if (event->type & (GPM_DRAG|GPM_DOWN)) {@@ -335,7 +335,8 @@ do_snapshot() { Gpm_Event event;- int i=Gpm_GetSnapshot(&event);+ int rsize=sizeof(Gpm_Event);+ int i=Gpm_GetSnapshotExt(&event); char *s; if (-1 == i) {@@ -480,7 +481,8 @@ } /*if*/ if (FD_ISSET(gpm_fd, &readset)) { Gpm_Event evt;- if (Gpm_GetEvent(&evt) > 0) {+ if (Gpm_GetEventExt(&evt) > 0) {+/* if (Gpm_GetEvent(&evt) > 0) { */ my_handler(&evt, 0); } else { fprintf(stderr, "Oops, Gpm_GetEvent()\n");diff -r -u gpm-1.19.3.original/mice.c gpm-1.19.3/mice.c--- gpm-1.19.3.original/mice.c Wed Mar 8 01:10:00 2000+++ gpm-1.19.3/mice.c Mon Sep 25 07:03:01 2000@@ -5,6 +5,8 @@ * Copyright (C) 1993 Andrew Haylett <ajh@gec-mrc.co.uk> * Copyright (C) 1994-2000 Alessandro Rubini <rubini@linux.it> * Copyright (C) 1998,1999 Ian Zimmerman <itz@rahul.net>+ * imps2 wheel support: Michael Glickman<xsadp@yahoo.com> 2000/09/24+ * Influenced by Jonathan Atkin's patch * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by@@ -223,6 +225,7 @@ prev = state->buttons; state->dx= (signed char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F)); state->dy= (signed char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));+ state->dw= 0; return 0; }@@ -234,6 +237,7 @@ state->buttons= ((data[0] & 0x20) >> 3) | ((data[0] & 0x10) >> 4); state->dx= (signed char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F)); state->dy= (signed char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));+ state->dw= 0; /* Allow motion *and* button change (Michael Plass) */ @@ -258,6 +262,7 @@ state->buttons= ((data[0] & 0x20) >> 3) | ((data[0] & 0x10) >> 4); state->dx= (signed char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F)); state->dy= (signed char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));+ state->dw= 0; /* Allow motion *and* button change (Michael Plass) */ @@ -352,6 +357,7 @@ state->dx = ((data[1] & 0x3f) ) * ((data[0] & 0x10)?1:-1); state->dy = ((data[2] & 0x3f) ) * ((data[0] & 0x8)?-1:1);+ state->dw= 0; return 0; }@@ -364,6 +370,7 @@ | ((data[0] & 0x10) >> 4); /* right */ state->dx= (signed char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F)); state->dy= (signed char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));+ state->dw= 0; /* wheel (dz??) is (data[3] & 0x0f) */ return 0;@@ -385,6 +392,7 @@ data[0], data[1], data[2], data[3]); return -1; }+ state->dw= 0; /* wheel (dz) is (data[3] & 0x0f) */ /* where is the side button? I can sort of detect it at 9600 baud */ /* Note this mouse is very noisy */@@ -398,6 +406,7 @@ state->buttons= ((data[0] & 0x20) >> 3) | ((data[0] & 0x10) >> 4); state->dx= (signed char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F)); state->dy= (signed char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));+ state->dw= 0; return 0; } @@ -406,6 +415,7 @@ state->buttons= (~data[0]) & 0x07; state->dx= (signed char)(data[1]); state->dy= -(signed char)(data[2]);+ state->dw= 0; return 0; } @@ -414,6 +424,7 @@ state->buttons= (~data[0]) & 0x07; state->dx= (signed char)(data[1]) + (signed char)(data[3]); state->dy= -((signed char)(data[2]) + (signed char)(data[4]));+ state->dw= 0; return 0; } @@ -495,9 +506,65 @@ state->dy= -((data[0] & 0x20) ? data[2]-256 : data[2]); else state->dy = 0;+ state->dw= 0; return 0; } +static int M_imps2(Gpm_Event *state, unsigned char *data)+{+ static int tap_active=0; /* there exist glidepoint ps2 mice */++ state->buttons=+ !!(data[0]&1) * GPM_B_LEFT ++ !!(data[0]&2) * GPM_B_RIGHT ++ !!(data[0]&4) * GPM_B_MIDDLE;++ if (data[0]==0 && opt_glidepoint_tap) /* by default this is false */+ state->buttons = tap_active = opt_glidepoint_tap;+ else if (tap_active)+ if (data[0]==8)+ state->buttons = tap_active = 0;+ else state->buttons = tap_active;++ /* Some PS/2 mice send reports with negative bit set in data[0]+ * and zero for movement. I think this is a bug in the mouse, but+ * working around it only causes artifacts when the actual report is -256;+ * they'll be treated as zero. This should be rare if the mouse sampling+ * rate is set to a reasonable value; the default of 100 Hz is plenty.+ * (Stephen Tell)+ */+ if(data[1] != 0)+ state->dx= (data[0] & 0x10) ? data[1]-256 : data[1];+ else+ state->dx = 0;+ if(data[2] != 0)+ state->dy= -((data[0] & 0x20) ? data[2]-256 : data[2]);+ else+ state->dy = 0;+ state->dw = (data[3] >= 128) ? data[3]-256 : data[3]; ++ return 0;+}++static int R_imps2(Gpm_Event *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_Event *state, unsigned char *data) { /* Avoid this beasts if you can. They connect to normal PS/2 port,@@ -533,6 +600,7 @@ state->dy= -((data[0] & 0x20) ? data[2]-256 : data[2]); else state->dy = 0;+ state->dw= 0; return 0; } @@ -598,6 +666,8 @@ prev= ((data[0] & 0x20) >> 3) | ((data[0] & 0x10) >> 4); if (mytype->packetlen==4) b=data[3]>>4; }++ state->dw= 0; if(mytype->packetlen==4) {@@ -694,7 +764,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 +799,7 @@ 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; } ox=x; oy=y; @@ -767,7 +838,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->x = x < CAL_X_MIN ? 0 : x > CAL_X_MAX ? win.ws_col+1@@ -805,6 +876,7 @@ + GPM_B_RIGHT * ((data[0]>>4) & 1); state->dx = (x-ox)/5; state->dy = (oy-y)/5;+ state->dw = 0; ox=x; oy=y; return 0; }@@ -831,6 +903,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];@@ -922,6 +995,7 @@ { lasth = h; lastv = v; lock = 1; } state->dx = -(h-lasth); lasth = h; state->dy = -(v-lastv); lastv = v; + state->dw = 0; #elif defined(TWIDDLER_BALLISTIC) {@@ -1049,6 +1123,8 @@ if ((state->dy >= -1) && (state->dy <= 1)) state->dy = 0; + state->dw = 0;+ return 0; } #endif /* have joystick.h */@@ -1991,9 +2067,9 @@ {"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,- {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0},+ {"imps2", "Microsoft Intellimouse (ps2) - 3 buttons, wheel",+ "", M_imps2, I_imps2, STD_FLG,+ {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, R_imps2}, {"ms3", "Microsoft Intellimouse (serial) - 3 buttons, wheel unused", "", M_ms3, I_pnp, CS7 | STD_FLG, {0xc0, 0x40, 0xc0, 0x00}, 4, 1, 0, 0, 0},diff -r -u gpm-1.19.3.original/mouse-test.c gpm-1.19.3/mouse-test.c--- gpm-1.19.3.original/mouse-test.c Tue Jan 18 09:23:00 2000+++ gpm-1.19.3/mouse-test.c Thu Sep 21 20:54:20 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 };
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -