Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 b22fb9e
Show file tree
Hide file tree
Showing 7 changed files with 500 additions and 5 deletions.
3 changes: 2 additions & 1 deletion include/SDL_syswm.h
Expand Up @@ -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;

/**
Expand Down
5 changes: 3 additions & 2 deletions src/main/haiku/SDL_BeApp.cc
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/main/haiku/SDL_BeApp.h
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion src/video/SDL_video.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit b22fb9e

Please sign in to comment.