mirror of
https://github.com/encounter/SDL.git
synced 2025-12-10 14:07:50 +00:00
haiku: Various fixes from haikuports.
Based on patch here: https://github.com/haikuports/haikuports/blob/master/media-libs/libsdl2/patches/libsdl2-2.0.5.patchset
This commit is contained in:
@@ -25,8 +25,10 @@
|
||||
/* Handle the BeApp specific portions of the application */
|
||||
|
||||
#include <AppKit.h>
|
||||
#include <storage/AppFileInfo.h>
|
||||
#include <storage/Path.h>
|
||||
#include <storage/Entry.h>
|
||||
#include <storage/File.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "SDL_BApp.h" /* SDL_BApp class definition */
|
||||
@@ -51,7 +53,24 @@ StartBeApp(void *unused)
|
||||
{
|
||||
BApplication *App;
|
||||
|
||||
App = new SDL_BApp("application/x-SDL-executable");
|
||||
// default application signature
|
||||
const char *signature = "application/x-SDL-executable";
|
||||
// dig resources for correct signature
|
||||
image_info info;
|
||||
int32 cookie = 0;
|
||||
if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
|
||||
BFile f(info.name, O_RDONLY);
|
||||
if (f.InitCheck() == B_OK) {
|
||||
BAppFileInfo app_info(&f);
|
||||
if (app_info.InitCheck() == B_OK) {
|
||||
char sig[B_MIME_TYPE_LENGTH];
|
||||
if (app_info.GetSignature(sig) == B_OK)
|
||||
signature = strndup(sig, B_MIME_TYPE_LENGTH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
App = new SDL_BApp(signature);
|
||||
|
||||
App->Run();
|
||||
delete App;
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef __HAIKU__
|
||||
#include <be/kernel/OS.h>
|
||||
#include <kernel/OS.h>
|
||||
#endif
|
||||
|
||||
#include "SDL_assert.h"
|
||||
|
||||
@@ -38,9 +38,9 @@ extern "C" {
|
||||
#include <stdio.h>
|
||||
#include <AppKit.h>
|
||||
#include <InterfaceKit.h>
|
||||
#include <be/game/DirectWindow.h>
|
||||
#include <game/DirectWindow.h>
|
||||
#if SDL_VIDEO_OPENGL
|
||||
#include <be/opengl/GLView.h>
|
||||
#include <opengl/GLView.h>
|
||||
#endif
|
||||
#include "SDL_events.h"
|
||||
#include "../../main/haiku/SDL_BApp.h"
|
||||
|
||||
@@ -94,7 +94,8 @@ int BE_GL_SwapWindow(_THIS, SDL_Window * window) {
|
||||
}
|
||||
|
||||
int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
|
||||
_GetBeApp()->SetCurrentContext(((SDL_BWin*)context)->GetGLView());
|
||||
SDL_BWin* win = (SDL_BWin*)context;
|
||||
_GetBeApp()->SetCurrentContext(win ? win->GetGLView() : NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user