diff -urN tuxpaint-0.9.21/Makefile tuxpaint-0.9.21-haiku/Makefile
--- tuxpaint-0.9.21/Makefile	2009-04-28 22:18:57.000000000 -0700
+++ tuxpaint-0.9.21-haiku/Makefile	2009-11-07 21:26:50.000000000 -0800
@@ -46,7 +46,7 @@
 		echo "$(1)"; \
 	fi ;)
 
-beos_RSRC_CMD:=xres -o tuxpaint src/tuxpaint.rsrc
+beos_RSRC_CMD:=rc src/tuxpaint.rdef && xres -o tuxpaint src/tuxpaint.rsrc
 RSRC_CMD:=$($(OS)_RSRC_CMD)
 
 beos_MIMESET_CMD:=mimeset -f tuxpaint
@@ -79,7 +79,7 @@
 
 windows_ARCH_LINKS:=-lintl $(PNG) -lwinspool -lshlwapi $(FRIBIDI_LIB)
 osx_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB)
-beos_ARCH_LINKS:="-lintl $(PNG) -lz -lbe -liconv $(FRIBIDI_LIB)"
+beos_ARCH_LINKS:="-lintl $(PNG) -lz -lbe -lnetwork -liconv $(FRIBIDI_LIB)"
 linux_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB)
 ARCH_LINKS:=$($(OS)_ARCH_LINKS)
 
@@ -92,11 +92,10 @@
 # Where things will go when ultimately installed:
 windows_PREFIX:=/usr/local
 osx_PREFIX:=/usr/local
-beos_PREFIX:=/boot/apps/Games/TuxPaint
+beos_PREFIX:=$(shell finddir B_APPS_DIRECTORY)/TuxPaint
 linux_PREFIX:=/usr/local
 PREFIX:=$($(OS)_PREFIX)
 
-
 # Root directory to place files when creating packages.
 # PKG_ROOT is the old name for this, and should be undefined.
 # "TuxPaint-1" is the OLPC XO name. Installing to ./ is bad!
@@ -137,6 +136,10 @@
   CONFDIR:=$(DESTDIR)$(PREFIX)/etc/tuxpaint
 endif
 
+ifeq ($(SYSNAME),Haiku)
+  CONFDIR:=$(shell finddir B_USER_SETTINGS_DIRECTORY)/TuxPaint
+endif
+
 # Icons and launchers:
 ICON_PREFIX:=$(DESTDIR)$(PREFIX)/share/pixmaps
 X11_ICON_PREFIX:=$(DESTDIR)$(PREFIX)/X11R6/include/X11/pixmaps
diff -urN tuxpaint-0.9.21/src/fonts.c tuxpaint-0.9.21-haiku/src/fonts.c
--- tuxpaint-0.9.21/src/fonts.c	2009-06-06 11:22:00.000000000 -0700
+++ tuxpaint-0.9.21-haiku/src/fonts.c	2009-11-08 13:52:07.000000000 -0800
@@ -67,6 +67,11 @@
 #include "win32_print.h"
 #endif
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
 #ifdef __APPLE__
 #include "wrapperdata.h"
 extern WrapperData macosx;
@@ -456,7 +461,9 @@
     close(sv[1]);
     return;
   }
+#ifndef __HAIKU__
   nice(42);			// be nice, letting the main thread get the CPU
+#endif
   sched_yield();		// try to let the parent run right now
   prctl(PR_SET_PDEATHSIG, 9);	// get killed if parent exits
   font_socket_fd = sv[1];
@@ -699,6 +706,14 @@
     loadfonts(screen, "/boot/home/config/font/ttffonts");
     loadfonts(screen, "/usr/share/fonts");
     loadfonts(screen, "/usr/X11R6/lib/X11/fonts");
+#elif defined(__HAIKU__)
+	dev_t volume = dev_for_path("/boot");
+	char buffer[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH];
+	status_t result;
+    result = find_directory(B_SYSTEM_FONTS_DIRECTORY, volume, false, buffer, sizeof(buffer));
+	loadfonts(screen, buffer);
+    result = find_directory(B_COMMON_FONTS_DIRECTORY, volume, false, buffer, sizeof(buffer));
+	loadfonts(screen, buffer);
 #elif defined(__APPLE__)
     loadfonts(screen, "/System/Library/Fonts");
     loadfonts(screen, "/Library/Fonts");
diff -urN tuxpaint-0.9.21/src/tuxpaint.c tuxpaint-0.9.21-haiku/src/tuxpaint.c
--- tuxpaint-0.9.21/src/tuxpaint.c	2009-06-18 13:51:58.000000000 -0700
+++ tuxpaint-0.9.21-haiku/src/tuxpaint.c	2009-11-07 15:40:44.000000000 -0800
@@ -212,7 +212,7 @@
 
 #include <locale.h>
 
-#ifdef __BEOS__
+#if defined __BEOS__ || defined __HAIKU__
 #include <wchar.h>
 #else
 #include <wchar.h>
@@ -245,7 +245,7 @@
 #include <dirent.h>
 #include <signal.h>
 
-#ifdef __BEOS__
+#if defined __BEOS__ || defined __HAIKU__
 
 /* BeOS */
 
@@ -948,7 +948,7 @@
 magic_api *magic_api_struct; /* Pointer to our internal functions; passed to shared object's functions when we call them */
 
 
-#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__)
+#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
 #include <paper.h>
 #if !defined(PAPER_H)
 #error "---------------------------------------------------"
@@ -1396,7 +1396,7 @@
 static void stamp_draw(int x, int y);
 static void rec_undo_buffer(void);
 static void show_usage(FILE * f, char *prg);
-#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__)
+#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !(__HAIKU__)
 void show_available_papersizes(FILE * fi, char * prg);
 #endif
 static void setup(int argc, char *argv[]);
@@ -4998,6 +4998,8 @@
   printf("  Built for Windows  (WIN32)\n");
 #elif __BEOS__
   printf("  Built for BeOS  (__BEOS__)\n");
+#elif __HAIKU__
+  printf("  Built for Haiku (__HAIKU__)\n");
 #elif NOKIA_770
   printf("  Built for Maemo  (NOKIA_770)\n");
 #elif OLPC_XO
@@ -5116,7 +5118,7 @@
 #endif
 	  "  %s [--printdelay=SECONDS]\n"
 	  "  %s [--altprintmod | --altprintalways | --altprintnever]\n"
-#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__)
+#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
 	  "  %s [--papersize PAPERSIZE | --papersize help]\n"
 #endif
 	  "  %s [--lang LANGUAGE | --locale LOCALE | --lang help]\n"
@@ -5135,7 +5137,7 @@
 	  blank,
 #endif
 	  blank, blank,
-#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__)
+#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
 	  blank,
 #endif
 	  blank, blank, blank, blank, blank);
@@ -6188,7 +6190,7 @@
 
 
 
-#if defined(__BEOS__) || defined(WIN32)
+#if defined(__BEOS__) || defined(__HAIKU__) || defined(WIN32)
   /* if run from gui, like OpenTracker in BeOS or Explorer in Windows,
      find path from which binary was run and change dir to it
      so all files will be local :) */
@@ -6281,7 +6283,7 @@
   colorfile[0] = '\0';
 
 
-#ifdef __BEOS__
+#if defined __BEOS__ || defined __HAIKU__
   /* Fancy cursors on BeOS are buggy in SDL */
 
   no_fancy_cursors = 1;
@@ -6293,7 +6295,7 @@
 
   savedir = GetDefaultSaveDir("TuxPaint");
   datadir = GetDefaultSaveDir("TuxPaint");
-#elif __BEOS__
+#elif defined__BEOS__ || __HAIKU__
   /* BeOS */
 
   savedir = strdup("./userdata");
@@ -6368,7 +6370,7 @@
 #if defined(WIN32)
   /* Default local config file in users savedir directory on Windows */
   snprintf(str, sizeof(str), "%s/tuxpaint.cfg", savedir); /* FIXME */
-#elif defined(__BEOS__)
+#elif defined(__BEOS__) || defined(__HAIKU__)
   /* BeOS: Use a "tuxpaint.cfg" file: */
 
   strcpy(str, "tuxpaint.cfg");
@@ -6593,7 +6595,7 @@
     {
       alt_print_command_default = ALTPRINT_MOD;
     }
-#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__)
+#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
     else if (strstr(argv[i], "--papersize=") == argv[i])
     {
       papersize = strdup(argv[i] + strlen("--papersize="));
@@ -10149,7 +10151,7 @@
     disallow_print = 1;
 #endif
 
-#ifdef __BEOS__
+#if defined __BEOS__ || defined __HAIKU__
   if (!IsPrinterAvailable())
     disallow_print = disable_print = 1;
 #endif
@@ -12321,7 +12323,7 @@
     free(lock_fname);
   }
 
-#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__)
+#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
   if (papersize != NULL)
     free(papersize);
 #endif
@@ -15436,7 +15438,7 @@
 
 void do_print(void)
 {
-#if !defined(WIN32) && !defined(__BEOS__) && !defined(__APPLE__)
+#if !defined(WIN32) && !defined(__BEOS__) && !defined(__APPLE__) && !defined(__HAIKU__)
   char *pcmd;
   FILE *pi;
 
@@ -15488,7 +15490,7 @@
     if (error)
       fprintf(stderr, "%s\n", error);
   }
-#elif defined(__BEOS__)
+#elif defined(__BEOS__) || defined(__HAIKU__)
   /* BeOS */
 
   SurfacePrint(canvas);
@@ -16171,7 +16173,7 @@
 #endif
 	use_print_config = 0;
       }
-#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__)
+#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
       else if (strstr(str, "printcommand=") == str)
       {
 /* FIXME: This would need to be done one argument (space-delim'd) at a time */
@@ -16249,7 +16251,7 @@
       {
 	alt_print_command_default = ALTPRINT_NEVER;
       }
-#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__)
+#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
       else if (strstr(str, "papersize=") == str)
       {
         papersize = strdup(str + strlen("papersize="));
@@ -18727,7 +18729,7 @@
   return(which != -1);
 }
 
-#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__)
+#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
 void show_available_papersizes(FILE * fi, char * prg)
 {
   const struct paper * ppr;
diff -urN tuxpaint-0.9.21/src/tuxpaint.rdef tuxpaint-0.9.21-haiku/src/tuxpaint.rdef
--- tuxpaint-0.9.21/src/tuxpaint.rdef	1969-12-31 16:00:00.000000000 -0800
+++ tuxpaint-0.9.21-haiku/src/tuxpaint.rdef	2009-11-07 15:40:44.000000000 -0800
@@ -0,0 +1,123 @@
+
+resource large_icon array {
+	$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+	$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+	$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000FFFFFFFFFFFFFFFFFFFF"
+	$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000FFFFFFFFFFFFFFFFFF"
+	$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000700000400000000FFFFFFFFFFFFFFFF"
+	$"FF000000FFFF00FFFFFFFFFFFFFF00003F10133F1A000000FFFFFFFFFFFFFFFF"
+	$"0000000300000000FFFFFFFFFFFF001C1C1C3F3F3F05000000FFFFFFFFFFFFFF"
+	$"0000000000000000FFFFFFFFFFFF0010123F16183F06000000FFFFFFFFFFFFFF"
+	$"0000000000000000FFFFFFFF0000071D3F3F0A141D00000000FFFFFFFFFFFFFF"
+	$"000000000000000000FFFF000085F9BD85831E3F0B00000000FFFFFFFFFFFFFF"
+	$"00000000000000000000FF00BD85F9F9F9F9BD090000000000FFFFFFFFFFFFFF"
+	$"0000000000000000000000AB8503F9F9F9F9F9B10000000000FFFFFFFFFFFFFF"
+	$"FF00000100000000000000AB85ABF9F9F9F9F9AB0000000000FFFFFFFFFFFFFF"
+	$"FFFFFF00000000000000000285F9F9F9F9F9F9B10000000000FFFFFFFFFFFFFF"
+	$"FFFFFFFFFF0000000000000002ABBDF9F9F985010000000000FFFFFFFFFFFFFF"
+	$"FFFFFFFFFFFF00000000000000000004D7D70000000000000000FFFFFFFFFFFF"
+	$"FFFFFFFFFFFFFF0000000000000004030000000000000000000000FFFFFFFFFF"
+	$"FFFFFFFFFFFFFFFFFF000000031B3F3F1A0600000000000000000000FFFFFFFF"
+	$"FFFFFFFFFFFFFFFFFF0000000E3F3F3F3F180000080200000000000000FFFFFF"
+	$"FFFFFFFFFFFFFFFF00000005183F3F1E59DA0600070C0000000000000000FFFF"
+	$"FFFFFFFFFFFFFFFF0000103F3F3FDABBBBC48A0700110500000000000000FFFF"
+	$"FFFFFFFFFFFFFF0000033F3F3F3FBABBE3CA8A8485AB1300000000000000FFFF"
+	$"FFFFFFFFFFFFFF0000083F3F3F59E9A8A90F89D1AB841300000000000010FFFF"
+	$"FFFFFFFFFFFFFF0000083F3F3F1D1C3F3F3F3F0101130200000000D78900FFFF"
+	$"FFFFFFFFFFFFFF0000033F3F3F3F3F3F3F3F3F0102060000000007628300FFFF"
+	$"FFFFFFFFFFFFFF0000001A3F3F3F3F3F3F3F3F01000000031004000000FFFFFF"
+	$"FFFFFFFFFFFFFFFF00000B3F3F3F3F3F3F3F3F0000000F0E030000FFFFFFFFFF"
+	$"FFFFFFFFFFFFFFFF00000000000000000000000000000000000000FFFFFFFFFF"
+	$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+	$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+	$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+	$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+};
+
+resource mini_icon array {
+	$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+	$"FFFFFFFFFFFFFFFF000000FFFFFFFFFF"
+	$"0000FFFFFFFFFF00103F0000FFFFFFFF"
+	$"00000000FFFFFF103F180600FFFFFFFF"
+	$"00000000FF0085BD833F0000FFFFFFFF"
+	$"0000000000AB03F9F9B10000FFFFFFFF"
+	$"FF0000000002F9F9F9B10000FFFFFFFF"
+	$"FFFFFF0000000004D700000000FFFFFF"
+	$"FFFFFFFF00001B3F060000000000FFFF"
+	$"FFFFFFFF00053F1EDA000C00000000FF"
+	$"FFFFFF00033F3FBBCA84AB00000000FF"
+	$"FFFFFF00083F1D3F3F01130000D700FF"
+	$"FFFFFF00003F3F3F3F0100030400FFFF"
+	$"FFFFFFFF000000000000000000FFFFFF"
+	$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+	$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+};
+
+
+resource vector_icon array {
+	$"6E6369660602001602B8B10BBA4D843A4D84B8B10B4A0E9346F9C10000FF2105"
+	$"FF02000602B796BAB8831C38831CB796BA4A8259494B3900FFBC00FFFFDD7D02"
+	$"01060239670F00000000000039670F4A302B4B07CD00EB427CD9701A36020006"
+	$"03B1F29A361F94B61F94B1F29A4A80FD4B204A00E6B871919D7D44FF49391002"
+	$"00060331EAABB5ED5B35ED5B31EAAB4BFBBC4B7E58007C5C2078D5A72CFFFECA"
+	$"310D021DCA35CC7FCA35CC7FCA63CB8CCA97C97ECA53CA5CCA97C97ECB3EC8E4"
+	$"CAEEC957CB3EC8E4CB3EC8E4CB3EC8E4CBCDC80ACC5AC5C6CCA4C727CC25C4C8"
+	$"CA7EC2F7CB27C3B3CA35C2A6C959C1C6C9C3C22FC8FAC166C84DC07CC85FC0E3"
+	$"C83EC027C865BF4BC85CBFAB56BE0EC865BB94C887BCCBC81CB8F0C4DFB619C7"
+	$"4FB687C4DFB619C4DFB60CC4DFB60CC4DFB60CC41BB60CC41BB60CC151B690BF"
+	$"D1BBACC023B8B0BE37BC0ABD1ABEDDBD25BCF0BD1EBF05BCE9BEDDBCE3BED9BC"
+	$"ACBEB4BC4BBE4BBC81BE76BB83BDACB9F5BBD1BA44BCC8B9C1BB2DB8DCB99FB9"
+	$"B8B986B872B9ACB87BBA7BB877BA2EB87CBAAFB862BA6FB867BA7BB7C331B59E"
+	$"B9ACB682B971B4D9B9DEB3B6BB7BB421BAD0B363BC0220BD26B326BC9B20BD26"
+	$"20BDB920BDB9B30FBE60B49EBE4BB3F8BE86B75FBFE5BBF5C403B9DAC1C4BAF2"
+	$"C548BA0DC91CBA0AC6DBBA0FCA8ABB3ECC7FBA9FCB8DBB3ECC7F020DBD7CCC7F"
+	$"BD7CCC7FBCD5CB9ABC01C835BBF0C9E5BC09C779BCB8C61CBC3CC698BD24C5B0"
+	$"BE4BC540BDD9C5B7BE64C456BF27C34C3DC3A0C029C2BDC264C3BAC1B4C311C2"
+	$"D8C428C326C53EC2FFC4B5C326C53EC326C53EC326C53EC33DC58CC377C612C3"
+	$"5AC5D0C377C612C3C4C6D2C3C4C6D2C3E2C72CC3F7C810C3F7C790C3E4C998C3"
+	$"95CC7FC420CB6FC395CC7FBD7CCC7FBD7CCC7FBD7CCC7F020DC371BD32C3D0BD"
+	$"8DC371BD32C374BD31C374BD31C319BD08C26FBCA8C2C8BCD1C26FBCA8C270BC"
+	$"ACC270BCACC22EBC9EC1B9BC6FC1F5BC85C1B9BC6FC1BABC6CC1BABC6CC15DBC"
+	$"5FC0ADBC32C107BC48C0ADBC32C0ADBC32C0ADBC32BE5BBBD3BDE9BFF6BCCBBE"
+	$"20BE51C0A1C03FC13FBF42C0EDC0F4C17BC240C1A1C1B1C1A2C2A6C1A0C371C1"
+	$"70C339C18CC418C11CC471BEB9C49BBFC7C456BE10020FC5C6B9C4C5D4BAF5C5"
+	$"BDB8FCC458B893C54BB86FC381B8B3C2DEBA32C348B98BC2EBB8FEC195B893C2"
+	$"61B85AC105B8BBC04BBAB8C064B9D7C03ABB56C0ADBC0EC046BBD8C0ADBC0EC0"
+	$"ACBC11C0ACBC11C107BC28C1BABC4CC15EBC3FC1BABC4CC1B9BC4BC1B9BC4BC2"
+	$"06BC5AC24CBC26C218BC2FC260BC46C27DBC94C268BC73C27DBC94C279BC95C2"
+	$"79BC95C2D5BCBFC37EBD1EC32639C37EBD1EC37DBD1AC37DBD1AC3D1BD35C495"
+	$"BD1AC442BD41C547BCC60202C1A1BA32C0B6B9DAC200BA8C44BB4AC1C8BB45C0"
+	$"9DBB530202C3D2BADDC34DBAF4C497BABAC3A1BC3EC46BBC65C30ABC210202BF"
+	$"64BDD1BE7CBD77BFD1BE54BEDDBF94BF76BFA0BE21BF860002C6AFCB98C6AFCB"
+	$"98C7B3CBA6C966CA7BC8DECB03C966CA7B0005C5B3C96AC5B3C96AC5BEC939C5"
+	$"E0C8D3C5C1C8FDC60AC89BC682C844C650C875C6E4C7E4C6CBC6DEC70BC75FC6"
+	$"62C60BC57EC482C546C59BC57EC4820608FBBFC320C6B3C305C739C33AC62DC3"
+	$"53C60AC1FDC578C2C3C578C137C578BFCCC6E3C05BC5E5BF3CC7E0BFAAC894BF"
+	$"63C89DC01EC885C124C7F5C0EAC7F5C15EC7F5C1F7C81DC183C81DC26BC81DC3"
+	$"00C7E60606AE0BC353C60AC320C6B3C33AC62DC305C739C300C7E6C447C814C4"
+	$"7AC735C45FC79DC494C6CDC4BBC6870607EF3EC6B9C760C6B9C7A5C6B9C74CC6"
+	$"B2C725C6B7C739C6B2C725C4BBC687C47AC735C494C6CDC45FC79DC447C814C5"
+	$"FBC874C5FBC87450C854C660C821C646C83BC699C7E90607FB3FCC68C96ACC46"
+	$"C9D0CC8FC8F7CBF0C8CBCB6BC8A1CB6BC8A1CB5CC8B7CB3EC8E4CB4CC8CECB3E"
+	$"C8E4CB3EC8E4CB3EC8E4CAFEC941CAA0C979CAB9C96CCAA0C979CBCFC9BCCBCF"
+	$"C9BCCBCFC9BC0D0A000100000A010101000A020102000A010103000A00010400"
+	$"0A000105000A000106000A0101071001178122040A0101081001178122040A03"
+	$"0109000A04010A000A05010B000A05010C00"
+};
+
+
+resource app_signature "application/x-vnd.newbreedsoftware-tuxpaint";
+
+resource app_version {
+	major  = 0,
+	middle = 150994944,
+	minor  = 234881024,
+
+	variety = B_APPV_DEVELOPMENT,
+	internal = 0,
+
+	short_info = "Drawing program",
+	long_info = "A simple drawing program for children."
+};
+
+resource app_flags B_SINGLE_LAUNCH;
