SDL 2.0
SDL_bvideo.cc
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21#include "../../SDL_internal.h"
22
23#if SDL_VIDEO_DRIVER_HAIKU
24
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#include "SDL_bkeyboard.h"
31#include "SDL_bwindow.h"
32#include "SDL_bclipboard.h"
33#include "SDL_bvideo.h"
34#include "SDL_bopengl.h"
35#include "SDL_bmodes.h"
36#include "SDL_bframebuffer.h"
37#include "SDL_bevents.h"
38
39/* FIXME: Undefined functions */
40// #define HAIKU_PumpEvents NULL
41 #define HAIKU_StartTextInput NULL
42 #define HAIKU_StopTextInput NULL
43 #define HAIKU_SetTextInputRect NULL
44
45// #define HAIKU_DeleteDevice NULL
46
47/* End undefined functions */
48
49static SDL_VideoDevice *
50HAIKU_CreateDevice(int devindex)
51{
53 /*SDL_VideoData *data;*/
54
55 /* Initialize all variables that we clean on shutdown */
57
58 device->driverdata = NULL; /* FIXME: Is this the cause of some of the
59 SDL_Quit() errors? */
60
61/* TODO: Figure out if any initialization needs to go here */
62
63 /* Set the function pointers */
64 device->VideoInit = HAIKU_VideoInit;
65 device->VideoQuit = HAIKU_VideoQuit;
66 device->GetDisplayBounds = HAIKU_GetDisplayBounds;
67 device->GetDisplayModes = HAIKU_GetDisplayModes;
68 device->SetDisplayMode = HAIKU_SetDisplayMode;
69 device->PumpEvents = HAIKU_PumpEvents;
70
71 device->CreateSDLWindow = HAIKU_CreateWindow;
72 device->CreateSDLWindowFrom = HAIKU_CreateWindowFrom;
73 device->SetWindowTitle = HAIKU_SetWindowTitle;
74 device->SetWindowIcon = HAIKU_SetWindowIcon;
75 device->SetWindowPosition = HAIKU_SetWindowPosition;
76 device->SetWindowSize = HAIKU_SetWindowSize;
77 device->ShowWindow = HAIKU_ShowWindow;
78 device->HideWindow = HAIKU_HideWindow;
79 device->RaiseWindow = HAIKU_RaiseWindow;
80 device->MaximizeWindow = HAIKU_MaximizeWindow;
81 device->MinimizeWindow = HAIKU_MinimizeWindow;
82 device->RestoreWindow = HAIKU_RestoreWindow;
83 device->SetWindowBordered = HAIKU_SetWindowBordered;
84 device->SetWindowResizable = HAIKU_SetWindowResizable;
85 device->SetWindowFullscreen = HAIKU_SetWindowFullscreen;
86 device->SetWindowGammaRamp = HAIKU_SetWindowGammaRamp;
87 device->GetWindowGammaRamp = HAIKU_GetWindowGammaRamp;
88 device->SetWindowGrab = HAIKU_SetWindowGrab;
89 device->DestroyWindow = HAIKU_DestroyWindow;
90 device->GetWindowWMInfo = HAIKU_GetWindowWMInfo;
91 device->CreateWindowFramebuffer = HAIKU_CreateWindowFramebuffer;
92 device->UpdateWindowFramebuffer = HAIKU_UpdateWindowFramebuffer;
93 device->DestroyWindowFramebuffer = HAIKU_DestroyWindowFramebuffer;
94
95 device->shape_driver.CreateShaper = NULL;
96 device->shape_driver.SetWindowShape = NULL;
97 device->shape_driver.ResizeWindowShape = NULL;
98
99#if SDL_VIDEO_OPENGL
100 device->GL_LoadLibrary = HAIKU_GL_LoadLibrary;
101 device->GL_GetProcAddress = HAIKU_GL_GetProcAddress;
102 device->GL_UnloadLibrary = HAIKU_GL_UnloadLibrary;
103 device->GL_CreateContext = HAIKU_GL_CreateContext;
104 device->GL_MakeCurrent = HAIKU_GL_MakeCurrent;
105 device->GL_SetSwapInterval = HAIKU_GL_SetSwapInterval;
106 device->GL_GetSwapInterval = HAIKU_GL_GetSwapInterval;
107 device->GL_SwapWindow = HAIKU_GL_SwapWindow;
108 device->GL_DeleteContext = HAIKU_GL_DeleteContext;
109#endif
110
111 device->StartTextInput = HAIKU_StartTextInput;
112 device->StopTextInput = HAIKU_StopTextInput;
113 device->SetTextInputRect = HAIKU_SetTextInputRect;
114
115 device->SetClipboardText = HAIKU_SetClipboardText;
116 device->GetClipboardText = HAIKU_GetClipboardText;
117 device->HasClipboardText = HAIKU_HasClipboardText;
118
120
121 return device;
122}
123
125 "haiku", "Haiku graphics",
126 HAIKU_Available, HAIKU_CreateDevice
127};
128
130{
131 SDL_free(device->driverdata);
133}
134
136{
137 /* Initialize the Be Application for appserver interaction */
138 if (SDL_InitBeApp() < 0) {
139 return -1;
140 }
141
142 /* Initialize video modes */
144
145 /* Init the keymap */
147
148#if SDL_VIDEO_OPENGL
149 /* testgl application doesn't load library, just tries to load symbols */
150 /* is it correct? if so we have to load library here */
151 HAIKU_GL_LoadLibrary(_this, NULL);
152#endif
153
154 /* We're done! */
155 return (0);
156}
157
158int HAIKU_Available(void)
159{
160 return (1);
161}
162
164{
165
167
169}
170
171#ifdef __cplusplus
172}
173#endif
174
175#endif /* SDL_VIDEO_DRIVER_HAIKU */
176
177/* vi: set ts=4 sw=4 expandtab: */
int SDL_InitBeApp(void)
void SDL_QuitBeApp(void)
#define _THIS
char * HAIKU_GetClipboardText(_THIS)
int HAIKU_SetClipboardText(_THIS, const char *text)
SDL_bool HAIKU_HasClipboardText(_THIS)
void HAIKU_PumpEvents(_THIS)
int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
void HAIKU_InitOSKeymap(void)
int HAIKU_QuitModes(_THIS)
int HAIKU_InitModes(_THIS)
void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
void HAIKU_DeleteDevice(_THIS)
int HAIKU_Available(void)
void HAIKU_VideoQuit(_THIS)
int HAIKU_VideoInit(_THIS)
void HAIKU_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
void HAIKU_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
void HAIKU_ShowWindow(_THIS, SDL_Window *window)
void HAIKU_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
int HAIKU_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
void HAIKU_SetWindowSize(_THIS, SDL_Window *window)
int HAIKU_CreateWindow(_THIS, SDL_Window *window)
void HAIKU_RestoreWindow(_THIS, SDL_Window *window)
int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window *window, Uint16 *ramp)
int HAIKU_SetWindowGammaRamp(_THIS, SDL_Window *window, const Uint16 *ramp)
void HAIKU_HideWindow(_THIS, SDL_Window *window)
void HAIKU_SetWindowPosition(_THIS, SDL_Window *window)
void HAIKU_DestroyWindow(_THIS, SDL_Window *window)
void HAIKU_RaiseWindow(_THIS, SDL_Window *window)
void HAIKU_SetWindowTitle(_THIS, SDL_Window *window)
void HAIKU_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
void HAIKU_MaximizeWindow(_THIS, SDL_Window *window)
void HAIKU_MinimizeWindow(_THIS, SDL_Window *window)
void HAIKU_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable)
#define SDL_free
#define SDL_calloc
VideoBootStrap HAIKU_bootstrap
static SDL_VideoDevice * _this
Definition: SDL_video.c:118
#define NULL
Definition: begin_code.h:167
static SDL_AudioDeviceID device
Definition: loopwave.c:37