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 */
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 
119  device->free = HAIKU_DeleteDevice;
120 
121  return device;
122 }
123 
125  "haiku", "Haiku graphics",
126  HAIKU_Available, HAIKU_CreateDevice
127 };
128 
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: */
HAIKU_SetWindowTitle
void HAIKU_SetWindowTitle(_THIS, SDL_Window *window)
SDL_bframebuffer.h
SDL_InitBeApp
int SDL_InitBeApp(void)
HAIKU_CreateWindow
int HAIKU_CreateWindow(_THIS, SDL_Window *window)
HAIKU_QuitModes
int HAIKU_QuitModes(_THIS)
HAIKU_InitModes
int HAIKU_InitModes(_THIS)
HAIKU_RaiseWindow
void HAIKU_RaiseWindow(_THIS, SDL_Window *window)
HAIKU_MinimizeWindow
void HAIKU_MinimizeWindow(_THIS, SDL_Window *window)
HAIKU_SetWindowGammaRamp
int HAIKU_SetWindowGammaRamp(_THIS, SDL_Window *window, const Uint16 *ramp)
NULL
#define NULL
Definition: begin_code.h:164
HAIKU_CreateWindowFrom
int HAIKU_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
HAIKU_Available
int HAIKU_Available(void)
HAIKU_VideoInit
int HAIKU_VideoInit(_THIS)
SDL_bmodes.h
HAIKU_RestoreWindow
void HAIKU_RestoreWindow(_THIS, SDL_Window *window)
HAIKU_SetWindowGrab
void HAIKU_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
SDL_bevents.h
HAIKU_SetWindowResizable
void HAIKU_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable)
HAIKU_MaximizeWindow
void HAIKU_MaximizeWindow(_THIS, SDL_Window *window)
HAIKU_PumpEvents
void HAIKU_PumpEvents(_THIS)
HAIKU_SetClipboardText
int HAIKU_SetClipboardText(_THIS, const char *text)
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
HAIKU_VideoQuit
void HAIKU_VideoQuit(_THIS)
HAIKU_ShowWindow
void HAIKU_ShowWindow(_THIS, SDL_Window *window)
HAIKU_GetWindowWMInfo
SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
SDL_bwindow.h
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_QuitBeApp
void SDL_QuitBeApp(void)
HAIKU_InitOSKeymap
void HAIKU_InitOSKeymap(void)
HAIKU_SetWindowIcon
void HAIKU_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
HAIKU_DestroyWindow
void HAIKU_DestroyWindow(_THIS, SDL_Window *window)
HAIKU_CreateWindowFramebuffer
int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
HAIKU_GetWindowGammaRamp
int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window *window, Uint16 *ramp)
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
HAIKU_SetWindowSize
void HAIKU_SetWindowSize(_THIS, SDL_Window *window)
HAIKU_UpdateWindowFramebuffer
int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
HAIKU_SetWindowBordered
void HAIKU_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
HAIKU_SetWindowPosition
void HAIKU_SetWindowPosition(_THIS, SDL_Window *window)
SDL_VideoDevice
Definition: SDL_sysvideo.h:149
HAIKU_GetClipboardText
char * HAIKU_GetClipboardText(_THIS)
HAIKU_bootstrap
VideoBootStrap HAIKU_bootstrap
SDL_bopengl.h
SDL_calloc
#define SDL_calloc
Definition: SDL_dynapi_overrides.h:375
HAIKU_GetDisplayBounds
int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
HAIKU_HasClipboardText
SDL_bool HAIKU_HasClipboardText(_THIS)
HAIKU_SetDisplayMode
int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
SDL_bkeyboard.h
SDL_bclipboard.h
SDL_bvideo.h
HAIKU_HideWindow
void HAIKU_HideWindow(_THIS, SDL_Window *window)
HAIKU_DeleteDevice
void HAIKU_DeleteDevice(_THIS)
HAIKU_SetWindowFullscreen
void HAIKU_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
VideoBootStrap
Definition: SDL_sysvideo.h:398
device
static SDL_AudioDeviceID device
Definition: loopwave.c:37
HAIKU_GetDisplayModes
void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
HAIKU_DestroyWindowFramebuffer
void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window *window)