SDL  2.0
SDL_bvideo.cc
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2018 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
27 extern "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 
49 static SDL_VideoDevice *
50 HAIKU_CreateDevice(int devindex)
51 {
53  /*SDL_VideoData *data;*/
54 
55  /* Initialize all variables that we clean on shutdown */
56  device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
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;
69  device->PumpEvents = HAIKU_PumpEvents;
70 
77  device->ShowWindow = HAIKU_ShowWindow;
78  device->HideWindow = HAIKU_HideWindow;
94 
95  device->shape_driver.CreateShaper = 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 
118 
119  device->free = HAIKU_DeleteDevice;
120 
121  return device;
122 }
123 
125  "haiku", "Haiku graphics",
126  HAIKU_Available, HAIKU_CreateDevice
127 };
128 
129 void HAIKU_DeleteDevice(SDL_VideoDevice * device)
130 {
131  SDL_free(device->driverdata);
132  SDL_free(device);
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 
158 int HAIKU_Available(void)
159 {
160  return (1);
161 }
162 
164 {
165 
167 
168  SDL_QuitBeApp();
169 }
170 
171 #ifdef __cplusplus
172 }
173 #endif
174 
175 #endif /* SDL_VIDEO_DRIVER_HAIKU */
176 
177 /* vi: set ts=4 sw=4 expandtab: */