vboxmouse_15.c revision 537722c5594b7620f9fba3f6027c26100c4d6a46
/** @file
* VirtualBox X11 Guest Additions, mouse driver for X.Org server 1.5
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
* --------------------------------------------------------------------
*
* This code is based on evdev.c from X.Org with the following copyright
* and permission notice:
*
* Copyright © 2004-2008 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of Red Hat
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission. Red
* Hat makes no representations about the suitability of this software
* for any purpose. It is provided "as is" without express or implied
* warranty.
*
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Authors:
* Kristian Høgsberg (krh@redhat.com)
* Adam Jackson (ajax@redhat.com)
*/
#include <VBox/VBoxGuest.h>
#include <xf86.h>
#include <xf86Xinput.h>
#include <exevents.h>
#include <mipointer.h>
#include <xf86Module.h>
#include <errno.h>
#include <fcntl.h>
static void
{
/* The first test here is a workaround for an apparant bug in Xorg Server 1.5 */
/* send absolute movement */
}
static int
{
#endif
return !Success;
/* Pretend we have buttons so the server accepts us as a pointing device. */
return !Success;
/* Tell the server about the range of axis values we report */
10000, 0, 10000);
10000, 0, 10000);
return Success;
}
static int
{
switch (what)
{
case DEVICE_INIT:
VbglR3Term();
return xrc;
}
break;
case DEVICE_ON:
break;
/* Tell the host that we want absolute co-ordinates */
if (!RT_SUCCESS(rc)) {
return !Success;
}
break;
case DEVICE_OFF:
break;
case DEVICE_CLOSE:
VbglR3Term();
break;
}
return Success;
}
static int
{
int rc = VbglR3Init();
if (!RT_SUCCESS(rc)) {
return !Success;
}
return Success;
}
static InputInfoPtr
{
const char *device;
return NULL;
/* Initialise the InputInfoRec. */
/* Unlike evdev, we set this unconditionally, as we don't handle keyboards. */
do {
}
xf86DeleteInput(pInfo, 0);
return NULL;
}
xf86DeleteInput(pInfo, 0);
return NULL;
}
return pInfo;
}
1,
"vboxmouse",
NULL,
NULL,
NULL,
0
};
static pointer
int *errmaj,
int *errmin)
{
return module;
}
static XF86ModuleVersionInfo VBoxVersionRec =
{
"vboxmouse",
"Sun Microsystems Inc.",
0, /* Missing from SDK: XORG_VERSION_CURRENT, */
1, 0, 0,
{0, 0, 0, 0}
};
{
};