[PATCH 1/3] Make NewInputDeviceRequest return the device data to the caller.

Remigiusz Marcinkiewicz enleth at enleth.com
Sun Feb 25 06:35:35 PST 2007


NewInputDeviceRequest redefined as:
extern int NewInputDeviceRequest(
    InputOption *options,
    DeviceIntPtr *pdev);
The caller passes a pointer to a DeviceIntPtr variable, NIDR() then assigns pInfo to the variable.
---
 Xi/stubs.c                     |    2 +-
 hw/kdrive/src/kinput.c         |    8 +++++++-
 hw/xfree86/common/xf86Xinput.c |    3 ++-
 include/input.h                |    3 ++-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Xi/stubs.c b/Xi/stubs.c
index e2ed1ce..4175718 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -226,7 +226,7 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr dev,
  *
  */
 int
-NewInputDeviceRequest(InputOption *options)
+NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
 {
     return BadValue;
 }
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 3bf6bad..f8f032b 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -2307,7 +2307,7 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev,
 }
 
 int
-NewInputDeviceRequest(InputOption *options)
+NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
 {
     InputOption *option = NULL;
     KdPointerInfo *pi = NULL;
@@ -2372,5 +2372,11 @@ NewInputDeviceRequest(InputOption *options)
         }
     }
 
+    if (pi) {
+        *pdev = pi->dixdev;
+    } else if(ki) {
+        *pdev = ki->dixdev;
+    }
+
     return Success;
 }
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 16e330d..414f8f5 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -308,7 +308,7 @@ AddOtherInputDevices()
 #endif
 
 int
-NewInputDeviceRequest (InputOption *options)
+NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
 {
     IDevRec *idev = NULL;
     InputDriverPtr drv = NULL;
@@ -379,6 +379,7 @@ NewInputDeviceRequest (InputOption *options)
     if (dev->inited && dev->startup)
         EnableDevice(dev);
 
+    *pdev = dev;
     return Success;
 }
 
diff --git a/include/input.h b/include/input.h
index fc607d3..7737aba 100644
--- a/include/input.h
+++ b/include/input.h
@@ -445,7 +445,8 @@ extern DeviceIntPtr LookupDeviceIntRec(
 
 /* Implemented by the DDX. */
 extern int NewInputDeviceRequest(
-    InputOption *options);
+    InputOption *options,
+    DeviceIntPtr *pdev);
 
 extern void DDXRingBell(
     int volume,
-- 
1.5.0.1




More information about the xorg mailing list