Update ManyMouse lib to latest SVN.

This commit is contained in:
n-a-c-h
2006-03-25 18:06:21 +00:00
parent 67ed60d2c4
commit 88a9e638e6
4 changed files with 139 additions and 51 deletions

View File

@@ -1,10 +1,32 @@
/*
* Support for Linux evdevs...the /dev/input/event* devices.
*
* Please see the file LICENSE in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
Copyright (c) 2003-2006 Ryan C. Gordon and others.
http://icculus.org/manymouse/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in a
product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Ryan C. Gordon <icculus@icculus.org>
*/
//Support for Linux evdevs...the /dev/input/event* devices.
#include "mm.h"
#ifdef __linux__
@@ -21,8 +43,6 @@
#include <linux/input.h> /* evdev interface... */
#include "mm.h"
#define test_bit(array, bit) (array[bit/8] & (1<<(bit%8)))
/* linux allows 32 evdev nodes currently. */
@@ -256,7 +276,7 @@ static int linux_evdev_init(void)
dirp = opendir("/dev/input");
if (!dirp)
return 0;
return -1;
while ((dent = readdir(dirp)) != NULL)
{
@@ -322,6 +342,14 @@ static int linux_evdev_poll(ManyMouseEvent *event)
return(0); /* no new events */
} /* linux_evdev_poll */
#else
static int linux_evdev_init(void) { return(-1); }
static void linux_evdev_quit(void) {}
static const char *linux_evdev_name(unsigned int index) { return(0); }
static int linux_evdev_poll(ManyMouseEvent *event) { return(0); }
#endif /* defined __linux__ */
ManyMouseDriver ManyMouseDriver_evdev =
{
@@ -331,7 +359,4 @@ ManyMouseDriver ManyMouseDriver_evdev =
linux_evdev_poll
};
#endif /* defined __linux__ */
/* end of linux_evdev.c ... */

View File

@@ -1,21 +1,40 @@
/*
* ManyMouse foundation code; apps talks to this and it talks to the lowlevel
* code for various platforms.
*
* Please see the file LICENSE in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
Copyright (c) 2003-2006 Ryan C. Gordon and others.
http://icculus.org/manymouse/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in a
product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Ryan C. Gordon <icculus@icculus.org>
*/
//ManyMouse foundation code; apps talks to this and it talks to the lowlevel
//code for various platforms.
#include <stdlib.h>
#include "mm.h"
static const char *manymouse_copyright =
"ManyMouse " MANYMOUSE_VERSION " (c) 2005 Ryan C. Gordon.";
"ManyMouse " MANYMOUSE_VERSION " (c) 2003-2006 Ryan C. Gordon.";
extern const ManyMouseDriver ManyMouseDriver_windows;
extern const ManyMouseDriver ManyMouseDriver_evdev;
extern const ManyMouseDriver ManyMouseDriver_mousedev;
extern const ManyMouseDriver ManyMouseDriver_hidmanager;
extern const ManyMouseDriver ManyMouseDriver_xinput;
@@ -24,14 +43,13 @@ static const ManyMouseDriver *mice_drivers[] =
#if SUPPORT_XINPUT
&ManyMouseDriver_xinput,
#endif
#ifdef __linux__
&ManyMouseDriver_evdev,
#endif
#if ((defined _WIN32) || defined(__CYGWIN__))
&ManyMouseDriver_windows,
#endif
#ifdef __linux__
&ManyMouseDriver_evdev,
/*&ManyMouseDriver_mousedev,*/
#endif
#if ( (defined(__MACH__)) && (defined(__APPLE__)) )
#if ((defined(__MACH__)) && (defined(__APPLE__)))
&ManyMouseDriver_hidmanager,
#endif
NULL
@@ -43,9 +61,10 @@ static const ManyMouseDriver *driver = NULL;
int ManyMouse_Init(void)
{
int i;
int retval = -1;
/* impossible test to keep manymouse_copyright linked into the binary. */
if ((char *) driver == (const char *) manymouse_copyright)
if (manymouse_copyright == NULL)
return(-1);
if (driver != NULL)
@@ -54,18 +73,18 @@ int ManyMouse_Init(void)
for (i = 0; mice_drivers[i]; i++)
{
int mice = mice_drivers[i]->init();
if (mice > retval)
retval = mice; /* may just move from "error" to "no mice found". */
if (mice > 0)
{
driver = mice_drivers[i];
return(mice);
break;
} /* if */
else
{
return(0);
}
} /* for */
return(-1);
return(retval);
} /* ManyMouse_Init */
@@ -93,4 +112,3 @@ int ManyMouse_PollEvent(ManyMouseEvent *event)
} /* ManyMouse_PollEvent */
/* end of manymouse.c ... */

View File

@@ -1,10 +1,30 @@
/*
* ManyMouse main header. Include this from your app.
*
* Please see the file LICENSE in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
Copyright (c) 2003-2006 Ryan C. Gordon and others.
http://icculus.org/manymouse/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in a
product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Ryan C. Gordon <icculus@icculus.org>
*/
//ManyMouse main header. Include this from your app.
#ifndef _INCLUDE_MANYMOUSE_H_
#define _INCLUDE_MANYMOUSE_H_

View File

@@ -1,10 +1,32 @@
/*
* Support for Windows via the WM_INPUT message.
*
* Please see the file LICENSE in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
Copyright (c) 2003-2006 Ryan C. Gordon and others.
http://icculus.org/manymouse/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in a
product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Ryan C. Gordon <icculus@icculus.org>
*/
//Support for Windows via the WM_INPUT message.
#include "mm.h"
#if (defined(_WIN32) || defined(__CYGWIN__))
@@ -22,8 +44,6 @@
#define WM_INPUT 0x00FF
#endif
#include "mm.h"
/* that should be enough, knock on wood. */
#define MAX_MICE 32
@@ -719,6 +739,14 @@ static int windows_wminput_poll(ManyMouseEvent *ev)
return(found);
} /* windows_wminput_poll */
#else
static int windows_wminput_init(void) { return(-1); }
static void windows_wminput_quit(void) {}
static const char *windows_wminput_name(unsigned int index) { return(0); }
static int windows_wminput_poll(ManyMouseEvent *event) { return(0); }
#endif /* ifdef WINDOWS blocker */
ManyMouseDriver ManyMouseDriver_windows =
{
@@ -728,7 +756,4 @@ ManyMouseDriver ManyMouseDriver_windows =
windows_wminput_poll
};
#endif /* ifdef WINDOWS blocker */
/* end of windows_wminput.c ... */