summaryrefslogtreecommitdiff
path: root/source/in_evdev.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2010-07-03 16:01:48 +0000
committerAndrey Nazarov <skuller@skuller.net>2010-07-03 16:01:48 +0000
commit7a914ef872a436adcdb36d21ceddba6bb24eb993 (patch)
treedafc86024742e7bbced8ef897754beff5160f1ae /source/in_evdev.c
parent1acd69e9a128e4f3abf06b5ae97c968c87663864 (diff)
Yet another huge commit.
Implemented new error reporting framework based on errno and custom error codes. Converted filesystem code, image and model managers, BSP loader to use the new framework and report errors more accurately. Replaced fileHandle_t with qhandle_t. Removed INVALID_LENGTH definition. Killed USE_LOADBUF code. Defined FS_FileExists(Ex) macro, implemented FS_EasyOpenFile and FS_WriteFile helper functions. When testing for free screenshot slots, open the file with O_EXCL flag to avoid race conditions (works only on glibc yet). Don't allow quake paths with high bits set. Don't tolerate any fatal errors encountered when searching for files and pass errors back to the caller. FS_Seek() now fails on files from packs instead of returning an invalid position. Fixed ‘mvdskip’ command not working properly. Avoid inefficient usage of MakeColor macro in image loading functions. Prevent memory leak in JPEG and PNG image functions after calling longjmp() by marking some local variables volatile. Added support for loading monochrome JPEG images. Fixed signed integer overflow in GetWavinfo(). Fixed missing return statement in BSP_LoadSurfEdges() causing out of range edge indices to be left uncaught. Fixed possible access to uninitialized memory in BSP_LoadLeafs() for maps with no leafs. Properly NUL terminate the buffer in SCR_ScoreDump_f(), also check for being in a level. Always free latched_string when cvar is set back to current value. Fixed a crash in ‘mvdplay’ command possible when demo file is invalid.
Diffstat (limited to 'source/in_evdev.c')
-rw-r--r--source/in_evdev.c45
1 files changed, 12 insertions, 33 deletions
diff --git a/source/in_evdev.c b/source/in_evdev.c
index 1085398..3550c09 100644
--- a/source/in_evdev.c
+++ b/source/in_evdev.c
@@ -30,7 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <unistd.h>
#include <fcntl.h>
#include <linux/input.h>
-#include <errno.h>
#include <SDL.h>
@@ -47,12 +46,7 @@ static struct {
#define MAX_EVENTS 64
#define EVENT_SIZE sizeof( struct input_event )
-/*
-===========
-Evdev_GetMouseEvents
-===========
-*/
-static void Evdev_GetMouseEvents( void ) {
+static void GetMouseEvents( void ) {
struct input_event ev[MAX_EVENTS];
int bytes, count;
int dx, dy;
@@ -109,7 +103,7 @@ static void Evdev_GetMouseEvents( void ) {
}
}
-static qboolean Evdev_GetMouseMotion( int *dx, int *dy ) {
+static qboolean GetMouseMotion( int *dx, int *dy ) {
if( !evdev.initialized || !evdev.grabbed ) {
return qfalse;
}
@@ -120,12 +114,7 @@ static qboolean Evdev_GetMouseMotion( int *dx, int *dy ) {
return qtrue;
}
-/*
-===========
-Evdev_ShutdownMouse
-===========
-*/
-static void Evdev_ShutdownMouse( void ) {
+static void ShutdownMouse( void ) {
if( !evdev.initialized ) {
return;
}
@@ -134,15 +123,10 @@ static void Evdev_ShutdownMouse( void ) {
memset( &evdev, 0, sizeof( evdev ) );
}
-/*
-===========
-Evdev_StartupMouse
-===========
-*/
-static qboolean Evdev_InitMouse( void ) {
+static qboolean InitMouse( void ) {
in_device = Cvar_Get( "in_device", "", 0 );
if( !in_device->string[0] ) {
- Com_EPrintf( "No input device specified\n" );
+ Com_WPrintf( "No evdev input device specified.\n" );
return qfalse;
}
@@ -156,18 +140,13 @@ static qboolean Evdev_InitMouse( void ) {
fcntl( evdev.fd, F_SETFL, fcntl( evdev.fd, F_GETFL, 0 ) | FNDELAY );
evdev.io = IO_Add( evdev.fd );
- Com_Printf( "Event interface initialized.\n" );
+ Com_Printf( "Evdev interface initialized.\n" );
evdev.initialized = qtrue;
return qtrue;
}
-/*
-===========
-Evdev_GrabMouse
-===========
-*/
-static void Evdev_GrabMouse( grab_t grab ) {
+static void GrabMouse( grab_t grab ) {
if( !evdev.initialized ) {
return;
}
@@ -206,11 +185,11 @@ DI_FillAPI
@@@@@@@@@@@@@@@@@@@
*/
void DI_FillAPI( inputAPI_t *api ) {
- api->Init = Evdev_InitMouse;
- api->Shutdown = Evdev_ShutdownMouse;
- api->Grab = Evdev_GrabMouse;
- api->GetEvents = Evdev_GetMouseEvents;
- api->GetMotion = Evdev_GetMouseMotion;
+ api->Init = InitMouse;
+ api->Shutdown = ShutdownMouse;
+ api->Grab = GrabMouse;
+ api->GetEvents = GetMouseEvents;
+ api->GetMotion = GetMouseMotion;
}