[PATCH joystick 1/9] Replace LocalDevicePtr with InputInfoPtr
Peter Hutterer
peter.hutterer at who-t.net
Tue Dec 14 18:58:06 PST 2010
Both typedefs describe the same struct, LocalDevicePtr has been removed with
input ABI 12.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/jstk.c | 120 +++++++++++++++++++++++++++---------------------------
src/jstk.h | 2 +-
src/jstk_axis.c | 8 ++--
src/jstk_axis.h | 8 ++--
src/jstk_key.c | 62 ++++++++++++++--------------
src/jstk_key.h | 4 +-
6 files changed, 102 insertions(+), 102 deletions(-)
diff --git a/src/jstk.c b/src/jstk.c
index 836bd71..747210a 100644
--- a/src/jstk.c
+++ b/src/jstk.c
@@ -76,7 +76,7 @@
*/
static Bool
-jstkConvertProc(LocalDevicePtr local,
+jstkConvertProc(InputInfoPtr pInfo,
int first,
int num,
int v0,
@@ -148,21 +148,21 @@ jstkOpenDevice(JoystickDevPtr priv, BOOL probe)
*/
static void
-jstkReadProc(LocalDevicePtr local)
+jstkReadProc(InputInfoPtr pInfo)
{
JOYSTICKEVENT event;
int number;
int i, r;
- JoystickDevPtr priv = local->private;
+ JoystickDevPtr priv = pInfo->private;
do {
if ((priv->read_proc == NULL) ||
((r=priv->read_proc(priv, &event, &number))==0)) {
xf86Msg(X_WARNING, "JOYSTICK: Read failed. Deactivating device.\n");
- if (local->fd >= 0)
- RemoveEnabledDevice(local->fd);
+ if (pInfo->fd >= 0)
+ RemoveEnabledDevice(pInfo->fd);
return;
}
@@ -175,7 +175,7 @@ jstkReadProc(LocalDevicePtr local)
switch (priv->button[number].mapping) {
case JSTK_MAPPING_BUTTON:
if (priv->mouse_enabled == TRUE) {
- xf86PostButtonEvent(local->dev, 0,
+ xf86PostButtonEvent(pInfo->dev, 0,
priv->button[number].buttonnumber,
priv->button[number].pressed, 0, 0);
}
@@ -188,7 +188,7 @@ jstkReadProc(LocalDevicePtr local)
if (priv->button[number].pressed == 0)
priv->button[number].currentspeed = 1.0;
else if (priv->mouse_enabled == TRUE)
- jstkStartButtonAxisTimer(local, number);
+ jstkStartButtonAxisTimer(pInfo, number);
break;
case JSTK_MAPPING_KEY:
@@ -259,7 +259,7 @@ jstkReadProc(LocalDevicePtr local)
priv->axis[number].mapping));
if (priv->axis[number].valuator != -1)
- xf86PostMotionEvent(local->dev, 1, priv->axis[number].valuator,
+ xf86PostMotionEvent(pInfo->dev, 1, priv->axis[number].valuator,
1, priv->axis[number].value);
switch (priv->axis[number].mapping) {
@@ -273,12 +273,12 @@ jstkReadProc(LocalDevicePtr local)
if (priv->axis[number].value == 0)
priv->axis[number].currentspeed = 1.0;
if (priv->mouse_enabled == TRUE)
- jstkStartAxisTimer(local, number);
+ jstkStartAxisTimer(pInfo, number);
break;
case JSTK_TYPE_ABSOLUTE:
if (priv->mouse_enabled == TRUE)
- jstkHandleAbsoluteAxis(local, number);
+ jstkHandleAbsoluteAxis(pInfo, number);
break;
default:
break;
@@ -287,9 +287,9 @@ jstkReadProc(LocalDevicePtr local)
case JSTK_MAPPING_KEY: if (priv->keys_enabled == TRUE) {
if (priv->axis[number].type == JSTK_TYPE_ACCELERATED) {
- jstkHandlePWMAxis(local, number);
+ jstkHandlePWMAxis(pInfo, number);
} else if (priv->axis[number].type == JSTK_TYPE_BYVALUE) {
- jstkStartAxisTimer(local, number);
+ jstkStartAxisTimer(pInfo, number);
}
break;
}
@@ -328,7 +328,7 @@ jstkDeviceControlProc(DeviceIntPtr pJstk,
int what)
{
int i;
- LocalDevicePtr local = (LocalDevicePtr)pJstk->public.devicePrivate;
+ InputInfoPtr pInfo = (InputInfoPtr)pJstk->public.devicePrivate;
JoystickDevPtr priv = (JoystickDevPtr)XI_PRIVATE(pJstk);
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
Atom btn_labels[BUTTONMAP_SIZE+1] = {0}; /* TODO: fillme */
@@ -382,7 +382,7 @@ jstkDeviceControlProc(DeviceIntPtr pJstk,
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
xf86GetMotionEvents,
#endif
- local->history_size,
+ pInfo->history_size,
Relative) == FALSE) {
ErrorF("unable to allocate Valuator class device\n");
return !Success;
@@ -422,7 +422,7 @@ jstkDeviceControlProc(DeviceIntPtr pJstk,
1); /* max_res */
}
/* allocate the motion history buffer if needed */
- xf86MotionHistoryAllocate(local);
+ xf86MotionHistoryAllocate(pInfo);
}
@@ -449,8 +449,8 @@ jstkDeviceControlProc(DeviceIntPtr pJstk,
if (jstkOpenDevice(priv, FALSE) != -1) {
pJstk->public.on = TRUE;
- local->fd = priv->fd;
- AddEnabledDevice(local->fd);
+ pInfo->fd = priv->fd;
+ AddEnabledDevice(pInfo->fd);
} else return !Success;
break;
@@ -472,9 +472,9 @@ jstkDeviceControlProc(DeviceIntPtr pJstk,
TimerCancel(priv->axis[i].timer);
}
- if (local->fd >= 0)
- RemoveEnabledDevice(local->fd);
- local->fd = -1;
+ if (pInfo->fd >= 0)
+ RemoveEnabledDevice(pInfo->fd);
+ pInfo->fd = -1;
if (priv->close_proc)
priv->close_proc(priv);
pJstk->public.on = FALSE;
@@ -513,35 +513,35 @@ _X_EXPORT InputDriverRec JSTK_KEYBOARD = {
static InputInfoPtr
jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
{
- LocalDevicePtr local = NULL;
+ InputInfoPtr pInfo = NULL;
JoystickDevPtr priv = NULL;
char *s;
int i, j;
- local = xf86AllocateInput(drv, 0);
- if (!local) {
+ pInfo = xf86AllocateInput(drv, 0);
+ if (!pInfo) {
goto SetupProc_fail;
}
- local->private = (JoystickDevPtr)malloc(sizeof(JoystickDevRec));
- priv = (JoystickDevPtr)local->private;
-
- local->name = dev->identifier;
- local->flags = XI86_POINTER_CAPABLE;
- local->flags |= XI86_SEND_DRAG_EVENTS;
- local->device_control = jstkDeviceControlProc;
- local->read_input = jstkReadProc;
- local->close_proc = NULL;
- local->control_proc = NULL;
- local->switch_mode = NULL;
- local->conversion_proc = jstkConvertProc;
- local->fd = -1;
- local->dev = NULL;
- local->private = priv;
- local->type_name = XI_JOYSTICK;
- local->history_size = 0;
- local->always_core_feedback = NULL;
- local->conf_idev = dev;
+ pInfo->private = (JoystickDevPtr)malloc(sizeof(JoystickDevRec));
+ priv = (JoystickDevPtr)pInfo->private;
+
+ pInfo->name = dev->identifier;
+ pInfo->flags = XI86_POINTER_CAPABLE;
+ pInfo->flags |= XI86_SEND_DRAG_EVENTS;
+ pInfo->device_control = jstkDeviceControlProc;
+ pInfo->read_input = jstkReadProc;
+ pInfo->close_proc = NULL;
+ pInfo->control_proc = NULL;
+ pInfo->switch_mode = NULL;
+ pInfo->conversion_proc = jstkConvertProc;
+ pInfo->fd = -1;
+ pInfo->dev = NULL;
+ pInfo->private = priv;
+ pInfo->type_name = XI_JOYSTICK;
+ pInfo->history_size = 0;
+ pInfo->always_core_feedback = NULL;
+ pInfo->conf_idev = dev;
priv->fd = -1;
priv->open_proc = NULL;
@@ -614,8 +614,8 @@ jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
priv->axis[5].type = JSTK_TYPE_ACCELERATED;
priv->axis[5].mapping = JSTK_MAPPING_Y;
- xf86CollectInputOptions(local, NULL, NULL);
- xf86OptionListReport(local->options);
+ xf86CollectInputOptions(pInfo, NULL, NULL);
+ xf86OptionListReport(pInfo->options);
/* Joystick device is mandatory */
priv->device = xf86SetStrOption(dev->commonOptions, "Device", NULL);
@@ -623,22 +623,22 @@ jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
priv->device = xf86SetStrOption(dev->commonOptions, "Path", NULL);
if (!priv->device) {
- xf86Msg (X_ERROR, "%s: No Device specified.\n", local->name);
+ xf86Msg (X_ERROR, "%s: No Device specified.\n", pInfo->name);
goto SetupProc_fail;
}
- xf86ProcessCommonOptions(local, local->options);
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
#if DEBUG
debug_level = xf86SetIntOption(dev->commonOptions, "DebugLevel", 0);
if (debug_level > 0) {
xf86Msg(X_CONFIG, "%s: debug level set to %d\n",
- local->name, debug_level);
+ pInfo->name, debug_level);
}
#else
if (xf86SetIntOption(dev->commonOptions, "DebugLevel", 0) != 0) {
xf86Msg(X_WARNING, "%s: DebugLevel: Compiled without debugging support!\n",
- local->name);
+ pInfo->name);
}
#endif
@@ -647,7 +647,7 @@ jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
int delay, rate;
if (sscanf(s, "%d %d", &delay, &rate) != 2) {
xf86Msg(X_ERROR, "%s: \"%s\" is not a valid AutoRepeat value",
- local->name, s);
+ pInfo->name, s);
} else {
priv->repeat_delay = delay;
if (rate != 0)
@@ -688,7 +688,7 @@ jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
sprintf(p,"MapButton%d",i+1);
s = xf86SetStrOption(dev->commonOptions, p, NULL);
if (s != NULL) {
- jstkParseButtonOption(s, priv, i, local->name);
+ jstkParseButtonOption(s, priv, i, pInfo->name);
}
DBG(1, xf86Msg(X_CONFIG, "Button %d mapped to %d\n", i+1,
priv->button[i].mapping));
@@ -700,7 +700,7 @@ jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
sprintf(p,"MapAxis%d",i+1);
s = xf86SetStrOption(dev->commonOptions, p, NULL);
if (s != NULL) {
- jstkParseAxisOption(s, priv, &priv->axis[i], local->name);
+ jstkParseAxisOption(s, priv, &priv->axis[i], pInfo->name);
}
DBG(1, xf86Msg(X_CONFIG,
"Axis %d type is %d, mapped to %d, amplify=%.3f\n", i+1,
@@ -710,22 +710,22 @@ jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
}
/* return the LocalDevice */
- local->flags |= XI86_CONFIGURED;
+ pInfo->flags |= XI86_CONFIGURED;
priv->keyboard_device = jstkKeyboardPreInit(&JSTK_KEYBOARD, dev, flags);
if (priv->keyboard_device) {
priv->keyboard_device->private = priv;
}
- return (local);
+ return (pInfo);
SetupProc_fail:
if (priv)
free(priv);
- if (local)
- local->private = NULL;
+ if (pInfo)
+ pInfo->private = NULL;
return NULL;
-/* return (local); */ /* Makes X segfault on error */
+/* return (pInfo); */ /* Makes X segfault on error */
}
@@ -742,10 +742,10 @@ SetupProc_fail:
static void
jstkCoreUnInit(InputDriverPtr drv,
- LocalDevicePtr local,
+ InputInfoPtr pInfo,
int flags)
{
- JoystickDevPtr device = (JoystickDevPtr) local->private;
+ JoystickDevPtr device = (JoystickDevPtr) pInfo->private;
if (device->keyboard_device != NULL)
{
@@ -754,8 +754,8 @@ jstkCoreUnInit(InputDriverPtr drv,
}
free (device);
- local->private = NULL;
- xf86DeleteInput(local, 0);
+ pInfo->private = NULL;
+ xf86DeleteInput(pInfo, 0);
}
diff --git a/src/jstk.h b/src/jstk.h
index 78a1f83..37e9b09 100644
--- a/src/jstk.h
+++ b/src/jstk.h
@@ -117,7 +117,7 @@ typedef struct _JoystickDevRec {
jstkReadDataProc read_proc; /* Callback for reading data from the backend */
void *devicedata; /* Extra platform device dependend data */
char *device; /* Name of the device */
- LocalDevicePtr keyboard_device; /* Slave device for keyboard events */
+ InputInfoPtr keyboard_device; /* Slave device for keyboard events */
OsTimerPtr timer; /* Timer for axis movement */
Bool timerrunning;
diff --git a/src/jstk_axis.c b/src/jstk_axis.c
index dc648f9..7bea816 100644
--- a/src/jstk_axis.c
+++ b/src/jstk_axis.c
@@ -267,7 +267,7 @@ jstkAxisTimer(OsTimerPtr timer,
***********************************************************************
*/
void
-jstkStartAxisTimer(LocalDevicePtr device, int number)
+jstkStartAxisTimer(InputInfoPtr device, int number)
{
int pixel;
JoystickDevPtr priv = device->private;
@@ -299,7 +299,7 @@ jstkStartAxisTimer(LocalDevicePtr device, int number)
*/
void
-jstkStartButtonAxisTimer(LocalDevicePtr device, int number)
+jstkStartButtonAxisTimer(InputInfoPtr device, int number)
{
int pixel;
JoystickDevPtr priv = device->private;
@@ -339,7 +339,7 @@ jstkStartButtonAxisTimer(LocalDevicePtr device, int number)
***********************************************************************
*/
void
-jstkHandleAbsoluteAxis(LocalDevicePtr device, int number)
+jstkHandleAbsoluteAxis(InputInfoPtr device, int number)
{
JoystickDevPtr priv = device->private;
int i,x,y;
@@ -536,7 +536,7 @@ jstkPWMAxisTimer(OsTimerPtr timer,
***********************************************************************
*/
void
-jstkHandlePWMAxis(LocalDevicePtr device, int number)
+jstkHandlePWMAxis(InputInfoPtr device, int number)
{
JoystickDevPtr priv = device->private;
if (priv->axis[number].timerrunning) return;
diff --git a/src/jstk_axis.h b/src/jstk_axis.h
index 028c65f..0d672db 100644
--- a/src/jstk_axis.h
+++ b/src/jstk_axis.h
@@ -24,9 +24,9 @@
#ifndef _XF86JSTK_AXIS_H_INCLUDED_
#define _XF86JSTK_AXIS_H_INCLUDED_
-void jstkStartAxisTimer(LocalDevicePtr device, int number);
-void jstkStartButtonAxisTimer(LocalDevicePtr device, int number);
-void jstkHandleAbsoluteAxis(LocalDevicePtr device, int number);
-void jstkHandlePWMAxis(LocalDevicePtr device, int number);
+void jstkStartAxisTimer(InputInfoPtr device, int number);
+void jstkStartButtonAxisTimer(InputInfoPtr device, int number);
+void jstkHandleAbsoluteAxis(InputInfoPtr device, int number);
+void jstkHandlePWMAxis(InputInfoPtr device, int number);
#endif
diff --git a/src/jstk_key.c b/src/jstk_key.c
index 35b8928..57d60fe 100644
--- a/src/jstk_key.c
+++ b/src/jstk_key.c
@@ -418,7 +418,7 @@ jstkInitKeys(DeviceIntPtr pJstk, JoystickDevPtr priv)
***************************************************************************
*/
void
-jstkGenerateKeys(LocalDevicePtr device, KEYSCANCODES keys, char pressed)
+jstkGenerateKeys(InputInfoPtr device, KEYSCANCODES keys, char pressed)
{
int i;
unsigned int k;
@@ -497,12 +497,12 @@ jstkKeyboardDeviceControlProc(DeviceIntPtr dev,
InputInfoPtr
jstkKeyboardPreInit(InputDriverPtr drv, IDevPtr _dev, int flags)
{
- LocalDevicePtr local = NULL;
+ InputInfoPtr pInfo = NULL;
IDevPtr dev = NULL;
char name[512] = {0};
- local = xf86AllocateInput(drv, 0);
- if (!local) {
+ pInfo = xf86AllocateInput(drv, 0);
+ if (!pInfo) {
goto SetupProc_fail;
}
@@ -514,35 +514,35 @@ jstkKeyboardPreInit(InputDriverPtr drv, IDevPtr _dev, int flags)
dev->commonOptions = (pointer)xf86optionListDup(_dev->commonOptions);
dev->extraOptions = (pointer)xf86optionListDup(_dev->extraOptions);
- local->name = dev->identifier;
- local->flags = XI86_KEYBOARD_CAPABLE;
- local->device_control = jstkKeyboardDeviceControlProc;
- local->read_input = NULL;
- local->close_proc = NULL;
- local->control_proc = NULL;
- local->switch_mode = NULL;
- local->conversion_proc = NULL;
- local->fd = -1;
- local->dev = NULL;
- local->private = NULL;
- local->type_name = XI_JOYSTICK;
- local->history_size = 0;
- local->always_core_feedback = 0;
- local->conf_idev = dev;
-
- xf86CollectInputOptions(local, NULL, NULL);
- xf86OptionListReport(local->options);
- xf86ProcessCommonOptions(local, local->options);
+ pInfo->name = dev->identifier;
+ pInfo->flags = XI86_KEYBOARD_CAPABLE;
+ pInfo->device_control = jstkKeyboardDeviceControlProc;
+ pInfo->read_input = NULL;
+ pInfo->close_proc = NULL;
+ pInfo->control_proc = NULL;
+ pInfo->switch_mode = NULL;
+ pInfo->conversion_proc = NULL;
+ pInfo->fd = -1;
+ pInfo->dev = NULL;
+ pInfo->private = NULL;
+ pInfo->type_name = XI_JOYSTICK;
+ pInfo->history_size = 0;
+ pInfo->always_core_feedback = 0;
+ pInfo->conf_idev = dev;
+
+ xf86CollectInputOptions(pInfo, NULL, NULL);
+ xf86OptionListReport(pInfo->options);
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
/* return the LocalDevice */
- local->flags |= XI86_CONFIGURED;
+ pInfo->flags |= XI86_CONFIGURED;
- return (local);
+ return (pInfo);
SetupProc_fail:
- if (local)
- local->private = NULL;
+ if (pInfo)
+ pInfo->private = NULL;
if (dev) {
if (dev->identifier) free(dev->identifier);
if (dev->driver) free(dev->driver);
@@ -563,15 +563,15 @@ SetupProc_fail:
*/
void
jstkKeyboardUnInit(InputDriverPtr drv,
- LocalDevicePtr local,
+ InputInfoPtr pInfo,
int flags)
{
- JoystickDevPtr device = (JoystickDevPtr) local->private;
+ JoystickDevPtr device = (JoystickDevPtr) pInfo->private;
DBG(2, ErrorF("jstkKeyboardUnInit.\n"));
device->keyboard_device = NULL;
- local->private = NULL;
+ pInfo->private = NULL;
- xf86DeleteInput(local, 0);
+ xf86DeleteInput(pInfo, 0);
}
diff --git a/src/jstk_key.h b/src/jstk_key.h
index 1791c35..01327f6 100644
--- a/src/jstk_key.h
+++ b/src/jstk_key.h
@@ -25,9 +25,9 @@
#ifndef __JSTK_KEY_H_INCLUDED__
#define __JSTK_KEY_H_INCLUDED__
-void jstkGenerateKeys(LocalDevicePtr device, KEYSCANCODES keys, char pressed);
+void jstkGenerateKeys(InputInfoPtr device, KEYSCANCODES keys, char pressed);
InputInfoPtr jstkKeyboardPreInit(InputDriverPtr drv, IDevPtr dev, int flags);
-void jstkKeyboardUnInit(InputDriverPtr drv, LocalDevicePtr local, int flags);
+void jstkKeyboardUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
#endif
--
1.7.3.3
More information about the xorg-devel
mailing list