aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoricculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-08-31 16:38:05 +0000
committericculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-08-31 16:38:05 +0000
commitc434a6bac4189dc6195d83869003d71c55d4ba12 (patch)
tree663532a9a7b0969dbfca3cac0f9ca181c1831b20
parent5e05757505d894786d5970261668585a314a1a07 (diff)
downloadioquake3-aero-c434a6bac4189dc6195d83869003d71c55d4ba12.tar.gz
ioquake3-aero-c434a6bac4189dc6195d83869003d71c55d4ba12.zip
More SDL fixes:
- Console key works as it should, at least on QWERTY keyboards. Someone will have to check AZERTY keyboards for me. - Backspace key now works in text entry. - Mouse input is scaled 2x, like the X11 driver does. - Some basic logging so I know I'm using the SDL code and not the X11 code. git-svn-id: svn://svn.icculus.org/quake3/trunk@46 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--code/unix/linux_glimp_sdl.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/code/unix/linux_glimp_sdl.c b/code/unix/linux_glimp_sdl.c
index 3cbc864..bc49cef 100644
--- a/code/unix/linux_glimp_sdl.c
+++ b/code/unix/linux_glimp_sdl.c
@@ -165,12 +165,6 @@ static const char *XLateKey(SDL_keysym *keysym, int *key)
return buf;
}
- if (keysym->unicode == '~') // the console.
- {
- buf[0] = *key = '~';
- return buf;
- }
-
buf[0] = '\0';
switch (keysym->sym)
@@ -210,7 +204,7 @@ static const char *XLateKey(SDL_keysym *keysym, int *key)
// bk001206 - from Ryan's Fakk2
//case SDLK_BackSpace: *key = 8; break; // ctrl-h
- case SDLK_BACKSPACE: *key = K_BACKSPACE; break; // ctrl-h
+ case SDLK_BACKSPACE: *key = K_BACKSPACE; buf[0] = 8; break; // ctrl-h
case SDLK_KP_PERIOD: *key = K_KP_DEL; break;
case SDLK_DELETE: *key = K_DEL; break;
case SDLK_PAUSE: *key = K_PAUSE; break;
@@ -235,6 +229,9 @@ static const char *XLateKey(SDL_keysym *keysym, int *key)
case SDLK_KP_DIVIDE: *key = K_KP_SLASH; break;
case SDLK_SPACE: *key = K_SPACE; break;
+ // !!! FIXME: Console key...may not be accurate on all keyboards!
+ case SDLK_BACKQUOTE: *key = '~'; break;
+
default:
if (keysym->unicode <= 255) // maps to ASCII?
{
@@ -252,7 +249,7 @@ static const char *XLateKey(SDL_keysym *keysym, int *key)
break;
}
- return NULL;
+ return buf;
}
static void install_grabs(void)
@@ -319,7 +316,13 @@ static void HandleEvents(void)
case SDL_MOUSEMOTION:
if (mouse_active)
+ {
+ if (abs(e.motion.xrel) > 1)
+ e.motion.xrel *= 2;
+ if (abs(e.motion.yrel) > 1)
+ e.motion.yrel *= 2;
Sys_QueEvent( t, SE_MOUSE, e.motion.xrel, e.motion.yrel, 0, NULL );
+ }
break;
case SDL_MOUSEBUTTONDOWN:
@@ -489,11 +492,13 @@ static qboolean GLW_StartDriverAndSetMode( const char *drivername,
if (!SDL_WasInit(SDL_INIT_VIDEO))
{
+ ri.Printf( PRINT_ALL, "Calling SDL_Init(SDL_INIT_VIDEO)...\n");
if (SDL_Init(SDL_INIT_VIDEO) == -1)
{
ri.Printf( PRINT_ALL, "SDL_Init(SDL_INIT_VIDEO) failed: %s\n", SDL_GetError());
return qfalse;
}
+ ri.Printf( PRINT_ALL, "SDL_Init(SDL_INIT_VIDEO) passed.\n");
}
// don't ever bother going into fullscreen with a voodoo card
@@ -1286,11 +1291,13 @@ void IN_StartupJoystick( void )
if (!SDL_WasInit(SDL_INIT_JOYSTICK))
{
+ Com_Printf( PRINT_ALL, "Calling SDL_Init(SDL_INIT_JOYSTICK)...\n");
if (SDL_Init(SDL_INIT_JOYSTICK) == -1)
{
Com_Printf("SDL_Init(SDL_INIT_JOYSTICK) failed: %s\n", SDL_GetError());
return;
}
+ Com_Printf( PRINT_ALL, "SDL_Init(SDL_INIT_JOYSTICK) passed.\n");
}
total = SDL_NumJoysticks();