📄 mouse_wheel.patch
字号:
+ static Gpm_EventExt event; static struct vt_stat stat; gpm_debug_log(LOG_INFO,"Request on %i (console %i)", ci->fd, vc);@@ -733,15 +773,16 @@ oops("get_shift_state"); close(i); event.vc = stat.v_active;- event.x=statusX; event.y=statusY;- event.dx=maxx; event.dy=maxy;+ event.x=statusX; event.y=statusY; + event.w=statusW; event.w2=statusW2;+ event.dx=maxx; event.dy=maxy; event.buttons= statusB; event.clicks=statusC; /* fall through */ case GPM_REQ_BUTTONS: event.type= (opt_three==1 ? 3 : 2); /* buttons */- write(ci->fd,&event,sizeof(Gpm_Event));+ write(ci->fd,&event,sizeof(Gpm_EventExt)); break; case GPM_REQ_NOPASTE:@@ -868,16 +909,16 @@ /* if the client gets motions, give it the current position */ if(request->eventMask & GPM_MOVE)- {- Gpm_Event event={0,0,vc,0,0,statusX,statusY,GPM_MOVE,0,0};- do_client(info, &event);+ { Gpm_EventExt event={0,0,vc,0,0,statusX,statusY,GPM_MOVE,0,0,+ 0,statusW,0,statusW2};+ do_client(info, &event); } return newfd; } /*-------------------------------------------------------------------*/-void get_console_size(Gpm_Event *ePtr)+void get_console_size(Gpm_EventExt *ePtr) { int i, prevmaxx, prevmaxy; struct mouse_features *which_mouse; /* local */@@ -899,6 +940,8 @@ if (!prevmaxx) { /* first invocation, place the pointer in the middle */ statusX = ePtr->x = maxx/2; statusY = ePtr->y = maxy/2;+ statusW = ePtr->w = 0; + statusW2 = ePtr->w2 = 0; } else { /* keep the pointer in the same position where it was */ statusX = ePtr->x = ePtr->x * maxx / prevmaxx; statusY = ePtr->y = ePtr->y * maxy / prevmaxy;@@ -935,7 +978,7 @@ struct timeval timeout; int maxfd=-1; int pending;- Gpm_Event event;+ Gpm_EventExt event; prgname=argv[0]; diff -u -r gpm-1.19.3/gpm.h gpm-1.19.3.wheel/gpm.h--- gpm-1.19.3/gpm.h Fri Jan 28 09:09:00 2000+++ gpm-1.19.3.wheel/gpm.h Wed Nov 22 21:23:55 2000@@ -98,6 +98,12 @@ GPM_LEAVE=1024 /* leave event, used in Roi's */ }; +#define GPM_WHEEL+#define GPM_FWHEEL 4096 /* wheel1 move forward */+#define GPM_BWHEEL 8192 /* wheel1 move backward */+#define GPM_FWHEEL2 16384 /* wheel2 move forward(right) */+#define GPM_BWHEEL2 32768 /* wheel2 move backward(left) */+ #define Gpm_StrictSingle(type) (((type)&GPM_SINGLE) && !((type)&GPM_MFLAG)) #define Gpm_AnySingle(type) ((type)&GPM_SINGLE) #define Gpm_StrictDouble(type) (((type)&GPM_DOUBLE) && !((type)&GPM_MFLAG))@@ -120,9 +126,24 @@ enum Gpm_Margin margin; } Gpm_Event; +#define GPM_EVENT_PAD_SIZE 19 /* Should be enough for now */+#define GPM_EVENT_EXT++typedef struct Gpm_EventExt {+ unsigned char buttons, modifiers; /* try to be a multiple of 4 */+ unsigned short vc;+ short dx, dy, x, y;+ enum Gpm_Etype type;+ int clicks;+ enum Gpm_Margin margin;+ short dw, w;+ short dw2, w2;+ int pad[GPM_EVENT_PAD_SIZE];+} Gpm_EventExt;+ /*....................................... The handling function */ -typedef int Gpm_Handler(Gpm_Event *event, void *clientdata);+typedef int Gpm_Handler(Gpm_EventExt *event, void *clientdata); /*....................................... The connection data structure */ @@ -181,6 +202,7 @@ extern int Gpm_Open(Gpm_Connect *, int); extern int Gpm_Close(void); extern int Gpm_GetEvent(Gpm_Event *);+extern int Gpm_GetEventExt(Gpm_EventExt *); extern int Gpm_CharsQueued(void); extern int Gpm_Getc(FILE *); #define Gpm_Getchar() Gpm_Getc(stdin)@@ -246,6 +268,7 @@ char *Gpm_GetLibVersion(int *where); char *Gpm_GetServerVersion(int *where); int Gpm_GetSnapshot(Gpm_Event *ePtr);+int Gpm_GetSnapshotExt(Gpm_EventExt *ePtr); #ifdef __cplusplus };diff -u -r gpm-1.19.3/gpmCfg.h gpm-1.19.3.wheel/gpmCfg.h--- gpm-1.19.3/gpmCfg.h Tue Jan 18 09:23:00 2000+++ gpm-1.19.3.wheel/gpmCfg.h Thu Sep 21 20:42:12 2000@@ -62,5 +62,7 @@ #define DEF_TEST 0 #define DEF_PTRDRAG 1 /* double or triple click */ #define DEF_GLIDEPOINT_TAP 0 /* tapping emulates no buttons by default */+#define DEF_SIMWHEEL 0 /* simulate wheel with middle button and */+ /* y-axis movement */ #endif /* _GPMCFG_INCLUDED */diff -u -r gpm-1.19.3/gpmInt.h gpm-1.19.3.wheel/gpmInt.h--- gpm-1.19.3/gpmInt.h Tue Jul 18 22:18:54 2000+++ gpm-1.19.3.wheel/gpmInt.h Sat Nov 11 18:55:32 2000@@ -56,7 +56,7 @@ char *name; char *desc; /* a descriptive line */ char *synonyms; /* extra names (the XFree name etc) as a list */- int (*fun)(Gpm_Event *state, unsigned char *data);+ int (*fun)(Gpm_EventExt *state, unsigned char *data); struct Gpm_Type *(*init)(int fd, unsigned short flags, struct Gpm_Type *type, int argc, char **argv); unsigned short flags;@@ -66,7 +66,7 @@ int getextra; /* does it get an extra byte? (only mouseman) */ int absolute; /* flag indicating absolute pointing device */ - int (*repeat_fun)(Gpm_Event *state, int fd); /* repeat this event into fd */+ int (*repeat_fun)(Gpm_EventExt *state, int fd); /* repeat this event into fd */ /* itz Mon Jan 11 23:27:54 PST 1999 */ } Gpm_Type; @@ -88,6 +88,7 @@ char *opt_type, *opt_dev, *opt_sequence; int opt_baud,opt_sample,opt_delta, opt_accel, opt_scale, opt_scaley; int opt_time, opt_cluster, opt_three, opt_glidepoint_tap;+ int opt_simwheel; char *opt_options; /* extra textual configuration */ Gpm_Type *m_type; int fd;@@ -148,7 +149,7 @@ /* mice.c */ extern int M_listTypes(void); /* special.c */-int processSpecial(Gpm_Event *event);+int processSpecial(Gpm_EventExt *event); int twiddler_key(unsigned long message); int twiddler_key_init(void); diff -u -r gpm-1.19.3/gpn.c gpm-1.19.3.wheel/gpn.c--- gpm-1.19.3/gpn.c Tue Jul 18 22:06:06 2000+++ gpm-1.19.3.wheel/gpn.c Thu Sep 21 20:53:38 2000@@ -177,7 +177,9 @@ " Use a non-existent type (e.g. \"help\") to get a list\n" " -T test: read mouse, no clients\n" " -v print version and exit\n"- " -V verbosity increase number of logged messages\n", + " -V verbosity increase number of logged messages\n"+ " -w simulate wheel operation by pressing middle\n"+ " mouse button and y-axis movement\n", DEF_ACCEL, DEF_BAUD, DEF_SEQUENCE, DEF_DELTA, DEF_TIME, DEF_LUT, DEF_SCALE, DEF_SAMPLE, DEF_TYPE); return 1;@@ -286,7 +288,7 @@ int cmdline(int argc, char **argv) {- char options[]="a:A::b:B:d:Dg:hi:kl:m:Mo:pr:R::s:S:t:TvV::23";+ char options[]="a:A::b:B:d:Dg:hi:kl:m:Mo:pr:R::s:S:t:TvV::w23"; int i, opt; static struct {char *in; char *out;} seq[] = { {"123","01234567"},@@ -359,6 +361,9 @@ case 'v': printf(GPM_NAME " " GPM_RELEASE ", " GPM_DATE "\n"); exit(0); case 'V': gpm_debug_level += (0 == optarg ? 1 : strtol(optarg, 0, 0));+ break;+ case 'w':+ which_mouse->opt_simwheel=1; break; case '2': opt_three=-1; break; case '3': opt_three=1; break;diff -u -r gpm-1.19.3/hltest.c gpm-1.19.3.wheel/hltest.c--- gpm-1.19.3/hltest.c Tue Jan 18 08:34:00 2000+++ gpm-1.19.3.wheel/hltest.c Sat Nov 11 19:28:24 2000@@ -281,7 +281,7 @@ * Gpm_PushRoi on creation, and is used to differentiate them */ -int handler(Gpm_Event *ePtr, void *clientdata)+int handler(Gpm_EventExt *ePtr, void *clientdata) { WinInfo *info=clientdata; int number=info->number;@@ -391,7 +391,7 @@ * This extra handler is only used for the background and left bar */ -int xhandler(Gpm_Event *ePtr, void *clientdata)+int xhandler(Gpm_EventExt *ePtr, void *clientdata) { static int x=0,y=0; int back=0;diff -u -r gpm-1.19.3/libcurses.c gpm-1.19.3.wheel/libcurses.c--- gpm-1.19.3/libcurses.c Tue Jan 18 08:34:00 2000+++ gpm-1.19.3.wheel/libcurses.c Sat Nov 11 19:20:12 2000@@ -47,7 +47,7 @@ fd_set selSet; int max, flag, result; int fd=STDIN_FILENO;-static Gpm_Event ev;+static Gpm_EventExt ev; if (!gpm_flag || gpm_fd==-1) return GET(win); if (gpm_morekeys) return (*gpm_handler)(&ev,gpm_data);@@ -76,7 +76,7 @@ if (flag==-1) continue; - if (Gpm_GetEvent(&ev) && gpm_handler+ if (Gpm_GetEventExt(&ev) && gpm_handler && (result=(*gpm_handler)(&ev,gpm_data))) { gpm_hflag=1;@@ -93,7 +93,7 @@ /* JD patch 11/08/1998 */ #define MAXNBPREVCHAR 4 /* I don't think more is usefull, JD */ static int nbprevchar=0, prevchar[MAXNBPREVCHAR];- extern gpm_convert_event(char *data, Gpm_Event *event);+ extern gpm_convert_event(char *data, Gpm_EventExt *event); int c; unsigned char mdata[4]; /* JD patch 11/08/1998 */diff -u -r gpm-1.19.3/libhigh.c gpm-1.19.3.wheel/libhigh.c--- gpm-1.19.3/libhigh.c Tue Jan 18 08:34:00 2000+++ gpm-1.19.3.wheel/libhigh.c Sat Nov 11 19:18:59 2000@@ -132,9 +132,9 @@ * It generates also GPM_ENTER and GPM_LEAVE events. */ -int Gpm_HandleRoi(Gpm_Event *ePtr, void *clientdata)+int Gpm_HandleRoi(Gpm_EventExt *ePtr, void *clientdata) {-static Gpm_Event backEvent;+static Gpm_EventExt backEvent; Gpm_Roi *roi=gpm_current_roi; /*diff -u -r gpm-1.19.3/liblow.c gpm-1.19.3.wheel/liblow.c--- gpm-1.19.3/liblow.c Tue Jul 18 22:06:06 2000+++ gpm-1.19.3.wheel/liblow.c Sat Nov 11 19:23:43 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@@ -400,7 +402,7 @@ } /*-------------------------------------------------------------------*/-int Gpm_GetEvent(Gpm_Event *event)+int Gpm_GetEventExt(Gpm_EventExt *event) { int count; MAGIC_P((int magic));@@ -408,6 +410,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 +424,7 @@ } #endif - if ((count=read(gpm_fd,event,sizeof(Gpm_Event)))!=sizeof(Gpm_Event))+ if ((count=read(gpm_fd,event,sizeof(Gpm_EventExt))) != sizeof(Gpm_EventExt)) { #ifndef GPM_USE_MAGIC if (count==0)@@ -442,12 +445,22 @@ return -1; } + event->x -= gpm_zerobased; event->y -= gpm_zerobased; return 1; } +int Gpm_GetEvent(Gpm_Event *event)+{ Gpm_EventExt tmp_event;+ int rc; + rc = Gpm_GetEventExt(&tmp_event);+ if (event != NULL)+ memcpy(event, &tmp_event, sizeof(Gpm_Event));+ return rc; +}+ #define MAXNBPREVCHAR 4 /* I don't think more is usefull, JD */ static int nbprevchar=0, prevchar[MAXNBPREVCHAR];@@ -464,7 +477,7 @@ { fd_set selSet; int max, flag, result;- static Gpm_Event ev;+ static Gpm_EventExt ev; int fd=fileno(f); static int count; @@ -502,7 +515,7 @@ if (FD_ISSET(fd,&selSet)) return fgetc(f); - if (Gpm_GetEvent(&ev) && gpm_handler + if (Gpm_GetEventExt(&ev) && gpm_handler && (result=(*gpm_handler)(&ev,gpm_data))) { gpm_hflag=1;@@ -516,7 +529,7 @@ #define DELAY_MS 100 static struct timeval to={0,DELAY_MS*1000}; static fd_set selSet;- extern gpm_convert_event(unsigned char *data, Gpm_Event *event);+ extern gpm_convert_event(unsigned char *data, Gpm_EventExt *event); int c; unsigned char mdata[4]; if (nbprevchar) /* if there are some consumed char ... */@@ -600,7 +613,7 @@ } /*-------------------------------------------------------------------*/-int gpm_convert_event(unsigned char *mdata, Gpm_Event *ePtr)+int gpm_convert_event(unsigned char *mdata, Gpm_EventExt *ePtr) { static struct timeval tv1={0,0}, tv2; static int clicks=0;diff -u -r gpm-1.19.3/libxtra.c gpm-1.19.3.wheel/libxtra.c--- gpm-1.19.3/libxtra.c Tue Jan 18 09:23:00 2000+++ gpm-1.19.3.wheel/libxtra.c Sat Nov 11 19:16:22 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_EventExt *ePtr) { Gpm_Connect conn;- Gpm_Event event;+ Gpm_EventExt 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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -