21 #include "../../SDL_internal.h"
23 #if defined(__HAIKU__)
28 #include <storage/AppFileInfo.h>
29 #include <storage/Path.h>
30 #include <storage/Entry.h>
31 #include <storage/File.h>
39 #include "../../video/haiku/SDL_BWin.h"
45 #include "../../thread/SDL_systhread.h"
48 static int SDL_BeAppActive = 0;
52 StartBeApp(
void *unused)
57 const char *signature =
"application/x-SDL-executable";
61 if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
62 BFile
f(info.name, O_RDONLY);
63 if (
f.InitCheck() == B_OK) {
64 BAppFileInfo app_info(&
f);
65 if (app_info.InitCheck() == B_OK) {
66 char sig[B_MIME_TYPE_LENGTH];
67 if (app_info.GetSignature(sig) == B_OK)
68 signature = strndup(sig, B_MIME_TYPE_LENGTH);
85 if (SDL_BeAppActive <= 0) {
87 if (SDL_AppThread ==
NULL) {
88 return SDL_SetError(
"Couldn't create BApplication thread");
93 if (B_OK == be_app->GetAppInfo(&info)) {
94 entry_ref
ref = info.ref;
96 if (B_OK == entry.SetTo(&
ref)) {
98 if (B_OK ==
path.SetTo(&entry)) {
108 }
while ((be_app ==
NULL) || be_app->IsLaunching());
129 if (SDL_BeAppActive == 0) {
130 if (SDL_AppThread !=
NULL) {
131 if (be_app !=
NULL) {
132 be_app->PostMessage(B_QUIT_REQUESTED);
135 SDL_AppThread =
NULL;