[PATCH 14/19] xfree86: remove LocalDeviceRec/Ptr definition.

Peter Hutterer peter.hutterer at who-t.net
Thu Jul 29 23:21:30 PDT 2010


Two names pointing to the same struct for over 7 years now. Remove the
define, if drivers don't want to change they can always do the typedef
themselves.

Rename all "LocalDevicePtr local" to "InputInfoPtr pInfo".

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 hw/xfree86/common/xf86Helper.c |   10 ++--
 hw/xfree86/common/xf86Xinput.c |   82 ++++++++++++++++++++--------------------
 hw/xfree86/common/xf86Xinput.h |   40 ++++++++++---------
 3 files changed, 67 insertions(+), 65 deletions(-)

diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 8f5ca45..bdc4986 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1193,7 +1193,7 @@ xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
 /* Print input driver messages in the standard format of
    <driver>: <device name>: <message> */
 void
-xf86VIDrvMsgVerb(LocalDevicePtr dev, MessageType type, int verb, const char *format,
+xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
 		 va_list args)
 {
     char *msg;
@@ -1205,7 +1205,7 @@ xf86VIDrvMsgVerb(LocalDevicePtr dev, MessageType type, int verb, const char *for
 
 /* Print input driver message, with verbose level specified directly */
 void
-xf86IDrvMsgVerb(LocalDevicePtr dev, MessageType type, int verb, const char *format,
+xf86IDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
 	       ...)
 {
     va_list ap;
@@ -1217,7 +1217,7 @@ xf86IDrvMsgVerb(LocalDevicePtr dev, MessageType type, int verb, const char *form
 
 /* Print input driver messages, with verbose level of 1 (default) */
 void
-xf86IDrvMsg(LocalDevicePtr dev, MessageType type, const char *format, ...)
+xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char *format, ...)
 {
     va_list ap;
 
@@ -2050,7 +2050,7 @@ xf86IsUnblank(int mode)
 }
 
 void
-xf86MotionHistoryAllocate(LocalDevicePtr local)
+xf86MotionHistoryAllocate(InputInfoPtr pInfo)
 {
-    AllocateMotionHistory(local->dev);
+    AllocateMotionHistory(pInfo->dev);
 }
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 9f48275..defb83a 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -203,11 +203,11 @@ static void
 ApplyAccelerationSettings(DeviceIntPtr dev){
     int scheme, i;
     DeviceVelocityPtr pVel;
-    LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
+    InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate;
     char* schemeStr;
 
     if (dev->valuator && dev->ptrfeed) {
-	schemeStr = xf86SetStrOption(local->options, "AccelerationScheme", "");
+	schemeStr = xf86SetStrOption(pInfo->options, "AccelerationScheme", "");
 
 	scheme = dev->valuator->accelScheme.number;
 
@@ -228,15 +228,15 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
 
             if (InitPointerAccelerationScheme(dev, scheme)) {
 		xf86Msg(X_CONFIG, "%s: (accel) selected scheme %s/%i\n",
-		        local->name, schemeStr, scheme);
+		        pInfo->name, schemeStr, scheme);
 	    } else {
         	xf86Msg(X_CONFIG, "%s: (accel) could not init scheme %s\n",
-        	        local->name, schemeStr);
+		        pInfo->name, schemeStr);
         	scheme = dev->valuator->accelScheme.number;
             }
         } else {
             xf86Msg(X_CONFIG, "%s: (accel) keeping acceleration scheme %i\n",
-                    local->name, scheme);
+                    pInfo->name, scheme);
         }
 
         free(schemeStr);
@@ -245,22 +245,22 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
         switch (scheme) {
             case PtrAccelPredictable:
                 pVel = GetDevicePredictableAccelData(dev);
-                ProcessVelocityConfiguration (dev, local->name, local->options,
+                ProcessVelocityConfiguration (dev, pInfo->name, pInfo->options,
                                               pVel);
                 break;
         }
 
-        i = xf86SetIntOption(local->options, "AccelerationNumerator",
+        i = xf86SetIntOption(pInfo->options, "AccelerationNumerator",
                              dev->ptrfeed->ctrl.num);
         if (i >= 0)
             dev->ptrfeed->ctrl.num = i;
 
-        i = xf86SetIntOption(local->options, "AccelerationDenominator",
+        i = xf86SetIntOption(pInfo->options, "AccelerationDenominator",
                              dev->ptrfeed->ctrl.den);
         if (i > 0)
             dev->ptrfeed->ctrl.den = i;
 
-        i = xf86SetIntOption(local->options, "AccelerationThreshold",
+        i = xf86SetIntOption(pInfo->options, "AccelerationThreshold",
                              dev->ptrfeed->ctrl.threshold);
         if (i >= 0)
             dev->ptrfeed->ctrl.threshold = i;
@@ -269,10 +269,10 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
         (*dev->ptrfeed->CtrlProc)(dev, &dev->ptrfeed->ctrl);
 
         xf86Msg(X_CONFIG, "%s: (accel) acceleration factor: %.3f\n",
-                            local->name, ((float)dev->ptrfeed->ctrl.num)/
+                            pInfo->name, ((float)dev->ptrfeed->ctrl.num)/
                                          ((float)dev->ptrfeed->ctrl.den));
         xf86Msg(X_CONFIG, "%s: (accel) acceleration threshold: %i\n",
-                local->name, dev->ptrfeed->ctrl.threshold);
+                pInfo->name, dev->ptrfeed->ctrl.threshold);
     }
 }
 
@@ -285,21 +285,21 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
  ***********************************************************************
  */
 void
-xf86ProcessCommonOptions(LocalDevicePtr local,
+xf86ProcessCommonOptions(InputInfoPtr pInfo,
                          pointer	list)
 {
     if (!xf86SetBoolOption(list, "AlwaysCore", 1) ||
         !xf86SetBoolOption(list, "SendCoreEvents", 1) ||
         !xf86SetBoolOption(list, "CorePointer", 1) ||
         !xf86SetBoolOption(list, "CoreKeyboard", 1)) {
-        xf86Msg(X_CONFIG, "%s: doesn't report core events\n", local->name);
+        xf86Msg(X_CONFIG, "%s: doesn't report core events\n", pInfo->name);
     } else {
-        local->flags |= XI86_ALWAYS_CORE;
-        xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
+        pInfo->flags |= XI86_ALWAYS_CORE;
+        xf86Msg(X_CONFIG, "%s: always reports core events\n", pInfo->name);
     }
 
     /* Backwards compatibility. */
-    local->history_size = GetMotionHistorySize();
+    pInfo->history_size = GetMotionHistorySize();
 }
 
 /***********************************************************************
@@ -312,34 +312,34 @@ xf86ProcessCommonOptions(LocalDevicePtr local,
  ***********************************************************************
  */
 static DeviceIntPtr
-xf86ActivateDevice(LocalDevicePtr local)
+xf86ActivateDevice(InputInfoPtr pInfo)
 {
     DeviceIntPtr	dev;
 
-    dev = AddInputDevice(serverClient, local->device_control, TRUE);
+    dev = AddInputDevice(serverClient, pInfo->device_control, TRUE);
 
     if (dev == NULL)
     {
         xf86Msg(X_ERROR, "Too many input devices. Ignoring %s\n",
-                local->name);
-        local->dev = NULL;
+                pInfo->name);
+        pInfo->dev = NULL;
         return NULL;
     }
 
-    local->atom = MakeAtom(local->type_name, strlen(local->type_name), TRUE);
-    AssignTypeAndName(dev, local->atom, local->name);
-    dev->public.devicePrivate = local;
-    local->dev = dev;
+    pInfo->atom = MakeAtom(pInfo->type_name, strlen(pInfo->type_name), TRUE);
+    AssignTypeAndName(dev, pInfo->atom, pInfo->name);
+    dev->public.devicePrivate = pInfo;
+    pInfo->dev = dev;
 
-    dev->coreEvents = local->flags & XI86_ALWAYS_CORE;
+    dev->coreEvents = pInfo->flags & XI86_ALWAYS_CORE;
     dev->type = SLAVE;
     dev->spriteInfo->spriteOwner = FALSE;
 
-    dev->config_info = xf86SetStrOption(local->options, "config_info", NULL);
+    dev->config_info = xf86SetStrOption(pInfo->options, "config_info", NULL);
 
     if (serverGeneration == 1)
         xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
-                local->name, local->type_name);
+                pInfo->name, pInfo->type_name);
 
     return dev;
 }
@@ -401,10 +401,10 @@ CloseInputDevice(DeviceIntPtr dev,
 int
 SetDeviceMode (ClientPtr client, DeviceIntPtr dev, int mode)
 {
-  LocalDevicePtr        local = (LocalDevicePtr)dev->public.devicePrivate;
+  InputInfoPtr        pInfo = (InputInfoPtr)dev->public.devicePrivate;
 
-  if (local->switch_mode) {
-    return (*local->switch_mode)(client, dev, mode);
+  if (pInfo->switch_mode) {
+    return (*pInfo->switch_mode)(client, dev, mode);
   }
   else
     return BadMatch;
@@ -428,10 +428,10 @@ int
 SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
                     int first_valuator, int num_valuators)
 {
-    LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate;
+    InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate;
 
-    if (local->set_device_valuators)
-	return (*local->set_device_valuators)(local, valuators, first_valuator,
+    if (pInfo->set_device_valuators)
+	return (*pInfo->set_device_valuators)(pInfo, valuators, first_valuator,
 					      num_valuators);
 
     return BadMatch;
@@ -450,9 +450,9 @@ SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
 int
 ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
 {
-  LocalDevicePtr        local = (LocalDevicePtr)dev->public.devicePrivate;
+  InputInfoPtr        pInfo = (InputInfoPtr)dev->public.devicePrivate;
 
-  if (!local->control_proc) {
+  if (!pInfo->control_proc) {
       switch (control->control) {
       case DEVICE_CORE:
           return BadMatch;
@@ -466,7 +466,7 @@ ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
       }
   }
   else {
-      return (*local->control_proc)(local, control);
+      return (*pInfo->control_proc)(pInfo, control);
   }
 }
 
@@ -996,7 +996,7 @@ unwind:
 void
 DeleteInputDeviceRequest(DeviceIntPtr pDev)
 {
-    LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate;
+    InputInfoPtr pInfo = (InputInfoPtr) pDev->public.devicePrivate;
     InputDriverPtr drv = NULL;
     IDevRec *idev = NULL;
     IDevPtr *it;
@@ -1286,7 +1286,7 @@ xf86PostKeyboardEvent(DeviceIntPtr      device,
     xf86PostKeyEventP(device, key_code, is_down, 0, 0, 0, NULL);
 }
 
-LocalDevicePtr
+InputInfoPtr
 xf86FirstLocalDevice(void)
 {
     return xf86InputDevs;
@@ -1339,14 +1339,14 @@ xf86ScaleAxis(int	Cx,
  * specific like a touch screen.
  */
 void
-xf86XInputSetScreen(LocalDevicePtr	local,
+xf86XInputSetScreen(InputInfoPtr	pInfo,
 		    int			screen_number,
 		    int			x,
 		    int			y)
 {
-    if (miPointerGetScreen(local->dev) !=
+    if (miPointerGetScreen(pInfo->dev) !=
           screenInfo.screens[screen_number]) {
-	miPointerSetScreen(local->dev, screen_number, x, y);
+	miPointerSetScreen(pInfo->dev, screen_number, x, y);
     }
 }
 
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 943e181..6f003cc 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -64,7 +64,7 @@
 #define XI86_SEND_CORE_EVENTS	XI86_ALWAYS_CORE
 
 #define XI_PRIVATE(dev) \
-	(((LocalDevicePtr)((dev)->public.devicePrivate))->private)
+	(((InputInfoPtr)((dev)->public.devicePrivate))->private)
 
 /* Valuator verification macro */
 #define XI_VERIFY_VALUATORS(num_valuators)					\
@@ -78,15 +78,17 @@
 #define TS_Raw 60
 #define TS_Scaled 61
 
+struct _InputInfoRec;
+
 /* This holds the input driver entry and module information. */
 typedef struct _InputDriverRec {
     int			    driverVersion;
     char *		    driverName;
     void		    (*Identify)(int flags);
     int			    (*PreInit)(struct _InputDriverRec *drv,
-				       struct _LocalDeviceRec* pInfo, int flags);
+				       struct _InputInfoRec* pInfo, int flags);
     void		    (*UnInit)(struct _InputDriverRec *drv,
-				      struct _LocalDeviceRec *pInfo,
+				      struct _InputInfoRec *pInfo,
 				      int flags);
     pointer		    module;
     int			    refCount;
@@ -95,27 +97,27 @@ typedef struct _InputDriverRec {
 
 /* This is to input devices what the ScrnInfoRec is to screens. */
 
-typedef struct _LocalDeviceRec {
-    struct _LocalDeviceRec *next;
+typedef struct _InputInfoRec {
+    struct _InputInfoRec *next;
     char *		    name;
     int			    flags;
 
     Bool		    (*device_control)(DeviceIntPtr device, int what);
-    void		    (*read_input)(struct _LocalDeviceRec *local);
-    int			    (*control_proc)(struct _LocalDeviceRec *local,
+    void		    (*read_input)(struct _InputInfoRec *local);
+    int			    (*control_proc)(struct _InputInfoRec *local,
 					   xDeviceCtl *control);
-    void		    (*close_proc)(struct _LocalDeviceRec *local);
+    void		    (*close_proc)(struct _InputInfoRec *local);
     int			    (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
 					  int mode);
-    Bool		    (*conversion_proc)(struct _LocalDeviceRec *local,
+    Bool		    (*conversion_proc)(struct _InputInfoRec *local,
 					      int first, int num, int v0,
 					      int v1, int v2, int v3, int v4,
 					      int v5, int *x, int *y);
     Bool		    (*reverse_conversion_proc)(
-					struct _LocalDeviceRec *local,
+					struct _InputInfoRec *local,
 					int x, int y, int *valuators);
     int                     (*set_device_valuators)
-				(struct _LocalDeviceRec *local,
+				(struct _InputInfoRec *local,
 				 int *valuators, int first_valuator,
 				 int num_valuators);
 
@@ -136,12 +138,12 @@ typedef struct _LocalDeviceRec {
     pointer		    options;
     unsigned int            history_size;
     InputAttributes         *attrs;
-} LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
+} InputInfoRec, *InputInfoPtr;
 
 typedef struct _DeviceAssocRec 
 {
     char *		    config_section_name;
-    LocalDevicePtr	    (*device_allocate)(void);
+    InputInfoPtr	    (*device_allocate)(void);
 } DeviceAssocRec, *DeviceAssocPtr;
 
 /* xf86Globals.c */
@@ -170,9 +172,9 @@ extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device, unsigned int key_co
 		       int *valuators);
 extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
                            int is_down);
-extern _X_EXPORT LocalDevicePtr xf86FirstLocalDevice(void);
+extern _X_EXPORT InputInfoPtr xf86FirstLocalDevice(void);
 extern _X_EXPORT int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
-extern _X_EXPORT void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
+extern _X_EXPORT void xf86XInputSetScreen(InputInfoPtr pInfo, int screen_number, int x, int y);
 extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
 extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
 				int maxval, int resolution, int min_res,
@@ -191,14 +193,14 @@ extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex);
 extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name);
 extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name);
 extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags);
-extern _X_EXPORT void xf86MotionHistoryAllocate(LocalDevicePtr local);
-extern _X_EXPORT void xf86IDrvMsgVerb(LocalDevicePtr dev,
+extern _X_EXPORT void xf86MotionHistoryAllocate(InputInfoPtr pInfo);
+extern _X_EXPORT void xf86IDrvMsgVerb(InputInfoPtr dev,
 				      MessageType type, int verb,
 				      const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5);
-extern _X_EXPORT void xf86IDrvMsg(LocalDevicePtr dev,
+extern _X_EXPORT void xf86IDrvMsg(InputInfoPtr dev,
 				  MessageType type,
 				  const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4);
-extern _X_EXPORT void xf86VIDrvMsgVerb(LocalDevicePtr dev,
+extern _X_EXPORT void xf86VIDrvMsgVerb(InputInfoPtr dev,
 				       MessageType type,
 				       int verb,
 				       const char *format,
-- 
1.7.2



More information about the xorg-devel mailing list