--- rdesktop-1.1.0/kbcodes.h	Thu Jan  1 10:00:00 1970
+++ rdesktop-1.1.0-osx/kbcodes.h	Tue Dec 25 14:45:51 2001
@@ -0,0 +1,72 @@
+// kbcodes.h for Mac OSX
+// David Boone <dave@iboone.net>
+// Nov. 30, 2001
+
+unsigned long kbcodes[][2]={
+	{0x3a,0x29},	// ~
+	{0x1a,0x2},	// 1
+	{0x1b,0x3},
+	{0x1c,0x4},
+	{0x1d,0x5},
+	{0x1f,0x6},
+	{0x1e,0x7},
+	{0x22,0x8},
+	{0x24,0x9},
+	{0x21,0xa},
+	{0x25,0xb},	// 0
+	{0x23,0xc},
+	{0x20,0xd},
+	{0x3b,0xe},	// backspace
+	{0x38,0xf},	// tab
+	{0x14,0x10},	// q
+	{0x15,0x11},
+	{0x16,0x12},
+	{0x17,0x13},
+	{0x19,0x14},
+	{0x18,0x15},
+	{0x28,0x16},
+	{0x2a,0x17},
+	{0x27,0x18},
+	{0x2b,0x19},	// p
+	{0x29,0x29},
+	{0x26,0x26},
+	{0x32,0x2b},	// \
+	{0x41,0x41},	// caps lock
+	{0x8,0x1e},	// a
+	{0x9,0x1f},
+	{0xa,0x20},
+	{0xb,0x21},
+	{0xd,0x22},
+	{0xc,0x23},
+	{0x2e,0x24},
+	{0x30,0x25},
+	{0x2d,0x26},
+	{0x31,0x27},
+	{0x2f,0x28},	// '
+	{0x2c,0x1c},	// return
+	{0x40,0x2a},	// shift
+	{0xe,0x2c},	// z
+	{0xf,0x2d},
+	{0x10,0x2e},
+	{0x11,0x2f},
+	{0x13,0x30},
+	{0x35,0x31},
+	{0x36,0x32},
+	{0x33,0x33},
+	{0x37,0x34},
+	{0x34,0x35},	// /
+	{0x42,0x38},	// alt
+	{0x3c,0x1c},	// enter
+	{0x43,0x37},	// ctrl
+	{0x7b,0xc7},	// home
+	{0x7f,0xcf},	// end
+	{0x7c,0xc9},	// pg up
+	{0x81,0xd1},	// pg down
+	{0x83, 0xcb},	// left
+	{0x84, 0xcd},	// right
+	{0x85, 0xd0},	// down
+	{0x86, 0xc8},	// up
+//	{0x3f, 0xdb},	// apple-windows key
+	{0,0}
+};
+
diff -urN rdesktop-1.1.0/rdesktop.1 rdesktop-1.1.0-osx/rdesktop.1
--- rdesktop-1.1.0/rdesktop.1	Thu Jan  1 10:00:00 1970
+++ rdesktop-1.1.0-osx/rdesktop.1	Tue Dec 25 15:21:27 2001
@@ -0,0 +1,167 @@
+.TH RDESKTOP 1 "June 2001" "Manual page for rdesktop"
+.\"
+.\" 5th January 2001
+.\" Man page author:
+.\"    Hugo Trippaers <spark@ision.nl>
+.\"
+.SH NAME
+.I rdesktop
+\- terminal server client for Windows NT4 and Windows 2000
+.SH SYNOPSIS
+.B rdesktop
+\-n <hostname> [options] server
+.br
+.SH NOTE
+this man page documents an older version of rdesktop. some options may not
+be documented here, may no longer exist, or may behave differently. in
+particular, the keycode options may not work as expected until 1.1.1.
+.SH DESCRIPTION
+.I rdesktop
+acts as a window terminal services client for Windows NT terminal servers and Windows 2000 terminal services either in administration or licenced mode. rdesktop implements the RDP version 4 protcol as used by Windows NT4 Terminalserver. Various mailinglist members wrote patches for rdesktop which implement RDP version 5. RDP 5 is used by Windows 2000 Terminal Services. At this time the patches are not merged in the main codebase but distributed seperately. See the links section for URLS.
+.SH OPTIONS
+.TP
+.BR "-u --user"
+The username for authentication on the terminal server, together with -p this can be used for autologon. On win2k the username is prefilled on the username box.
+.TP
+.BR "-d --domain"
+The domain to to which the user belongs. Use -u user@domain for win2k servers.
+.TP
+.BR "-s --shell"
+The startup shell for the user. Use this to force the user to start a specific shell of program after startup.
+.TP
+.BR "-c --workingdir"
+The current working directory for the user. Often used in combination with -s to setup a fixed environment for the user after logon.
+.TP
+.BR "-p --password"
+The password to authenticate with, used in combination with -u for autologon. WARNING: the -p <password> option will be visible to all users when then use tools like ps. Use -p - to make rdesktop request a password at startup.
+.TP
+.BR "-n --clientname"
+The name of the current machine rdesktop is running on. Usually the hostname (without the domain).
+.TP
+.BR "-k --keycode"
+The keyboard layout for the rdesktop session. i.e. us, is or nl
+.TP
+.BR "-K --vmkeys"
+By default the keybindings of the windowmanager will be ignored when the rdesktop window is in focus. Use this setting to keep the windowmanager keybindings.
+.TP
+.BR "-F --fullscreen"
+Enable fullscreen mode. The -w and -h flag will be ignored when using -f, rdesktop will get the current height and width from the current desktop.
+.TP
+.BR "-D --bpp"
+Rdesktop should detect the default screen depth, and try and run on that. The -D switch is only there so that the user can override the default bits-per-pixel setting.
+.TP
+.BR "-t --port"
+This option is used to make rdesktop connect to another rdp port on the remote machine. The default is 3389 as used by W2K and NT4 Terminal Server.
+.TP
+.BR "-T --bs"
+This option selects the backing-store method. The options are x,p and n.
+.TP
+.BR "  --bs x"
+Use the Xservers backing-store, but no internal pixmap. If the Xserver does not provide a backing-store none will be used at all, this acts as the --bs n switch. This method is the fastest since the Xserver can do optimizations in the hardware. 
+.TP
+.BR "  --bs n"
+No backingstore. This is slow but saves some memory.
+.TP
+.BR "  --bs p"
+This is the default setting, use an internal pixmap.
+.TP
+.BR "-e --no-enc"
+Do not use encryption, this is only for people who are not allowed to use encryption in Windows products. If you live in France you probably need this switch.
+.TP
+.BR "-l --no-license"
+Do not request license. This flag is not used when connecting to Windows 2000 Terminal Services.
+.TP
+.BR "-v --privcolmap"
+Use a private color map, this is useful when running X in 8bpp mode.
+.TP
+.BR "\-4 \-\-nt4tsc"
+Enable NT4 compatibility mode, this might be needed to connect to NT4 Terminal Servers.
+.TP
+.BR "\-N \-\-new\-kbcode"
+If you're not using a pc keyboard this may fix some of your key problems. This option should be used together with the \-k option.
+.TP
+.BR "\-V \-\-VNC"
+use a VNC viewer.
+.TP
+.BR "--no-bitmapcache"
+Force bitmap updates.
+.TP
+.BR "--no-bitmapcomp"
+Disable bitmap compression.
+.TP
+.BR "--no-desktopcache"
+Disable the use of the desktop cache.
+.TP
+.BR "--no-motionevents"
+Disable the sending of motion events.
+.TP
+.BR "--no-systembeep"
+Do not forward the system beep from the terminal session to the Xserver.
+.TP
+.SH EXAMPLES
+.PP
+.br
+Connect to a Windows 2000 Server called asp from a box called tux.
+.br
+\fI% rdesktop \-n tux asp.mydomain.com
+.PP
+.br
+Connect to a Windows 2000 Server called asp and automagically start Word. Rdesktop will request a password before starting the session.
+.br
+\fI% rdesktop -n tux -u worduser -p - -s winword.exe asp.mydomain.com
+.br
+.PP
+.br
+Connect to a Windows NT4 Terminal server
+.br
+\fI% rdesktop -n tux -4 terminal.mydomain.com
+.br
+.PP
+.br
+\fI% rdesktop -n tux -u aspuser@asp.mydomain.com -p - -P 90 asp.mydomain.com
+.br
+.PP
+.SH "RETURN VALUES"
+None are defined (yet)
+.SH LINKS
+Main website of rdesktop
+.br
+\fIhttp://www.rdesktop.org
+.LP
+The unified patch can be found here
+.br
+\fIhttp://bibl4.oru.se/projects/rdesktop
+.LP
+The mailinglist
+.br
+rdesktop@cifs.org
+.LP
+.SH BUGS
+Probably too many to list here. We suggest you visit the website at http://www.rdesktop.org and take a look at the mailinglist archives to find out about the latest news, bugs and fixes.
+.SH VERSION
+This manual page documents version 1.0.0/patch 19-4-2
+.SH AUTHOR
+rdesktop is written by Matt Chapman 
+.br
+<matthewc@cse.unsw.edu.au>
+.LP
+unified patch by Peter Bystrom 
+.br
+<peter.bystrom@ub.oru.se>
+.LP
+debian and fink packages by Sam Johnston
+.br
+<samj@debian.org>
+.LP
+manual page by Hugo Trippaers 
+.br
+<spark@ision.nl>
+.br
+.SH THANKS
+Thanks to all the mailinglist members for their contributions to rdesktop.
+.PP
+
+
+
+
+
diff -urN rdesktop-1.1.0/xwin.c rdesktop-1.1.0-osx/xwin.c
--- rdesktop-1.1.0/xwin.c	Sun Sep 16 00:30:44 2001
+++ rdesktop-1.1.0-osx/xwin.c	Tue Dec 25 14:46:22 2001
@@ -23,6 +23,7 @@
 #include <time.h>
 #include <errno.h>
 #include "rdesktop.h"
+#include "kbcodes.h"
 
 extern int width;
 extern int height;
@@ -315,54 +316,13 @@
 static uint8
 xwin_translate_key(unsigned long key)
 {
-	DEBUG(("KEY(code=0x%lx)\n", key));
-
-	if ((key > 8) && (key <= 0x60))
-		return (key - 8);
-
-	switch (key)
-	{
-		case 0x61:	/* home */
-			return 0x47 | 0x80;
-		case 0x62:	/* up arrow */
-			return 0x48 | 0x80;
-		case 0x63:	/* page up */
-			return 0x49 | 0x80;
-		case 0x64:	/* left arrow */
-			return 0x4b | 0x80;
-		case 0x66:	/* right arrow */
-			return 0x4d | 0x80;
-		case 0x67:	/* end */
-			return 0x4f | 0x80;
-		case 0x68:	/* down arrow */
-			return 0x50 | 0x80;
-		case 0x69:	/* page down */
-			return 0x51 | 0x80;
-		case 0x6a:	/* insert */
-			return 0x52 | 0x80;
-		case 0x6b:	/* delete */
-			return 0x53 | 0x80;
-		case 0x6c:	/* keypad enter */
-			return 0x1c | 0x80;
-		case 0x6d:	/* right ctrl */
-			return 0x1d | 0x80;
-		case 0x6f:	/* ctrl - print screen */
-			return 0x37 | 0x80;
-		case 0x70:	/* keypad '/' */
-			return 0x35 | 0x80;
-		case 0x71:	/* right alt */
-			return 0x38 | 0x80;
-		case 0x72:	/* ctrl break */
-			return 0x46 | 0x80;
-		case 0x73:	/* left window key */
-			return 0xff;	/* real scancode is 5b */
-		case 0x74:	/* right window key */
-			return 0xff;	/* real scancode is 5c */
-		case 0x75:	/* menu key */
-			return 0x5d | 0x80;
+	int x = 0;
+	while (kbcodes[x][0] != 0) {
+		if (kbcodes[x][0] == key)
+			return (kbcodes[x][1]);
+		x++;
 	}
-
-	return 0;
+	return key;
 }
 
 static uint16
