Skip to content

Commit

Permalink
haiku: Fixed compiling without OpenGL support.
Browse files Browse the repository at this point in the history
  • Loading branch information
philippwiesemann committed Jul 7, 2017
1 parent fb9c293 commit c3bf69c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/main/haiku/SDL_BApp.h
Expand Up @@ -22,7 +22,9 @@
#define SDL_BAPP_H

#include <InterfaceKit.h>
#if SDL_VIDEO_OPENGL
#include <OpenGLKit.h>
#endif

#include "../../video/haiku/SDL_bkeyboard.h"

Expand Down Expand Up @@ -80,7 +82,9 @@ class SDL_BApp : public BApplication {
public:
SDL_BApp(const char* signature) :
BApplication(signature) {
#if SDL_VIDEO_OPENGL
_current_context = NULL;
#endif
}


Expand Down Expand Up @@ -188,13 +192,16 @@ class SDL_BApp : public BApplication {
return _window_map[winID];
}

#if SDL_VIDEO_OPENGL
void SetCurrentContext(BGLView *newContext) {
if(_current_context)
_current_context->UnlockGL();
_current_context = newContext;
if (_current_context)
_current_context->LockGL();
}
#endif

private:
/* Event management */
void _HandleBasicWindowEvent(BMessage *msg, int32 sdlEventType) {
Expand Down Expand Up @@ -384,7 +391,9 @@ class SDL_BApp : public BApplication {
/* Members */
std::vector<SDL_Window*> _window_map; /* Keeps track of SDL_Windows by index-id */

#if SDL_VIDEO_OPENGL
BGLView *_current_context;
#endif
};

#endif
4 changes: 2 additions & 2 deletions src/video/haiku/SDL_bopengl.cc
Expand Up @@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"

#if SDL_VIDEO_DRIVER_HAIKU
#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL

#include "SDL_bopengl.h"

Expand Down Expand Up @@ -171,6 +171,6 @@ void BE_GL_RebootContexts(_THIS) {
}
#endif

#endif /* SDL_VIDEO_DRIVER_HAIKU */
#endif /* SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL */

/* vi: set ts=4 sw=4 expandtab: */
4 changes: 4 additions & 0 deletions src/video/haiku/SDL_bopengl.h
Expand Up @@ -22,6 +22,8 @@
#ifndef SDL_BOPENGL_H
#define SDL_BOPENGL_H

#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -46,6 +48,8 @@ extern void BE_GL_RebootContexts(_THIS);
}
#endif

#endif /* SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL */

#endif

/* vi: set ts=4 sw=4 expandtab: */
3 changes: 2 additions & 1 deletion src/video/haiku/SDL_bvideo.cc
Expand Up @@ -96,7 +96,7 @@ BE_CreateDevice(int devindex)
device->shape_driver.SetWindowShape = NULL;
device->shape_driver.ResizeWindowShape = NULL;


#if SDL_VIDEO_OPENGL
device->GL_LoadLibrary = BE_GL_LoadLibrary;
device->GL_GetProcAddress = BE_GL_GetProcAddress;
device->GL_UnloadLibrary = BE_GL_UnloadLibrary;
Expand All @@ -106,6 +106,7 @@ BE_CreateDevice(int devindex)
device->GL_GetSwapInterval = BE_GL_GetSwapInterval;
device->GL_SwapWindow = BE_GL_SwapWindow;
device->GL_DeleteContext = BE_GL_DeleteContext;
#endif

device->StartTextInput = BE_StartTextInput;
device->StopTextInput = BE_StopTextInput;
Expand Down

0 comments on commit c3bf69c

Please sign in to comment.