Skip to content

Commit b22fb9e

Browse files
committed
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.
1 parent a365c7f commit b22fb9e

7 files changed

Lines changed: 500 additions & 5 deletions

File tree

include/SDL_syswm.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ typedef enum
132132
SDL_SYSWM_WINRT,
133133
SDL_SYSWM_ANDROID,
134134
SDL_SYSWM_VIVANTE,
135-
SDL_SYSWM_OS2
135+
SDL_SYSWM_OS2,
136+
SDL_SYSWM_HAIKU
136137
} SDL_SYSWM_TYPE;
137138

138139
/**

src/main/haiku/SDL_BeApp.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ extern "C" {
4848
static int SDL_BeAppActive = 0;
4949
static SDL_Thread *SDL_AppThread = NULL;
5050

51+
/* Default application signature */
52+
const char *signature = "application/x-SDL-executable";
53+
5154
static int
5255
StartBeApp(void *unused)
5356
{
5457
BApplication *App;
5558

56-
// default application signature
57-
const char *signature = "application/x-SDL-executable";
5859
// dig resources for correct signature
5960
image_info info;
6061
int32 cookie = 0;

src/main/haiku/SDL_BeApp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ extern int SDL_InitBeApp(void);
3131
/* Quit the Be Application, if there's nothing left to do */
3232
extern void SDL_QuitBeApp(void);
3333

34+
/* Be Application Signature*/
35+
extern const char *signature;
36+
3437
/* vi: set ts=4 sw=4 expandtab: */
3538

3639
#ifdef __cplusplus

src/video/SDL_video.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3846,9 +3846,12 @@ SDL_IsScreenKeyboardShown(SDL_Window *window)
38463846
#if SDL_VIDEO_DRIVER_X11
38473847
#include "x11/SDL_x11messagebox.h"
38483848
#endif
3849+
#if SDL_VIDEO_DRIVER_HAIKU
3850+
#include "haiku/SDL_bmessagebox.h"
3851+
#endif
38493852

38503853

3851-
#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11
3854+
#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
38523855
static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
38533856
{
38543857
SDL_SysWMinfo info;
@@ -3940,6 +3943,13 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
39403943
X11_ShowMessageBox(messageboxdata, buttonid) == 0) {
39413944
retval = 0;
39423945
}
3946+
#endif
3947+
#if SDL_VIDEO_DRIVER_HAIKU
3948+
if (retval == -1 &&
3949+
SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_HAIKU) &&
3950+
BE_ShowMessageBox(messageboxdata, buttonid) == 0) {
3951+
retval = 0;
3952+
}
39433953
#endif
39443954
if (retval == -1) {
39453955
SDL_SetError("No message system available");

0 commit comments

Comments
 (0)