Initial attempt at making a haiku patch for tuxpaint. It's not working yet, but getting closer. TODO: convert some of the hardcoded directories to use find_directory().

This commit is contained in:
Scott McCreary
2009-09-09 08:38:36 +00:00
parent 57aca12d02
commit 9dbe9f31d1

View File

@@ -0,0 +1,213 @@
diff -urN tuxpaint-orig/Makefile tuxpaint-haiku/Makefile
--- tuxpaint-orig/Makefile 2009-07-01 21:58:37.000000000 +0000
+++ tuxpaint-haiku/Makefile 2009-09-09 05:56:25.000000000 +0000
@@ -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 -liconv -lnetwork $(FRIBIDI_LIB)"
linux_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB)
ARCH_LINKS:=$($(OS)_ARCH_LINKS)
diff -urN tuxpaint-orig/src/fonts.c tuxpaint-haiku/src/fonts.c
--- tuxpaint-orig/src/fonts.c 2009-06-06 18:22:00.000000000 +0000
+++ tuxpaint-haiku/src/fonts.c 2009-09-09 08:20:32.000000000 +0000
@@ -456,7 +456,7 @@
close(sv[1]);
return;
}
- nice(42); // be nice, letting the main thread get the CPU
+ // nice(42); // be nice, letting the main thread get the CPU
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 +699,9 @@
loadfonts(screen, "/boot/home/config/font/ttffonts");
loadfonts(screen, "/usr/share/fonts");
loadfonts(screen, "/usr/X11R6/lib/X11/fonts");
+#elif defined(__HAIKU__)
+ loadfonts(screen, "/boot/system/fonts/ttfonts");
+ loadfonts(screen, "/boot/common/fonts/ttfonts");
#elif defined(__APPLE__)
loadfonts(screen, "/System/Library/Fonts");
loadfonts(screen, "/Library/Fonts");
diff -urN tuxpaint-orig/src/tuxpaint.c tuxpaint-haiku/src/tuxpaint.c
--- tuxpaint-orig/src/tuxpaint.c 2009-09-02 05:32:41.000000000 +0000
+++ tuxpaint-haiku/src/tuxpaint.c 2009-09-09 06:13:50.000000000 +0000
@@ -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 */
@@ -950,7 +950,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 "---------------------------------------------------"
@@ -1398,7 +1398,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__) && !defined(__HAIKU__)
void show_available_papersizes(FILE * fi, char * prg);
#endif
static void setup(int argc, char *argv[]);
@@ -5005,6 +5005,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
@@ -5123,7 +5125,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"
@@ -5142,7 +5144,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);
@@ -6195,7 +6197,7 @@
-#if defined(__BEOS__) || defined(WIN32)
+#if defined(__BEOS__) || defined(WIN32) || defined(__HAIKU__)
/* 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 :) */
@@ -6288,7 +6290,7 @@
colorfile[0] = '\0';
-#ifdef __BEOS__
+#if defined __BEOS__ || defined __HAIKU__
/* Fancy cursors on BeOS are buggy in SDL */
no_fancy_cursors = 1;
@@ -6305,6 +6307,11 @@
savedir = strdup("./userdata");
datadir = strdup("./userdata");
+#elif __HAIKU__
+ /* Haiku */
+
+ savedir = strdup("./userdata");
+ datadir = strdup("./userdata");
#elif __APPLE__
/* Mac OS X */
@@ -6375,7 +6382,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");
@@ -6600,7 +6607,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="));
@@ -10156,7 +10163,7 @@
disallow_print = 1;
#endif
-#ifdef __BEOS__
+#if defined __BEOS__ || defined __HAIKU__
if (!IsPrinterAvailable())
disallow_print = disable_print = 1;
#endif
@@ -12330,7 +12337,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
@@ -15474,7 +15481,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;
@@ -15530,6 +15537,10 @@
/* BeOS */
SurfacePrint(canvas);
+#elif defined(__HAIKU__)
+ /* Haiku */
+
+ SurfacePrint(canvas);
#elif defined(__APPLE__)
/* Mac OS X */
int show = ( ( want_alt_printcommand || macosx.menuAction ) && !fullscreen);
@@ -16209,7 +16220,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 */
@@ -16287,7 +16298,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="));
@@ -18790,7 +18801,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;