From 64afbdd055993336fe6299e76ba3ea6b93976f85 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 17 Nov 2021 17:42:17 -0500 Subject: Fixes for Haiku. diff --git a/sdl/SdlTkX.c b/sdl/SdlTkX.c index 4ac99ba..78f102d 100644 --- a/sdl/SdlTkX.c +++ b/sdl/SdlTkX.c @@ -106,7 +106,7 @@ struct EventThreadStartup { int init_done; int *root_width; int *root_height; -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) int want_startup_script; char *startup_script; #endif @@ -128,7 +128,7 @@ static Tcl_Condition xlib_cond; static Tcl_Condition time_cond; static SDL_atomic_t timer_enabled; static int num_displays = 0; -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) struct EventThreadStartup evt_startup = { 0, NULL, NULL, 0, NULL }; #endif @@ -155,6 +155,12 @@ static void SdlTkLostFocusWindow(void); void SdlTkLock(Display *display) { +#ifdef __HAIKU__ + // We may get called before things are fully initialized. + while (!tclStubsPtr) + sched_yield(); +#endif + Tcl_MutexLock(&xlib_lock); if (display != NULL) { while ((xlib_grab != NULL) && (xlib_grab != display)) { @@ -5752,6 +5758,15 @@ fatal: } #endif +#ifdef __HAIKU__ + // Set defaults so that things work better. + SdlTkX.arg_nogl = 1; + SdlTkX.arg_resizable = 1; + SdlTkX.arg_swcursor = 1; + width = 800; + height = 600; +#endif + /* Preset some defaults. */ SdlTkX.dec_frame_width = 6; SdlTkX.dec_title_height = 20; @@ -5785,8 +5800,10 @@ fatal: if (SdlTkX.arg_noborder) { videoFlags |= SDL_WINDOW_BORDERLESS; } +#ifndef __HAIKU__ width = 1024; height = 768; +#endif /* * Start the root window hidden since font init * may take some time. At end of font init in @@ -6523,7 +6540,7 @@ ctxRetry: *---------------------------------------------------------------------- */ -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) void SdlTkEventThread(void) #else @@ -6543,7 +6560,7 @@ EventThread(ClientData clientData) Uint16 rate, Uint16 delay); extern int SDL_SendKeyboardText(const char *text); #endif -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) struct EventThreadStartup *evs = &evt_startup; #else struct EventThreadStartup *evs = (struct EventThreadStartup *) clientData; @@ -6554,13 +6571,13 @@ EventThread(ClientData clientData) Android_JNI_SetupThread(); #endif SdlTkLock(NULL); -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) while (evs->root_width == NULL && evs->root_height == NULL) { SdlTkWaitLock(); } #endif initSuccess = PerformSDLInit(evs->root_width, evs->root_height); -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) evs->root_width = evs->root_height = NULL; SDL_PumpEvents(); if (evs->want_startup_script) { @@ -6774,7 +6791,7 @@ EventThread(ClientData clientData) } eventThreadEnd: -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) exit(3); #else Tcl_ExitThread(0); @@ -6782,7 +6799,7 @@ eventThreadEnd: #endif } -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__HAIKU__) static void EventThreadExitHandler(ClientData clientData) { @@ -6802,7 +6819,7 @@ EventThreadExitHandler(ClientData clientData) static void OpenVeryFirstDisplay(int *root_width, int *root_height) { -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) struct EventThreadStartup *evs = &evt_startup; #else extern void TclCreateLateExitHandler(Tcl_ExitProc *, ClientData); @@ -6812,7 +6829,7 @@ OpenVeryFirstDisplay(int *root_width, int *root_height) evs->init_done = 0; evs->root_width = root_width; evs->root_height = root_height; -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) /* * Rendezvous with already running event thread, which * in MacOSX must be the main thread. diff --git a/sdl/tkAppInit.c b/sdl/tkAppInit.c index e40eab2..e2ae821 100644 --- a/sdl/tkAppInit.c +++ b/sdl/tkAppInit.c @@ -68,7 +68,7 @@ MODULE_SCOPE int TK_LOCAL_MAIN_HOOK(int *argc, char ***argv); #undef Tcl_ObjSetVar2 #undef Tcl_NewStringObj -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) struct ThreadStartup { int argc; char **argv; @@ -308,7 +308,7 @@ GetOBBDir(void) } #endif -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) /* *---------------------------------------------------------------------- * @@ -356,7 +356,7 @@ main( const char *path, *temp, *pcpath; char *ldpath = NULL, *end; #endif -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) Tcl_ThreadId thrId; struct ThreadStartup startup; extern void SdlTkEventThread(void); @@ -438,7 +438,7 @@ main( free(ldpath); ldpath = NULL; } - } + } } /* now enhance LD_LIBRARY_PATH and PATH */ if (ldpath != NULL) { @@ -504,7 +504,7 @@ main( #else Tcl_FindExecutable(argv[0]); #endif -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) /* * We need the SDL event handling run in the main thread, * which seems to be a Cocoa requirement. Therefore Tk_MainEx() -- 2.43.2 From 57f044b7d6df6656226d5cf5745178e499caa00d Mon Sep 17 00:00:00 2001 From: begasus Date: Thu, 12 May 2022 14:20:59 +0200 Subject: tk fails to find freetype's header ft2build.h Haikuports version for freetype doesn't provide freetype-config Change order to check with pkg-config prior to check with freetype-config diff --git a/sdl/configure b/sdl/configure old mode 100755 new mode 100644 index 691c0cd..889c7f0 --- a/sdl/configure +++ b/sdl/configure @@ -10060,12 +10060,12 @@ fi { $as_echo "$as_me:$LINENO: checking for freetype" >&5 $as_echo_n "checking for freetype... " >&6; } found_ft=yes -FT_CFLAGS=`freetype-config --cflags 2>/dev/null` || found_ft="no" -FT_LIBS=`freetype-config --libs 2>/dev/null` || found_ft="no" +FT_CFLAGS=`pkg-config --cflags freetype2 2>/dev/null` || found_ft="no" +FT_LIBS=`pkg-config --libs freetype2 2>/dev/null` || found_ft="no" if test "$found_xft" = "no" ; then found_ft=yes - FT_CFLAGS=`pkg-config --cflags freetype2 2>/dev/null` || found_ft="no" - FT_LIBS=`pkg-config --libs freetype2 2>/dev/null` || found_ft="no" + FT_CFLAGS=`freetype-config --cflags 2>/dev/null` || found_ft="no" + FT_LIBS=`freetype-config --libs 2>/dev/null` || found_ft="no" fi { $as_echo "$as_me:$LINENO: result: $found_ft" >&5 $as_echo "$found_ft" >&6; } -- 2.43.2 From e15ad2ac1ef61740ada5ff76598567c778e15c00 Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Sun, 24 Mar 2024 16:54:29 +0100 Subject: Disable framebuffer acceleration The code in SDL-TK tries very hard to disable OpenGL, but framebuffer acceleration is implemented with OpenGL and so it ends up being enabled anyways. diff --git a/sdl/SdlTkX.c b/sdl/SdlTkX.c index 78f102d..6c4489d 100644 --- a/sdl/SdlTkX.c +++ b/sdl/SdlTkX.c @@ -5723,6 +5723,9 @@ PerformSDLInit(int *root_width, int *root_height) } #endif SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1"); +#ifdef __HAIKU__ + SDL_SetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION, "0"); +#endif retryInit: #endif if (SDL_Init(initMask) < 0) { @@ -5763,8 +5766,6 @@ fatal: SdlTkX.arg_nogl = 1; SdlTkX.arg_resizable = 1; SdlTkX.arg_swcursor = 1; - width = 800; - height = 600; #endif /* Preset some defaults. */ @@ -5800,10 +5801,8 @@ fatal: if (SdlTkX.arg_noborder) { videoFlags |= SDL_WINDOW_BORDERLESS; } -#ifndef __HAIKU__ width = 1024; height = 768; -#endif /* * Start the root window hidden since font init * may take some time. At end of font init in -- 2.43.2