haiku: Fixed compiling without OpenGL support.

Philipp Wiesemann 2017-07-07 23:00:22 +02:00
parent fb9c2939c2
commit c3bf69ca4b
4 changed files with 17 additions and 3 deletions

View File

@ -22,7 +22,9 @@
#define SDL_BAPP_H #define SDL_BAPP_H
#include <InterfaceKit.h> #include <InterfaceKit.h>
#if SDL_VIDEO_OPENGL
#include <OpenGLKit.h> #include <OpenGLKit.h>
#endif
#include "../../video/haiku/SDL_bkeyboard.h" #include "../../video/haiku/SDL_bkeyboard.h"
@ -80,7 +82,9 @@ class SDL_BApp : public BApplication {
public: public:
SDL_BApp(const char* signature) : SDL_BApp(const char* signature) :
BApplication(signature) { BApplication(signature) {
#if SDL_VIDEO_OPENGL
_current_context = NULL; _current_context = NULL;
#endif
} }
@ -188,6 +192,7 @@ public:
return _window_map[winID]; return _window_map[winID];
} }
#if SDL_VIDEO_OPENGL
void SetCurrentContext(BGLView *newContext) { void SetCurrentContext(BGLView *newContext) {
if(_current_context) if(_current_context)
_current_context->UnlockGL(); _current_context->UnlockGL();
@ -195,6 +200,8 @@ public:
if (_current_context) if (_current_context)
_current_context->LockGL(); _current_context->LockGL();
} }
#endif
private: private:
/* Event management */ /* Event management */
void _HandleBasicWindowEvent(BMessage *msg, int32 sdlEventType) { void _HandleBasicWindowEvent(BMessage *msg, int32 sdlEventType) {
@ -384,7 +391,9 @@ private:
/* Members */ /* Members */
std::vector<SDL_Window*> _window_map; /* Keeps track of SDL_Windows by index-id */ std::vector<SDL_Window*> _window_map; /* Keeps track of SDL_Windows by index-id */
#if SDL_VIDEO_OPENGL
BGLView *_current_context; BGLView *_current_context;
#endif
}; };
#endif #endif

View File

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_VIDEO_DRIVER_HAIKU #if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL
#include "SDL_bopengl.h" #include "SDL_bopengl.h"
@ -171,6 +171,6 @@ void BE_GL_RebootContexts(_THIS) {
} }
#endif #endif
#endif /* SDL_VIDEO_DRIVER_HAIKU */ #endif /* SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */

View File

@ -22,6 +22,8 @@
#ifndef SDL_BOPENGL_H #ifndef SDL_BOPENGL_H
#define SDL_BOPENGL_H #define SDL_BOPENGL_H
#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -46,6 +48,8 @@ extern void BE_GL_RebootContexts(_THIS);
} }
#endif #endif
#endif /* SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL */
#endif #endif
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */

View File

@ -96,7 +96,7 @@ BE_CreateDevice(int devindex)
device->shape_driver.SetWindowShape = NULL; device->shape_driver.SetWindowShape = NULL;
device->shape_driver.ResizeWindowShape = NULL; device->shape_driver.ResizeWindowShape = NULL;
#if SDL_VIDEO_OPENGL
device->GL_LoadLibrary = BE_GL_LoadLibrary; device->GL_LoadLibrary = BE_GL_LoadLibrary;
device->GL_GetProcAddress = BE_GL_GetProcAddress; device->GL_GetProcAddress = BE_GL_GetProcAddress;
device->GL_UnloadLibrary = BE_GL_UnloadLibrary; device->GL_UnloadLibrary = BE_GL_UnloadLibrary;
@ -106,6 +106,7 @@ BE_CreateDevice(int devindex)
device->GL_GetSwapInterval = BE_GL_GetSwapInterval; device->GL_GetSwapInterval = BE_GL_GetSwapInterval;
device->GL_SwapWindow = BE_GL_SwapWindow; device->GL_SwapWindow = BE_GL_SwapWindow;
device->GL_DeleteContext = BE_GL_DeleteContext; device->GL_DeleteContext = BE_GL_DeleteContext;
#endif
device->StartTextInput = BE_StartTextInput; device->StartTextInput = BE_StartTextInput;
device->StopTextInput = BE_StopTextInput; device->StopTextInput = BE_StopTextInput;