⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mouse_wheel.patch

📁 gpm-1.20.0.tar.gz
💻 PATCH
📖 第 1 页 / 共 4 页
字号:
diff -u -r gpm-1.19.3/doc/doc.gpm gpm-1.19.3.wheel/doc/doc.gpm--- gpm-1.19.3/doc/doc.gpm	Tue Jul 18 22:43:18 2000+++ gpm-1.19.3.wheel/doc/doc.gpm	Wed Nov 22 21:47:30 2000@@ -852,10 +852,10 @@ consoles.  @xref{Default Handlers}. -When a client is involved, it is handled a @code{Gpm_Event}-structure, built by the server. The fields for @code{Gpm_Event} are the+When a client is involved, it is handled a @code{Gpm_EventExt} structure+built by the server. The fields for @code{Gpm_EventExt} are the following:-@tindex Gpm_Event+@tindex Gpm_EventExt  @table @code @@ -911,8 +911,35 @@ 	of them is active at a time, to allow using @code{switch} on the 	value. Vertical outrun takes precedence on horizontal outrun.         @xref{Margins}.++@item short dw;       /* Extended element */+	Wheel1 displacement after last event reading.++@item short w;       /* Extended element */+	Wheel1 position. It is not checked on an overflow, and therefore+  using dw is prefered. Another way of wheel processing is provided+  by FWHEEL and BWHEEL event types. These event types must be disabled,+  if wheel position is processed in an application.++@item short dw2;       /* Extended element */+	Wheel2 displacement after last event reading.++@item short w2;       /* Extended element */+	Wheel2 position. FWHEEL2 and BWHEEL2 are event types for the second+  wheel, similar to FWHEEL and BWHEEL.++@item int pad[18];       /* Extended element */+	Reserved for future use.+ @end table +Extended elements are those added to original Gpm_Event structure+in order to enable whell support. Extended elements are accessible+by an event handler, as well as Gpm_GetEventExt and Gpm_GetSnapshotExt+functions, while Gpm_GetEvent or Gpm_GetSnapshot operate on the+original structure. Check if @code{GPM_EVENT_EXT} is+defined before using extended elements and functions in an application.+ %========================================================================== @node Margins, Event Types, Events, Gpm Internals @section How margins are managed@@ -941,7 +968,7 @@ @node Event Types, Connection Details, Margins, Gpm Internals @section Event Types -The @code{type} field in @code{Gpm_Event} is made up of bit-wide+The @code{type} field in @code{Gpm_EventExt} is made up of bit-wide flags. The existing bit masks belong to two groups: bare events and cooked events. The bit-mask @code{GPM_BARE_EVENTS} is provided to extract bare events, by and-ing (@samp{&}) it with the @code{type} field.@@ -969,6 +996,17 @@ @item GPM_LEAVE         This is only delivered by the high level library, too. Events         of type @code{GPM_LEAVE} have all other fields undefined.+@item GPM_FWHEEL+	Wheel turned forward (toward the user). Turning a wheel more than one+  notch (Intellimouse) or for a longer time (A4-tech mouse) will produce+  additional GPM_FWHEEL events. This is an extended type - you need to+  put '#ifdef GPM_FWHEEL' before 	using the type in your code. +@item GPM_BWHEEL+	Same as GPM_FWHEEL but for turning the wheel back.+@item GPM_FWHEEL2+	Wheel 2 turned forward (right). See comments for GPM_FWHEEL+@item GPM_BWHEEL2+	Wheel 2 turned back (left). @end table  Cooked events are the following:@@ -1022,10 +1060,15 @@  @table @code @item eventMask-	A bitmask of the events the client wants-	to receive. Both bare and cooked events are-	allowed to appear in the mask.-+	A bitmask of the events the client wants to receive.+	Both bare and cooked events are	allowed to appear in the mask.+	In particular, GPM_FWHEEL and GPM_BWHEEL can be disabled by+	omitting the masks:++		Gpm_Connect conn;+		/* Enable all events, except GPM_FWHEEL and GPM_BWHEEL+		conn.eventMask =  ~(GPM_FWHEEL | GPM_BWHEEL);+		 @item defaultMask 	A mask to tell which events allow 	a default treatment (the selection one). These are mouse events,@@ -1171,7 +1214,7 @@ application. It is passed two arguments and returns an integer value, according to the following typedef: -@code{typedef int Gpm_Handler(Gpm_Event *@var{event}, void *@var{clientdata});}+@code{typedef int Gpm_Handler(Gpm_EventExt *@var{event}, void *@var{clientdata});} @tindex Gpm_Handler  The @var{event} is used to instantiate the mouse event just received,@@ -1366,8 +1409,35 @@ failure, and 0 after closing the connection. Failure can happen if a signal interrupted the read system call. This function doesn't work with xterm mouse reporting and is meant for internal use by the library.++This function does not return the extended part. @end deftypefun +@deftypefun int Gpm_GetEventExt (Gpm_EventExt *@var{event});+As Gpm_GetEvent, but returns extended part. For backward compatibility+the application should check @code{GPM_EVENT_EXT}, as given by the following+example: ++@example @noindent+    int dw, w, dw2, w, result;++#ifdef GPM_EVENT_EXT+    @{+        Gpm_Event mevnt;  +        result = Gpm_GetEventExt(&mevnt);		+        w = mevnt.w; dw = nevnt.dw;+    @}+#else+    @{+        Gpm_Event mevnt;  +        result = Gpm_GetEvent(&mevnt);		+        w = dw = w2 = dw2 = 0;+    @}	+#endif+@end example ++@end deftypefun+	 %......................................................................... @deftypefun int Gpm_CharsQueued (void); @@ -1431,7 +1501,7 @@ %......................................................................... @deftypefun int Gpm_DrawPointer (int @var{x}, int @var{y}, int @var{fd}); -@deftypefunx int GPM_DRAWPOINTER (Gpm_Event *@var{ePtr};)+@deftypefunx int GPM_DRAWPOINTER (Gpm_EventExt *@var{ePtr};)   These are actually macros. They should be used to draw the mouse pointer after@@ -1512,8 +1582,14 @@ events, and applications usually don't want to lose events, the function returns 0 if the input queue is not empty. +The functions does not return the extended part. @end deftypefun +@deftypefun int Gpm_GetSnapshotExt (Gpm_EventExt *@var{event});+As Gpm_GetSnapshot, but returns extended part. For backward compatibility+the application should check whether @code{GPM_EVENT_EXT} has been defined.++@end deftypefun  %-------------------------------------------------------------------------- @node High Level Lib, Xterm, Low Level Library, The ClientLib@@ -1668,7 +1744,7 @@ @end deftypefun  %.........................................................................-@deftypefun Gpm_Roi* Gpm_HandleRoi (Gpm_Event *@var{ePtr}, void * @var{clientdata});+@deftypefun Gpm_Roi* Gpm_HandleRoi (Gpm_EventExt *@var{ePtr}, void * @var{clientdata});   This function, which should not be invoked by the user, is the dispatching@@ -1680,12 +1756,11 @@ If no Roi is interested in he event the @code{*gpm_roi_handler} function is invoked (if not null), with null clientdata. -Reported events are all those in @code{Gpm_Event}, and also @code{GPM_ENTER}+Reported events are all those in @code{Gpm_EventExt}, and also @code{GPM_ENTER} and @code{GPM_LEAVE}. These can be used to toggle highlighting on a button or to drop a menu if the menubutton is entered during a drag. Remember that when Enter or Leave is notified, no other information in the event item should be used.-  @end deftypefun diff -u -r gpm-1.19.3/gpm.c gpm-1.19.3.wheel/gpm.c--- gpm-1.19.3/gpm.c	Tue Jul 18 22:06:06 2000+++ gpm-1.19.3.wheel/gpm.c	Wed Nov 22 21:22:45 2000@@ -61,6 +61,7 @@   DEF_TYPE, DEF_DEV, DEF_SEQUENCE,   DEF_BAUD, DEF_SAMPLE, DEF_DELTA, DEF_ACCEL, DEF_SCALE, 0 /* scaley */,   DEF_TIME, DEF_CLUSTER, DEF_THREE, DEF_GLIDEPOINT_TAP,+  DEF_SIMWHEEL,   (char *)NULL /* extra */,   (Gpm_Type *)NULL   },@@ -230,7 +231,7 @@ }  /*-------------------------------------------------------------------*/-static  inline int do_selection(Gpm_Event *event)  /* returns 0, always */+static  inline int do_selection(Gpm_EventExt *event)  /* returns 0, always */ {   static int x1=1, y1=1, x2, y2; #define UNPOINTER() 0@@ -286,7 +287,7 @@  /*-------------------------------------------------------------------*/ /* returns 0 if the event has not been processed, and 1 if it has */-static inline int do_client(Gpm_Cinfo *cinfo, Gpm_Event *event)+static inline int do_client(Gpm_Cinfo *cinfo, Gpm_EventExt *event) {   Gpm_Connect info=cinfo->data;   int fd=cinfo->fd;@@ -308,7 +309,7 @@    /* WARNING */ /* This can generate a SIGPIPE... I'd better catch it */   MAGIC_P((write(fd,&magic, sizeof(int))));-  write(fd,event, sizeof(Gpm_Event));+  write(fd,event, sizeof(Gpm_EventExt));    return info.defaultMask & GPM_HARD ? res : 1; /* HARD forces pass-on */ @@ -384,23 +385,24 @@ }  -static int statusX,statusY,statusB; /* to return info */+static int statusX,statusY,statusW,statusW2,statusB; /* to return info */ static int statusC=0; /* clicks */-void get_console_size(Gpm_Event *ePtr);+void get_console_size(Gpm_EventExt *ePtr);  /*-------------------------------------------------------------------*/-static inline int processMouse(int fd, Gpm_Event *event, Gpm_Type *type,+static inline int processMouse(int fd, Gpm_EventExt *event, Gpm_Type *type, 			       int kd_mode) {   char *data;   static int fine_dx, fine_dy;   static int i, j, m;-  static Gpm_Event nEvent;+  static Gpm_EventExt nEvent;   static struct vt_stat stat;   static struct timeval tv1={0,0}, tv2; /* tv1==0: first click is single */   static struct timeval timeout={0,0};   fd_set fdSet;   static int newB=0, oldB=0, oldT=0; /* old buttons and Type to chain events */+  static Gpm_Cinfo *ci;   /* static int buttonlock, buttonlockflag; */  #define GET_TIME(tv) (gettimeofday(&tv, (struct timezone *)NULL))@@ -409,6 +411,7 @@     oldT=event->type;+  memset (event->pad, '\0', GPM_EVENT_PAD_SIZE * sizeof(int));    if (eventFlag)     {@@ -425,13 +428,14 @@     }   else     {-    event->dx=event->dy=0;+    event->dx=event->dy=event->dw=event->dw2=0;      nEvent.modifiers = 0; /* some mice set them */     FD_ZERO(&fdSet); FD_SET(fd,&fdSet); i=0;      do /* cluster loop */       {+      nEvent.dx=nEvent.dy=nEvent.dw=nEvent.dw2=0;       if (   ((data=getMouseData(fd,m_type,kd_mode))==NULL) 	  || ((*(m_type->fun))(&nEvent,data)==-1) ) 	{@@ -439,6 +443,12 @@ 	else break; 	} +      if (which_mouse->opt_simwheel && (nEvent.buttons & GPM_B_MIDDLE) && nEvent.dy) {+	nEvent.buttons &= !GPM_B_MIDDLE;+	nEvent.dw = nEvent.dy;+	nEvent.dy = 0;+      }+       event->modifiers = nEvent.modifiers; /* propagate modifiers */        /* propagate buttons */@@ -461,6 +471,8 @@ 	/* increment the reported dx,dy */ 	event->dx+=nEvent.dx; 	event->dy+=nEvent.dy;+	event->dw+=nEvent.dw;+	event->dw2+=nEvent.dw2; 	}       else /* a pen */ 	{@@ -490,7 +502,7 @@              static struct timeval rept1,rept2;              gettimeofday(&rept2, (struct timezone *)NULL);              if (((rept2.tv_sec -rept1.tv_sec) *1000+(rept2.tv_usec-rept1.tv_usec)/1000)>250) -                { event->dx=0; event->dy=0; }+                { event->dx=0; event->dy=0; event->dw=0; event->dw2=0; }              rept1=rept2;                            event->dy=event->dy*((win.ws_col/win.ws_row)+1);@@ -512,7 +524,7 @@     fine_dx %= opt_scale;           fine_dy %= opt_scaley;     } -  if (!event->dx && !event->dy && (event->buttons==oldB))+  if (!event->dx && !event->dy && !event->dw && !event->dw2 && (event->buttons==oldB))     do        { /* so to break */       static long awaketime;@@ -528,7 +540,8 @@  /*....................................... fill missing fields */ -  event->x+=event->dx, event->y+=event->dy;+  event->x+=event->dx; event->y+=event->dy;+  event->w+=event->dw; event->w2+=event->dw2;   statusB=event->buttons;    i=open_console(O_RDONLY);@@ -559,7 +572,31 @@   else     event->type = (event->buttons > oldB ? GPM_DOWN : GPM_UP); -  switch(event->type)                    /* now provide the cooked bits */+  ci = cinfo[stat.v_active];+  if (ci != NULL)+    {+    i = (ci->data).eventMask;+    if (event->w > 0 && (i & GPM_FWHEEL))+       {+       event->type |= GPM_FWHEEL;  (event->w)--;+       }+    else+       if (event->w < 0 && (i & GPM_BWHEEL))+       {+       event->type |= GPM_BWHEEL;  (event->w)++;+       }+    if (event->w2 > 0 && (i & GPM_FWHEEL2))+       {+       event->type |= GPM_FWHEEL2;  (event->w2)--;+       }+    else+       if (event->w2 < 0 && (i & GPM_BWHEEL2))+       {+       event->type |= GPM_BWHEEL2;  (event->w2)++;+       }+    }	+  +  switch(event->type & 0x0f)           /* now provide the cooked bits */     {     case GPM_DOWN:       GET_TIME(tv2);@@ -567,7 +604,7 @@ 	statusC++, statusC%=3; /* 0, 1 or 2 */       else statusC=0;       event->type|=(GPM_SINGLE<<statusC);-    break;+      break;      case GPM_UP:       GET_TIME(tv1);@@ -576,6 +613,7 @@       event->type|=(GPM_SINGLE<<statusC);       break; +     case GPM_DRAG:       event->type |= GPM_MFLAG;       event->type|=(GPM_SINGLE<<statusC);@@ -583,6 +621,7 @@      case GPM_MOVE:       statusC=0;+     default:       break;     }@@ -620,6 +659,7 @@    /* update the global state */   statusX=event->x; statusY=event->y;+  statusW=event->w; statusW2=event->w2;    if (opt_special && event->type & GPM_DOWN)      return processSpecial(event);@@ -671,7 +711,7 @@   int i;   Gpm_Cinfo *cinfoPtr, *next;   Gpm_Connect conn;-  static Gpm_Event event;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -