summaryrefslogtreecommitdiff
path: root/src/unix
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2007-03-21 23:55:51 +0000
committerTim Angus <tim@ngus.net>2007-03-21 23:55:51 +0000
commitd899c25c571ed061bba9725cf7b35d492cc6e518 (patch)
tree25268c9b3e381d00c2885c1fec7a54f46f56d93b /src/unix
parentcb5b4648d45b3f078a6ae3da45707764ca46e241 (diff)
* ioq3-r1052 merge
Diffstat (limited to 'src/unix')
-rw-r--r--src/unix/linux_glimp.c4
-rw-r--r--src/unix/sdl_glimp.c33
-rw-r--r--src/unix/sdl_snd.c4
-rw-r--r--src/unix/unix_shared.c16
4 files changed, 48 insertions, 9 deletions
diff --git a/src/unix/linux_glimp.c b/src/unix/linux_glimp.c
index 36e3dc36..650c1c9b 100644
--- a/src/unix/linux_glimp.c
+++ b/src/unix/linux_glimp.c
@@ -200,8 +200,8 @@ static const char *Q_stristr( const char *s, const char *find)
static char *XLateKey(XKeyEvent *ev, int *key)
{
- static char buf[64];
- static char bufnomod[2];
+ static unsigned char buf[64];
+ static unsigned char bufnomod[2];
KeySym keysym;
int XLookupRet;
diff --git a/src/unix/sdl_glimp.c b/src/unix/sdl_glimp.c
index b2cc13a4..6fa5943b 100644
--- a/src/unix/sdl_glimp.c
+++ b/src/unix/sdl_glimp.c
@@ -10,7 +10,7 @@
* GPL release of Quake 3.
*
* Written by Ryan C. Gordon (icculus@icculus.org). Please refer to
- * http://icculus.org/quake3/ for the latest version of this code.
+ * http://ioquake3.org/ for the latest version of this code.
*
* Patches and comments are welcome at the above address.
*
@@ -226,6 +226,9 @@ static const char *XLateKey(SDL_keysym *keysym, int *key)
case SDLK_F10: *key = K_F10; break;
case SDLK_F11: *key = K_F11; break;
case SDLK_F12: *key = K_F12; break;
+ case SDLK_F13: *key = K_F13; break;
+ case SDLK_F14: *key = K_F14; break;
+ case SDLK_F15: *key = K_F15; break;
// bk001206 - from Ryan's Fakk2
case SDLK_BACKSPACE: *key = K_BACKSPACE; break; // ctrl-h
@@ -244,15 +247,35 @@ static const char *XLateKey(SDL_keysym *keysym, int *key)
case SDLK_RALT:
case SDLK_LALT: *key = K_ALT; break;
+ case SDLK_LSUPER:
+ case SDLK_RSUPER: *key = K_SUPER; break;
+
case SDLK_KP5: *key = K_KP_5; break;
case SDLK_INSERT: *key = K_INS; break;
case SDLK_KP0: *key = K_KP_INS; break;
- case SDLK_KP_MULTIPLY: *key = '*'; break;
+ case SDLK_KP_MULTIPLY: *key = K_KP_STAR; break;
case SDLK_KP_PLUS: *key = K_KP_PLUS; break;
case SDLK_KP_MINUS: *key = K_KP_MINUS; break;
case SDLK_KP_DIVIDE: *key = K_KP_SLASH; break;
- default: break;
+ case SDLK_MODE: *key = K_MODE; break;
+ case SDLK_COMPOSE: *key = K_COMPOSE; break;
+ case SDLK_HELP: *key = K_HELP; break;
+ case SDLK_PRINT: *key = K_PRINT; break;
+ case SDLK_SYSREQ: *key = K_SYSREQ; break;
+ case SDLK_BREAK: *key = K_BREAK; break;
+ case SDLK_MENU: *key = K_MENU; break;
+ case SDLK_POWER: *key = K_POWER; break;
+ case SDLK_EURO: *key = K_EURO; break;
+ case SDLK_UNDO: * key = K_UNDO; break;
+ case SDLK_SCROLLOCK: *key = K_SCROLLOCK; break;
+ case SDLK_NUMLOCK: *key = K_KP_NUMLOCK; break;
+ case SDLK_CAPSLOCK: *key = K_CAPSLOCK; break;
+
+ default:
+ if (keysym->sym >= SDLK_WORLD_0 && keysym->sym <= SDLK_WORLD_95)
+ *key = (keysym->sym - SDLK_WORLD_0) + K_WORLD_0;
+ break;
}
if( keysym->unicode <= 127 ) // maps to ASCII?
@@ -268,8 +291,8 @@ static const char *XLateKey(SDL_keysym *keysym, int *key)
//else if (ch >= 'A' && ch <= 'Z')
// ch = ch - 'A' + 'a';
- // tjw: translate K_BACKSPACE to ctrl-h for MACOS_X (others?)
- if (ch == K_BACKSPACE)
+ // translate K_BACKSPACE to ctrl-h for MACOS_X (others?)
+ if (ch == K_BACKSPACE && keysym->sym != SDLK_DELETE)
{
*key = 'h' - 'a' + 1;
buf[0] = *key;
diff --git a/src/unix/sdl_snd.c b/src/unix/sdl_snd.c
index c5c10cb4..8b0aaf06 100644
--- a/src/unix/sdl_snd.c
+++ b/src/unix/sdl_snd.c
@@ -14,7 +14,7 @@
* positional audio, compliments of OpenAL...
*
* Written by Ryan C. Gordon (icculus@icculus.org). Please refer to
- * http://icculus.org/quake3/ for the latest version of this code.
+ * http://ioquake3.org/ for the latest version of this code.
*
* Patches and comments are welcome at the above address.
*
@@ -187,7 +187,7 @@ static void print_audiospec(const char *str, const SDL_AudioSpec *spec)
if( fmt ) {
Com_Printf( " Format: %s\n", fmt );
} else {
- Com_Printf( " Format: " S_COLOR_RED "UNKNOWN\n", fmt );
+ Com_Printf( " Format: " S_COLOR_RED "UNKNOWN\n");
}
Com_Printf( " Freq: %d\n", (int) spec->freq );
diff --git a/src/unix/unix_shared.c b/src/unix/unix_shared.c
index f9fc9e0a..2c238ca7 100644
--- a/src/unix/unix_shared.c
+++ b/src/unix/unix_shared.c
@@ -175,6 +175,22 @@ char *strlwr (char *s) {
return s; // bk001204 - duh
}
+qboolean Sys_RandomBytes( byte *string, int len )
+{
+ FILE *fp;
+
+ fp = fopen( "/dev/urandom", "r" );
+ if( !fp )
+ return qfalse;
+
+ if( !fread( string, sizeof( byte ), len, fp ) ) {
+ fclose( fp );
+ return qfalse;
+ }
+ fclose( fp );
+ return qtrue;
+}
+
//============================================
#define MAX_FOUND_FILES 0x1000