[PATCH 3/6] xserver: DeleteInputDeviceRequest introduction

Magnus Vigerlöf Magnus.Vigerlof at home.se
Wed Mar 28 15:07:51 PDT 2007


DeleteInputDeviceRequest introduction

Added a new function on the same level as NewInputDeviceRequest for
de-initialization so the structures and function called in New* can be
reversed.

--
 Xi/stubs.c                     |   12 ++++++++++++
 config/config.c                |    2 +-
 hw/kdrive/src/kinput.c         |    9 +++++++--
 hw/xfree86/common/xf86Xinput.c |   20 ++++++++++++++++++++
 include/input.h                |    2 ++
 5 files changed, 42 insertions(+), 3 deletions(-)

--
diff --git a/Xi/stubs.c b/Xi/stubs.c
index e2ed1ce..d07b89e 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -230,3 +230,15 @@ NewInputDeviceRequest(InputOption *optio
 {
     return BadValue;
 }
+
+/****************************************************************************
+ *
+ * Caller: configRemoveDevice (and others)
+ *
+ * Remove the specified device previously added.
+ *
+ */
+void
+DeleteInputDeviceRequest(DeviceIntPtr dev)
+{
+}
diff --git a/config/config.c b/config/config.c
index 6c40143..02c2f23 100644
--- a/config/config.c
+++ b/config/config.c
@@ -212,7 +212,7 @@ configRemoveDevice(DBusMessage *message,
      * already been removed. */
     OsBlockSignals();
     ProcessInputEvents();
-    RemoveDevice(pDev);
+    DeleteInputDeviceRequest(pDev);
     OsReleaseSignals();
 
     return Success;
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 857f04f..2db102d 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1,8 +1,8 @@
 /*
  * Id: kinput.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
  *
- * Copyright  1999 Keith Packard
- * Copyright  2006 Nokia Corporation
+ * Copyright  1999 Keith Packard
+ * Copyright  2006 Nokia Corporation
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -2374,3 +2374,8 @@ NewInputDeviceRequest(InputOption *optio
 
     return Success;
 }
+
+void
+DeleteInputDeviceRequest(DeviceIntPtr pDev)
+{
+}
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index d02e47d..7ccca97 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -427,6 +427,26 @@ unwind:
     return rval;
 }
 
+void
+DeleteInputDeviceRequest(DeviceIntPtr pDev)
+{
+    LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate;
+    InputDriverPtr drv = pInfo->drv;
+    IDevRec *idev = pInfo->conf_idev;
+
+    RemoveDevice(pDev);
+
+    if(drv->UnInit)
+        drv->UnInit(drv, pInfo, 0);
+    else
+        xf86DeleteInput(pInfo, 0);
+
+    xfree(idev->driver);
+    xfree(idev->identifier);
+    xf86optionListFree(idev->commonOptions);
+    xfree(idev);
+}
+
 /* 
  * convenient functions to post events
  */
diff --git a/include/input.h b/include/input.h
index fc607d3..1e65709 100644
--- a/include/input.h
+++ b/include/input.h
@@ -446,6 +446,8 @@ extern DeviceIntPtr LookupDeviceIntRec(
 /* Implemented by the DDX. */
 extern int NewInputDeviceRequest(
     InputOption *options);
+extern void DeleteInputDeviceRequest(
+    DeviceIntPtr dev);
 
 extern void DDXRingBell(
     int volume,



More information about the xorg mailing list