SDL_bvideo.cc
Go to the documentation of this file.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_VIDEO_DRIVER_HAIKU
#ifdef __cplusplus
extern "C" {
#endif
#include "SDL_bkeyboard.h"
#include "SDL_bwindow.h"
#include "SDL_bclipboard.h"
#include "SDL_bvideo.h"
#include "SDL_bopengl.h"
#include "SDL_bmodes.h"
#include "SDL_bframebuffer.h"
#include "SDL_bevents.h"
/* FIXME: Undefined functions */
// #define BE_PumpEvents NULL
#define BE_StartTextInput NULL
#define BE_StopTextInput NULL
#define BE_SetTextInputRect NULL
// #define BE_DeleteDevice NULL
/* End undefined functions */
static SDL_VideoDevice *
BE_CreateDevice(int devindex)
{
SDL_VideoDevice *device;
/*SDL_VideoData *data;*/
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
device->driverdata = NULL; /* FIXME: Is this the cause of some of the
SDL_Quit() errors? */
/* TODO: Figure out if any initialization needs to go here */
/* Set the function pointers */
device->VideoInit = BE_VideoInit;
device->VideoQuit = BE_VideoQuit;
device->GetDisplayBounds = BE_GetDisplayBounds;
device->GetDisplayModes = BE_GetDisplayModes;
device->SetDisplayMode = BE_SetDisplayMode;
device->PumpEvents = BE_PumpEvents;
device->CreateSDLWindow = BE_CreateWindow;
device->CreateSDLWindowFrom = BE_CreateWindowFrom;
device->SetWindowTitle = BE_SetWindowTitle;
device->SetWindowIcon = BE_SetWindowIcon;
device->SetWindowPosition = BE_SetWindowPosition;
device->SetWindowSize = BE_SetWindowSize;
device->ShowWindow = BE_ShowWindow;
device->HideWindow = BE_HideWindow;
device->RaiseWindow = BE_RaiseWindow;
device->MaximizeWindow = BE_MaximizeWindow;
device->MinimizeWindow = BE_MinimizeWindow;
device->RestoreWindow = BE_RestoreWindow;
device->SetWindowBordered = BE_SetWindowBordered;
device->SetWindowResizable = BE_SetWindowResizable;
device->SetWindowFullscreen = BE_SetWindowFullscreen;
device->SetWindowGammaRamp = BE_SetWindowGammaRamp;
device->GetWindowGammaRamp = BE_GetWindowGammaRamp;
device->SetWindowGrab = BE_SetWindowGrab;
device->DestroyWindow = BE_DestroyWindow;
device->GetWindowWMInfo = BE_GetWindowWMInfo;
device->CreateWindowFramebuffer = BE_CreateWindowFramebuffer;
device->UpdateWindowFramebuffer = BE_UpdateWindowFramebuffer;
device->DestroyWindowFramebuffer = BE_DestroyWindowFramebuffer;
device->shape_driver.CreateShaper = NULL;
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;
device->GL_CreateContext = BE_GL_CreateContext;
device->GL_MakeCurrent = BE_GL_MakeCurrent;
device->GL_SetSwapInterval = BE_GL_SetSwapInterval;
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;
device->SetTextInputRect = BE_SetTextInputRect;
device->SetClipboardText = BE_SetClipboardText;
device->GetClipboardText = BE_GetClipboardText;
device->HasClipboardText = BE_HasClipboardText;
device->free = BE_DeleteDevice;
return device;
}
VideoBootStrap HAIKU_bootstrap = {
"haiku", "Haiku graphics",
BE_Available, BE_CreateDevice
};
void BE_DeleteDevice(SDL_VideoDevice * device)
{
SDL_free(device->driverdata);
SDL_free(device);
}
int BE_VideoInit(_THIS)
{
/* Initialize the Be Application for appserver interaction */
if (SDL_InitBeApp() < 0) {
return -1;
}
/* Initialize video modes */
BE_InitModes(_this);
/* Init the keymap */
BE_InitOSKeymap();
#if SDL_VIDEO_OPENGL
/* testgl application doesn't load library, just tries to load symbols */
/* is it correct? if so we have to load library here */
BE_GL_LoadLibrary(_this, NULL);
#endif
/* We're done! */
return (0);
}
int BE_Available(void)
{
return (1);
}
void BE_VideoQuit(_THIS)
{
BE_QuitModes(_this);
SDL_QuitBeApp();
}
#ifdef __cplusplus
}
#endif
#endif /* SDL_VIDEO_DRIVER_HAIKU */
/* vi: set ts=4 sw=4 expandtab: */
BE_InitModes
int BE_InitModes(_THIS)
BE_QuitModes
int BE_QuitModes(_THIS)
BE_DestroyWindow
void BE_DestroyWindow(_THIS, SDL_Window *window)
BE_SetWindowGammaRamp
int BE_SetWindowGammaRamp(_THIS, SDL_Window *window, const Uint16 *ramp)
BE_CreateWindowFrom
int BE_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
BE_VideoInit
int BE_VideoInit(_THIS)
SDL_VideoDevice::RestoreWindow
void(* RestoreWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:227
BE_RaiseWindow
void BE_RaiseWindow(_THIS, SDL_Window *window)
BE_SetWindowBordered
void BE_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
BE_DeleteDevice
void BE_DeleteDevice(_THIS)
BE_HideWindow
void BE_HideWindow(_THIS, SDL_Window *window)
BE_SetWindowResizable
void BE_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable)
BE_GetDisplayModes
void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
SDL_InitBeApp
int SDL_InitBeApp(void)
SDL_VideoDevice::free
void(* free)(_THIS)
Definition: SDL_sysvideo.h:390
BE_RestoreWindow
void BE_RestoreWindow(_THIS, SDL_Window *window)
SDL_VideoDevice::driverdata
void * driverdata
Definition: SDL_sysvideo.h:377
SDL_VideoDevice::GL_SetSwapInterval
int(* GL_SetSwapInterval)(_THIS, int interval)
Definition: SDL_sysvideo.h:260
BE_SetDisplayMode
int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
SDL_VideoDevice::ShowWindow
void(* ShowWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:222
SDL_QuitBeApp
void SDL_QuitBeApp(void)
SDL_bmodes.h
SDL_VideoDevice::StartTextInput
void(* StartTextInput)(_THIS)
Definition: SDL_sysvideo.h:286
SDL_VideoDevice::SetWindowSize
void(* SetWindowSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:215
BE_MinimizeWindow
void BE_MinimizeWindow(_THIS, SDL_Window *window)
BE_GetWindowWMInfo
SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
SDL_bevents.h
SDL_VideoDevice::GL_LoadLibrary
int(* GL_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:254
BE_CreateWindow
int BE_CreateWindow(_THIS, SDL_Window *window)
HAIKU_bootstrap
VideoBootStrap HAIKU_bootstrap
SDL_bframebuffer.h
BE_GetWindowGammaRamp
int BE_GetWindowGammaRamp(_THIS, SDL_Window *window, Uint16 *ramp)
SDL_VideoDevice::SetDisplayMode
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
Definition: SDL_sysvideo.h:204
SDL_bwindow.h
SDL_VideoDevice::SetWindowBordered
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
Definition: SDL_sysvideo.h:228
BE_SetWindowPosition
void BE_SetWindowPosition(_THIS, SDL_Window *window)
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
BE_SetWindowGrab
void BE_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
SDL_VideoDevice::HideWindow
void(* HideWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:223
device
static SDL_AudioDeviceID device
Definition: loopwave.c:37
SDL_VideoDevice::RaiseWindow
void(* RaiseWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:224
SDL_ShapeDriver::SetWindowShape
int(* SetWindowShape)(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
Definition: SDL_sysvideo.h:61
SDL_VideoDevice::SetTextInputRect
void(* SetTextInputRect)(_THIS, SDL_Rect *rect)
Definition: SDL_sysvideo.h:288
SDL_VideoDevice::GetWindowWMInfo
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
Definition: SDL_sysvideo.h:247
SDL_VideoDevice::GL_CreateContext
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:257
BE_SetWindowFullscreen
void BE_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
SDL_VideoDevice::GL_MakeCurrent
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
Definition: SDL_sysvideo.h:258
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
VideoBootStrap
Definition: SDL_sysvideo.h:393
SDL_VideoDevice::GetDisplayBounds
int(* GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
Definition: SDL_sysvideo.h:181
SDL_VideoDevice::DestroyWindow
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:234
BE_GetClipboardText
char * BE_GetClipboardText(_THIS)
SDL_VideoDevice::StopTextInput
void(* StopTextInput)(_THIS)
Definition: SDL_sysvideo.h:287
SDL_VideoDevice::SetWindowIcon
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Definition: SDL_sysvideo.h:213
BE_SetClipboardText
int BE_SetClipboardText(_THIS, const char *text)
BE_SetWindowIcon
void BE_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
BE_GetDisplayBounds
int BE_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
SDL_VideoDevice::DestroyWindowFramebuffer
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:237
BE_UpdateWindowFramebuffer
int BE_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
SDL_VideoDevice::GL_UnloadLibrary
void(* GL_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:256
SDL_VideoDevice::GetDisplayModes
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
Definition: SDL_sysvideo.h:196
BE_InitOSKeymap
void BE_InitOSKeymap(void)
NULL
#define NULL
Definition: begin_code.h:164
SDL_VideoDevice::CreateSDLWindow
int(* CreateSDLWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:210
SDL_VideoDevice::VideoQuit
void(* VideoQuit)(_THIS)
Definition: SDL_sysvideo.h:166
BE_CreateWindowFramebuffer
int BE_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
SDL_ShapeDriver::CreateShaper
SDL_WindowShaper *(* CreateShaper)(SDL_Window *window)
Definition: SDL_sysvideo.h:60
SDL_bvideo.h
SDL_calloc
#define SDL_calloc
Definition: SDL_dynapi_overrides.h:375
SDL_bclipboard.h
BE_DestroyWindowFramebuffer
void BE_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
SDL_ShapeDriver::ResizeWindowShape
int(* ResizeWindowShape)(SDL_Window *window)
Definition: SDL_sysvideo.h:62
BE_VideoQuit
void BE_VideoQuit(_THIS)
SDL_VideoDevice::SetWindowPosition
void(* SetWindowPosition)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:214
SDL_VideoDevice::GL_SwapWindow
int(* GL_SwapWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:262
SDL_VideoDevice::GetWindowGammaRamp
int(* GetWindowGammaRamp)(_THIS, SDL_Window *window, Uint16 *ramp)
Definition: SDL_sysvideo.h:232
SDL_VideoDevice::MinimizeWindow
void(* MinimizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:226
BE_Available
int BE_Available(void)
SDL_VideoDevice
Definition: SDL_sysvideo.h:147
SDL_VideoDevice::HasClipboardText
SDL_bool(* HasClipboardText)(_THIS)
Definition: SDL_sysvideo.h:299
SDL_VideoDevice::shape_driver
SDL_ShapeDriver shape_driver
Definition: SDL_sysvideo.h:244
SDL_VideoDevice::VideoInit
int(* VideoInit)(_THIS)
Definition: SDL_sysvideo.h:160
SDL_VideoDevice::CreateSDLWindowFrom
int(* CreateSDLWindowFrom)(_THIS, SDL_Window *window, const void *data)
Definition: SDL_sysvideo.h:211
SDL_bopengl.h
SDL_VideoDevice::SetWindowFullscreen
void(* SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
Definition: SDL_sysvideo.h:230
SDL_VideoDevice::UpdateWindowFramebuffer
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
Definition: SDL_sysvideo.h:236
BE_SetWindowTitle
void BE_SetWindowTitle(_THIS, SDL_Window *window)
SDL_VideoDevice::GL_DeleteContext
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
Definition: SDL_sysvideo.h:263
SDL_VideoDevice::GetClipboardText
char *(* GetClipboardText)(_THIS)
Definition: SDL_sysvideo.h:298
SDL_VideoDevice::SetWindowTitle
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:212
SDL_VideoDevice::SetWindowResizable
void(* SetWindowResizable)(_THIS, SDL_Window *window, SDL_bool resizable)
Definition: SDL_sysvideo.h:229
SDL_VideoDevice::GL_GetSwapInterval
int(* GL_GetSwapInterval)(_THIS)
Definition: SDL_sysvideo.h:261
SDL_VideoDevice::MaximizeWindow
void(* MaximizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:225
SDL_VideoDevice::SetClipboardText
int(* SetClipboardText)(_THIS, const char *text)
Definition: SDL_sysvideo.h:297
BE_MaximizeWindow
void BE_MaximizeWindow(_THIS, SDL_Window *window)
SDL_VideoDevice::SetWindowGammaRamp
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
Definition: SDL_sysvideo.h:231
BE_HasClipboardText
SDL_bool BE_HasClipboardText(_THIS)
SDL_VideoDevice::SetWindowGrab
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
Definition: SDL_sysvideo.h:233
BE_ShowWindow
void BE_ShowWindow(_THIS, SDL_Window *window)
SDL_VideoDevice::CreateWindowFramebuffer
int(* CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
Definition: SDL_sysvideo.h:235
BE_SetWindowSize
void BE_SetWindowSize(_THIS, SDL_Window *window)
SDL_VideoDevice::GL_GetProcAddress
void *(* GL_GetProcAddress)(_THIS, const char *proc)
Definition: SDL_sysvideo.h:255
SDL_bkeyboard.h
BE_PumpEvents
void BE_PumpEvents(_THIS)
SDL_VideoDevice::PumpEvents
void(* PumpEvents)(_THIS)
Definition: SDL_sysvideo.h:280