Skip to content
Permalink
Browse files

haiku: Implement message box for Haiku

Add implementation for functions:

SDL_ShowSimpleMessageBox()
SDL_ShowMessageBox()

Add simple customization support also.
Fix build for x86_gcc2.

Partially fixes Bugzilla #4442.
  • Loading branch information
EXL committed Nov 11, 2019
1 parent a365c7f commit b22fb9e2bacbc954be20f2e2bc7fbb8f2e665ccf
@@ -132,7 +132,8 @@ typedef enum
SDL_SYSWM_WINRT,
SDL_SYSWM_ANDROID,
SDL_SYSWM_VIVANTE,
SDL_SYSWM_OS2
SDL_SYSWM_OS2,
SDL_SYSWM_HAIKU
} SDL_SYSWM_TYPE;

/**
@@ -48,13 +48,14 @@ extern "C" {
static int SDL_BeAppActive = 0;
static SDL_Thread *SDL_AppThread = NULL;

/* Default application signature */
const char *signature = "application/x-SDL-executable";

static int
StartBeApp(void *unused)
{
BApplication *App;

// default application signature
const char *signature = "application/x-SDL-executable";
// dig resources for correct signature
image_info info;
int32 cookie = 0;
@@ -31,6 +31,9 @@ extern int SDL_InitBeApp(void);
/* Quit the Be Application, if there's nothing left to do */
extern void SDL_QuitBeApp(void);

/* Be Application Signature*/
extern const char *signature;

/* vi: set ts=4 sw=4 expandtab: */

#ifdef __cplusplus
@@ -3846,9 +3846,12 @@ SDL_IsScreenKeyboardShown(SDL_Window *window)
#if SDL_VIDEO_DRIVER_X11
#include "x11/SDL_x11messagebox.h"
#endif
#if SDL_VIDEO_DRIVER_HAIKU
#include "haiku/SDL_bmessagebox.h"
#endif


#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11
#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_HAIKU
static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
{
SDL_SysWMinfo info;
@@ -3940,6 +3943,13 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
X11_ShowMessageBox(messageboxdata, buttonid) == 0) {
retval = 0;
}
#endif
#if SDL_VIDEO_DRIVER_HAIKU
if (retval == -1 &&
SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_HAIKU) &&
BE_ShowMessageBox(messageboxdata, buttonid) == 0) {
retval = 0;
}
#endif
if (retval == -1) {
SDL_SetError("No message system available");

0 comments on commit b22fb9e

Please sign in to comment.