New tuxpaint patch for 0.9.21, this time using finddir and find_directory(), still need to make it work for tuxpaint svn.

This commit is contained in:
Scott McCreary
2009-10-07 07:48:55 +00:00
parent c6bd9f5086
commit f9363220ac

View File

@@ -0,0 +1,234 @@
diff -urN tuxpaint-0.9.21/Makefile tuxpaint-0.9.21-haiku/Makefile
--- tuxpaint-0.9.21/Makefile 2009-10-07 07:43:22.000000000 +0000
+++ tuxpaint-0.9.21-haiku/Makefile 2009-04-29 05:18:57.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 -lnetwork -liconv $(FRIBIDI_LIB)"
+beos_ARCH_LINKS:="-lintl $(PNG) -lz -lbe -liconv $(FRIBIDI_LIB)"
linux_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB)
ARCH_LINKS:=$($(OS)_ARCH_LINKS)
@@ -92,7 +92,7 @@
# Where things will go when ultimately installed:
windows_PREFIX:=/usr/local
osx_PREFIX:=/usr/local
-beos_PREFIX:=$(shell finddir B_APPS_DIRECTORY)/TuxPaint
+beos_PREFIX:=/boot/apps/Games/TuxPaint
linux_PREFIX:=/usr/local
PREFIX:=$($(OS)_PREFIX)
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 18:22:00.000000000 +0000
+++ tuxpaint-0.9.21-haiku/src/fonts.c 2009-10-07 07:39:18.000000000 +0000
@@ -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,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 +704,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 20:51:58.000000000 +0000
+++ tuxpaint-0.9.21-haiku/src/tuxpaint.c 2009-10-07 07:39:08.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 */
@@ -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;