From 79ac419261c143e0639214f5385bd0805db741e5 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Sat, 22 Jan 2022 22:03:32 +1000 Subject: Fix for Haiku diff --git a/Makefile.in b/Makefile.in index f81ef33..3c5bcde 100644 --- a/Makefile.in +++ b/Makefile.in @@ -15,8 +15,8 @@ inst_dir := install -m 755 -d inst_file := install -m 644 CC := @CC@ -CFLAGS := @CFLAGS@ -pthread -Isrc/include -Imlk/include -I. -DHAVE_CONFIG_H -LDFLAGS := @LDFLAGS@ -pthread +CFLAGS := @CFLAGS@ -Isrc/include -Imlk/include -I. -DHAVE_CONFIG_H +LDFLAGS := @LDFLAGS@ LIBS := @LIBS@ -lm TARGET := azpainter diff --git a/config.h.in b/config.h.in index cc5b0f3..da25117 100644 --- a/config.h.in +++ b/config.h.in @@ -2,7 +2,7 @@ #undef MLK_NO_FREETYPE_VARIABLE #define MLK_NO_ICONTHEME -#define MLK_X11_HAVE_XINPUT2 +#define MLK_X11_NO_XSHM #undef HAVE_MMX #undef HAVE_SSE diff --git a/configure b/configure index ab88aeb..e0d73fb 100755 --- a/configure +++ b/configure @@ -355,8 +355,6 @@ fc_check_lib libtiff "libtiff-4" "" "-ltiff" "tiff.h" "" "libtiff-dev or libtiff fc_check_lib libwebp "libwebp" "" "-lwebp" "webp/decode.h" "" "libwebp-dev or libwebp-devel or libwebp or webp" fc_check_lib x11 "x11" "" "-lX11" "X11/Xlib.h" "" "libx11-dev or libX11-devel or libx11" fc_check_lib xext "xext" "" "-lXext" "X11/Xlib.h X11/extensions/XShm.h" "" "libxext-dev or libXext-devel or libxext" -fc_check_lib xcursor "xcursor" "" "-lXcursor" "X11/Xlib.h X11/Xcursor/Xcursor.h" "" "libxcursor-dev or libXcursor-devel or libxcursor" -fc_check_lib xinput "xi" "" "-lXi" "X11/Xlib.h X11/extensions/XInput2.h" "" "libxi-dev or libXi-devel or libxi" fc_check_lib fontconfig "fontconfig" "" "-lfontconfig -lfreetype" "fontconfig/fontconfig.h" "/usr/include/freetype2 /usr/local/include/freetype2 /opt/X11/include/freetype2" "libfontconfig1-dev or libfontconfig-devel or fontconfig" fc_check_lib freetype2 "freetype2" "" "" "ft2build.h" "" "libfreetype6-dev or libfreetype6-devel or freetype2" diff --git a/mlk/include/mlk_platform.h b/mlk/include/mlk_platform.h index 39550d0..0a8748b 100644 --- a/mlk/include/mlk_platform.h +++ b/mlk/include/mlk_platform.h @@ -24,6 +24,8 @@ $*/ #define MLK_PLATFORM_FREEBSD #elif defined(__APPLE__) && defined(__MACH__) #define MLK_PLATFORM_MACOS +#elif defined(__HAIKU__) + #define MLK_PLATFORM_HAIKU #else #define MLK_PLATFORM_LINUX #endif diff --git a/mlk/src/gui/x11/mlk_x11.h b/mlk/src/gui/x11/mlk_x11.h index 361ba15..490a844 100644 --- a/mlk/src/gui/x11/mlk_x11.h +++ b/mlk/src/gui/x11/mlk_x11.h @@ -46,9 +46,11 @@ $*/ #include #endif +#ifndef __HAIKU__ #ifdef MLKX11_INC_XCURSOR #include #endif +#endif #if defined(MLKX11_INC_XSHM) && !defined(MLK_X11_NO_XSHM) #include diff --git a/mlk/src/gui/x11/mlk_x11_cursor.c b/mlk/src/gui/x11/mlk_x11_cursor.c index a55f816..27e3308 100644 --- a/mlk/src/gui/x11/mlk_x11_cursor.c +++ b/mlk/src/gui/x11/mlk_x11_cursor.c @@ -41,7 +41,9 @@ void __mX11CursorFree(mCursor cur) mCursor __mX11CursorLoad(const char *name) { +#ifndef __HAIKU__ return XcursorLibraryLoadCursor(MLKX11_DISPLAY, name); +#endif } /** 1bit データからカーソル作成 */ @@ -92,6 +94,7 @@ mCursor __mX11CursorCreate1bit(const uint8_t *buf) mCursor __mX11CursorCreateRGBA(int width,int height,int hotspot_x,int hotspot_y,const uint8_t *buf) { +#ifndef __HAIKU__ XcursorImage *img; XcursorPixel *pd; int ix,iy; @@ -124,5 +127,8 @@ mCursor __mX11CursorCreateRGBA(int width,int height,int hotspot_x,int hotspot_y, XcursorImageDestroy(img); return cur; +#else + return 0; +#endif } diff --git a/mlk/src/mlk_file.c b/mlk/src/mlk_file.c index dacc7b8..8a87d9b 100644 --- a/mlk/src/mlk_file.c +++ b/mlk/src/mlk_file.c @@ -386,6 +386,9 @@ mlkerr mCreateDir(const char *path,int perm) str = mUTF8toLocale(path, -1, NULL); if(!str) return MLKERR_ALLOC; + if (mIsExistDir(path)) + return MLKERR_EXIST; + ret = mkdir(str, perm); mFree(str); diff --git a/mlk/src/mlk_util_sys.c b/mlk/src/mlk_util_sys.c index a8e5385..fd9496d 100644 --- a/mlk/src/mlk_util_sys.c +++ b/mlk/src/mlk_util_sys.c @@ -39,6 +39,10 @@ $*/ #include #include +#elif defined(MLK_PLATFORM_HAIKU) +/* Haiku */ +#include + #endif //----------- @@ -143,6 +147,19 @@ char *mGetSelfExePath(void) if(sysctl(mib, 4, buf, &len, NULL, 0) != 0) len = 0; +#elif defined(MLK_PLATFORM_HAIKU) + /* Haiku */ + size_t len = 0; + image_info info; + int32 cookie = 0; + while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { + if (info.type == B_APP_IMAGE) { + strcpy(buf, info.name); + len = strlen(info.name); + break; + } + } + #else /* Linux */ diff --git a/src/main.c b/src/main.c index 04f6924..d169be5 100644 --- a/src/main.c +++ b/src/main.c @@ -382,9 +382,13 @@ static int _init_main(int argc,char **argv) //パスセット +#ifdef __HAIKU__ + mGuiSetPath_data_exe("../data/azpainter3"); + mGuiSetPath_config_home("config/settings/azpainter"); +#else mGuiSetPath_data_exe("../share/azpainter3"); mGuiSetPath_config_home(".config/azpainter"); - +#endif //翻訳データ mGuiLoadTranslation(g_deftransdat, NULL, "tr"); -- 2.30.2