Update ManyMouse lib to latest SVN.
This commit is contained in:
@@ -1,10 +1,32 @@
|
|||||||
/*
|
/*
|
||||||
* Support for Linux evdevs...the /dev/input/event* devices.
|
Copyright (c) 2003-2006 Ryan C. Gordon and others.
|
||||||
*
|
|
||||||
* Please see the file LICENSE in the source's root directory.
|
http://icculus.org/manymouse/
|
||||||
*
|
|
||||||
* This file written by Ryan C. Gordon.
|
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__
|
#ifdef __linux__
|
||||||
|
|
||||||
@@ -21,8 +43,6 @@
|
|||||||
|
|
||||||
#include <linux/input.h> /* evdev interface... */
|
#include <linux/input.h> /* evdev interface... */
|
||||||
|
|
||||||
#include "mm.h"
|
|
||||||
|
|
||||||
#define test_bit(array, bit) (array[bit/8] & (1<<(bit%8)))
|
#define test_bit(array, bit) (array[bit/8] & (1<<(bit%8)))
|
||||||
|
|
||||||
/* linux allows 32 evdev nodes currently. */
|
/* linux allows 32 evdev nodes currently. */
|
||||||
@@ -256,7 +276,7 @@ static int linux_evdev_init(void)
|
|||||||
|
|
||||||
dirp = opendir("/dev/input");
|
dirp = opendir("/dev/input");
|
||||||
if (!dirp)
|
if (!dirp)
|
||||||
return 0;
|
return -1;
|
||||||
|
|
||||||
while ((dent = readdir(dirp)) != NULL)
|
while ((dent = readdir(dirp)) != NULL)
|
||||||
{
|
{
|
||||||
@@ -322,6 +342,14 @@ static int linux_evdev_poll(ManyMouseEvent *event)
|
|||||||
return(0); /* no new events */
|
return(0); /* no new events */
|
||||||
} /* linux_evdev_poll */
|
} /* 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 =
|
ManyMouseDriver ManyMouseDriver_evdev =
|
||||||
{
|
{
|
||||||
@@ -331,7 +359,4 @@ ManyMouseDriver ManyMouseDriver_evdev =
|
|||||||
linux_evdev_poll
|
linux_evdev_poll
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined __linux__ */
|
|
||||||
|
|
||||||
/* end of linux_evdev.c ... */
|
/* end of linux_evdev.c ... */
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,40 @@
|
|||||||
/*
|
/*
|
||||||
* ManyMouse foundation code; apps talks to this and it talks to the lowlevel
|
Copyright (c) 2003-2006 Ryan C. Gordon and others.
|
||||||
* code for various platforms.
|
|
||||||
*
|
http://icculus.org/manymouse/
|
||||||
* Please see the file LICENSE in the source's root directory.
|
|
||||||
*
|
This software is provided 'as-is', without any express or implied warranty.
|
||||||
* This file written by Ryan C. Gordon.
|
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 <stdlib.h>
|
||||||
#include "mm.h"
|
#include "mm.h"
|
||||||
|
|
||||||
static const char *manymouse_copyright =
|
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_windows;
|
||||||
extern const ManyMouseDriver ManyMouseDriver_evdev;
|
extern const ManyMouseDriver ManyMouseDriver_evdev;
|
||||||
extern const ManyMouseDriver ManyMouseDriver_mousedev;
|
|
||||||
extern const ManyMouseDriver ManyMouseDriver_hidmanager;
|
extern const ManyMouseDriver ManyMouseDriver_hidmanager;
|
||||||
extern const ManyMouseDriver ManyMouseDriver_xinput;
|
extern const ManyMouseDriver ManyMouseDriver_xinput;
|
||||||
|
|
||||||
@@ -24,14 +43,13 @@ static const ManyMouseDriver *mice_drivers[] =
|
|||||||
#if SUPPORT_XINPUT
|
#if SUPPORT_XINPUT
|
||||||
&ManyMouseDriver_xinput,
|
&ManyMouseDriver_xinput,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __linux__
|
||||||
|
&ManyMouseDriver_evdev,
|
||||||
|
#endif
|
||||||
#if ((defined _WIN32) || defined(__CYGWIN__))
|
#if ((defined _WIN32) || defined(__CYGWIN__))
|
||||||
&ManyMouseDriver_windows,
|
&ManyMouseDriver_windows,
|
||||||
#endif
|
#endif
|
||||||
#ifdef __linux__
|
#if ((defined(__MACH__)) && (defined(__APPLE__)))
|
||||||
&ManyMouseDriver_evdev,
|
|
||||||
/*&ManyMouseDriver_mousedev,*/
|
|
||||||
#endif
|
|
||||||
#if ( (defined(__MACH__)) && (defined(__APPLE__)) )
|
|
||||||
&ManyMouseDriver_hidmanager,
|
&ManyMouseDriver_hidmanager,
|
||||||
#endif
|
#endif
|
||||||
NULL
|
NULL
|
||||||
@@ -43,9 +61,10 @@ static const ManyMouseDriver *driver = NULL;
|
|||||||
int ManyMouse_Init(void)
|
int ManyMouse_Init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
/* impossible test to keep manymouse_copyright linked into the binary. */
|
/* impossible test to keep manymouse_copyright linked into the binary. */
|
||||||
if ((char *) driver == (const char *) manymouse_copyright)
|
if (manymouse_copyright == NULL)
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
if (driver != NULL)
|
if (driver != NULL)
|
||||||
@@ -54,18 +73,18 @@ int ManyMouse_Init(void)
|
|||||||
for (i = 0; mice_drivers[i]; i++)
|
for (i = 0; mice_drivers[i]; i++)
|
||||||
{
|
{
|
||||||
int mice = mice_drivers[i]->init();
|
int mice = mice_drivers[i]->init();
|
||||||
|
|
||||||
|
if (mice > retval)
|
||||||
|
retval = mice; /* may just move from "error" to "no mice found". */
|
||||||
|
|
||||||
if (mice > 0)
|
if (mice > 0)
|
||||||
{
|
{
|
||||||
driver = mice_drivers[i];
|
driver = mice_drivers[i];
|
||||||
return(mice);
|
break;
|
||||||
} /* if */
|
} /* if */
|
||||||
else
|
|
||||||
{
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
} /* for */
|
} /* for */
|
||||||
|
|
||||||
return(-1);
|
return(retval);
|
||||||
} /* ManyMouse_Init */
|
} /* ManyMouse_Init */
|
||||||
|
|
||||||
|
|
||||||
@@ -93,4 +112,3 @@ int ManyMouse_PollEvent(ManyMouseEvent *event)
|
|||||||
} /* ManyMouse_PollEvent */
|
} /* ManyMouse_PollEvent */
|
||||||
|
|
||||||
/* end of manymouse.c ... */
|
/* end of manymouse.c ... */
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
* ManyMouse main header. Include this from your app.
|
Copyright (c) 2003-2006 Ryan C. Gordon and others.
|
||||||
*
|
|
||||||
* Please see the file LICENSE in the source's root directory.
|
http://icculus.org/manymouse/
|
||||||
*
|
|
||||||
* This file written by Ryan C. Gordon.
|
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_
|
#ifndef _INCLUDE_MANYMOUSE_H_
|
||||||
#define _INCLUDE_MANYMOUSE_H_
|
#define _INCLUDE_MANYMOUSE_H_
|
||||||
|
|||||||
@@ -1,10 +1,32 @@
|
|||||||
/*
|
/*
|
||||||
* Support for Windows via the WM_INPUT message.
|
Copyright (c) 2003-2006 Ryan C. Gordon and others.
|
||||||
*
|
|
||||||
* Please see the file LICENSE in the source's root directory.
|
http://icculus.org/manymouse/
|
||||||
*
|
|
||||||
* This file written by Ryan C. Gordon.
|
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__))
|
#if (defined(_WIN32) || defined(__CYGWIN__))
|
||||||
|
|
||||||
@@ -22,8 +44,6 @@
|
|||||||
#define WM_INPUT 0x00FF
|
#define WM_INPUT 0x00FF
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mm.h"
|
|
||||||
|
|
||||||
/* that should be enough, knock on wood. */
|
/* that should be enough, knock on wood. */
|
||||||
#define MAX_MICE 32
|
#define MAX_MICE 32
|
||||||
|
|
||||||
@@ -719,6 +739,14 @@ static int windows_wminput_poll(ManyMouseEvent *ev)
|
|||||||
return(found);
|
return(found);
|
||||||
} /* windows_wminput_poll */
|
} /* 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 =
|
ManyMouseDriver ManyMouseDriver_windows =
|
||||||
{
|
{
|
||||||
@@ -728,7 +756,4 @@ ManyMouseDriver ManyMouseDriver_windows =
|
|||||||
windows_wminput_poll
|
windows_wminput_poll
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ifdef WINDOWS blocker */
|
|
||||||
|
|
||||||
/* end of windows_wminput.c ... */
|
/* end of windows_wminput.c ... */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user