[PATCH vmmouse 3/4] Move passthrough initialization out into a separate function.

Peter Hutterer peter.hutterer at who-t.net
Mon Nov 1 16:09:43 PDT 2010


No functional changes, just modularising a bit to make future changes
easier.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/vmmouse.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/vmmouse.c b/src/vmmouse.c
index 00960cc..2f66b67 100644
--- a/src/vmmouse.c
+++ b/src/vmmouse.c
@@ -217,6 +217,17 @@ static char reverseMap[32] = { 0,  4,  2,  6,  1,  5,  3,  7,
 
 #define reverseBits(map, b)	(((b) & ~0x0f) | map[(b) & 0x0f])
 
+static InputInfoPtr
+VMMouseInitPassthru(InputDriverPtr drv, IDevPtr dev, int flags)
+{
+   InputDriverRec *passthruMouse;
+   passthruMouse = (InputDriverRec *)LoaderSymbol("MOUSE");
+   if(passthruMouse != NULL){
+      return (passthruMouse->PreInit)(drv, dev, flags);
+   } else {
+      return NULL;
+   }
+}
 
 /*
  *----------------------------------------------------------------------
@@ -274,16 +285,9 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
        * vmmouse failed
        * Fall back to normal mouse module
        */
-      InputDriverRec *passthruMouse;
       xf86Msg(X_ERROR, "VMWARE(0): vmmouse enable failed\n");
-      passthruMouse = (InputDriverRec *)LoaderSymbol("MOUSE");
       free(mPriv);
-      if(passthruMouse != NULL){
-	 return (passthruMouse->PreInit)(drv, dev, flags);
-      } else {
-	 return NULL;
-      }
-
+      return VMMouseInitPassthru(drv, dev, flags);
    } else {
       /*
        * vmmouse is available
-- 
1.7.3.1



More information about the xorg-devel mailing list