zenilib: zenilib/jni/external/sdl/src/video/bwindow/SDL_bvideo.cc Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_bvideo.cc
Go to the documentation of this file.
1 /*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2013 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_config.h"
22
23 #if SDL_VIDEO_DRIVER_BWINDOW
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 BE_PumpEvents NULL
41 #define BE_StartTextInput NULL
42 #define BE_StopTextInput NULL
43 #define BE_SetTextInputRect NULL
44
45 // #define BE_DeleteDevice NULL
46
47 /* End undefined functions */
48
49 static SDL_VideoDevice *
50 BE_CreateDevice(int devindex)
51 {
52 SDL_VideoDevice *device;
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 = BE_VideoInit;
65 device->VideoQuit = BE_VideoQuit;
66 device->GetDisplayBounds = BE_GetDisplayBounds;
67 device->GetDisplayModes = BE_GetDisplayModes;
68 device->SetDisplayMode = BE_SetDisplayMode;
69 device->PumpEvents = BE_PumpEvents;
70
71 device->CreateWindow = BE_CreateWindow;
72 device->CreateWindowFrom = BE_CreateWindowFrom;
73 device->SetWindowTitle = BE_SetWindowTitle;
74 device->SetWindowIcon = BE_SetWindowIcon;
75 device->SetWindowPosition = BE_SetWindowPosition;
76 device->SetWindowSize = BE_SetWindowSize;
77 device->ShowWindow = BE_ShowWindow;
78 device->HideWindow = BE_HideWindow;
79 device->RaiseWindow = BE_RaiseWindow;
80 device->MaximizeWindow = BE_MaximizeWindow;
81 device->MinimizeWindow = BE_MinimizeWindow;
82 device->RestoreWindow = BE_RestoreWindow;
83 device->SetWindowBordered = BE_SetWindowBordered;
84 device->SetWindowFullscreen = BE_SetWindowFullscreen;
85 device->SetWindowGammaRamp = BE_SetWindowGammaRamp;
86 device->GetWindowGammaRamp = BE_GetWindowGammaRamp;
87 device->SetWindowGrab = BE_SetWindowGrab;
88 device->DestroyWindow = BE_DestroyWindow;
89 device->GetWindowWMInfo = BE_GetWindowWMInfo;
90 device->CreateWindowFramebuffer = BE_CreateWindowFramebuffer;
91 device->UpdateWindowFramebuffer = BE_UpdateWindowFramebuffer;
92 device->DestroyWindowFramebuffer = BE_DestroyWindowFramebuffer;
93
94 device->shape_driver.CreateShaper = NULL;
95 device->shape_driver.SetWindowShape = NULL;
96 device->shape_driver.ResizeWindowShape = NULL;
97
98
99 device->GL_LoadLibrary = BE_GL_LoadLibrary;
100 device->GL_GetProcAddress = BE_GL_GetProcAddress;
101 device->GL_UnloadLibrary = BE_GL_UnloadLibrary;
102 device->GL_CreateContext = BE_GL_CreateContext;
103 device->GL_MakeCurrent = BE_GL_MakeCurrent;
104 device->GL_SetSwapInterval = BE_GL_SetSwapInterval;
105 device->GL_GetSwapInterval = BE_GL_GetSwapInterval;
106 device->GL_SwapWindow = BE_GL_SwapWindow;
107 device->GL_DeleteContext = BE_GL_DeleteContext;
108
109 device->StartTextInput = BE_StartTextInput;
110 device->StopTextInput = BE_StopTextInput;
111 device->SetTextInputRect = BE_SetTextInputRect;
112
113 device->SetClipboardText = BE_SetClipboardText;
114 device->GetClipboardText = BE_GetClipboardText;
115 device->HasClipboardText = BE_HasClipboardText;
116
117 device->free = BE_DeleteDevice;
118
119 return device;
120 }
121
122 VideoBootStrap BWINDOW_bootstrap = {
123 "bwindow", "BDirectWindow graphics",
124 BE_Available, BE_CreateDevice
125 };
126
127 void BE_DeleteDevice(SDL_VideoDevice * device)
128 {
129 SDL_free(device->driverdata);
130 SDL_free(device);
131 }
132
133 int BE_VideoInit(_THIS)
134 {
135 /* Initialize the Be Application for appserver interaction */
136 if (SDL_InitBeApp() < 0) {
137 return -1;
138 }
139
140 /* Initialize video modes */
141 BE_InitModes(_this);
142
143 /* Init the keymap */
144 BE_InitOSKeymap();
145
146
147 #if SDL_VIDEO_OPENGL
148 /* testgl application doesn't load library, just tries to load symbols */
149 /* is it correct? if so we have to load library here */
150 BE_GL_LoadLibrary(_this, NULL);
151 #endif
152
153 /* We're done! */
154 return (0);
155 }
156
157 int BE_Available(void)
158 {
159 return (1);
160 }
161
162 void BE_VideoQuit(_THIS)
163 {
164
165 BE_QuitModes(_this);
166
167 SDL_QuitBeApp();
168 }
169
170 #ifdef __cplusplus
171 }
172 #endif
173
174 #endif /* SDL_VIDEO_DRIVER_BWINDOW */
SDL_VideoDevice::GetDisplayModes
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
Definition: SDL_sysvideo.h:169
BE_InitModes
int BE_InitModes(_THIS)
BE_QuitModes
int BE_QuitModes(_THIS)
SDL_VideoDevice::MinimizeWindow
void(* MinimizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:195
SDL_VideoDevice::UpdateWindowFramebuffer
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
Definition: SDL_sysvideo.h:204
BE_DestroyWindow
void BE_DestroyWindow(_THIS, SDL_Window *window)
BE_SetWindowGammaRamp
int BE_SetWindowGammaRamp(_THIS, SDL_Window *window, const Uint16 *ramp)
SDL_VideoDevice::GetWindowWMInfo
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
Definition: SDL_sysvideo.h:215
BE_GL_LoadLibrary
int BE_GL_LoadLibrary(_THIS, const char *path)
SDL_VideoDevice::RaiseWindow
void(* RaiseWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:193
BE_CreateWindowFrom
int BE_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
BE_VideoInit
int BE_VideoInit(_THIS)
BE_GL_UnloadLibrary
void BE_GL_UnloadLibrary(_THIS)
BE_RaiseWindow
void BE_RaiseWindow(_THIS, SDL_Window *window)
SDL_VideoDevice::SetClipboardText
int(* SetClipboardText)(_THIS, const char *text)
Definition: SDL_sysvideo.h:254
SDL_calloc
DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size)
BE_SetWindowBordered
void BE_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
BE_DeleteDevice
void BE_DeleteDevice(_THIS)
NULL
#define NULL
Definition: ftobjs.h:61
SDL_VideoDevice::HideWindow
void(* HideWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:192
SDL_VideoDevice::GL_MakeCurrent
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
Definition: SDL_sysvideo.h:226
BE_HideWindow
void BE_HideWindow(_THIS, SDL_Window *window)
SDL_VideoDevice::GetWindowGammaRamp
int(* GetWindowGammaRamp)(_THIS, SDL_Window *window, Uint16 *ramp)
Definition: SDL_sysvideo.h:200
BE_GL_GetProcAddress
void * BE_GL_GetProcAddress(_THIS, const char *proc)
BE_GL_DeleteContext
void BE_GL_DeleteContext(_THIS, SDL_GLContext context)
BE_GetDisplayModes
void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
SDL_InitBeApp
int SDL_InitBeApp(void)
SDL_VideoDevice::StopTextInput
void(* StopTextInput)(_THIS)
Definition: SDL_sysvideo.h:244
SDL_VideoDevice::GetDisplayBounds
int(* GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
Definition: SDL_sysvideo.h:164
BE_RestoreWindow
void BE_RestoreWindow(_THIS, SDL_Window *window)
BE_GL_CreateContext
SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window *window)
SDL_VideoDevice::driverdata
void * driverdata
Definition: SDL_sysvideo.h:314
BE_SetDisplayMode
int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
SDL_free
DECLSPEC void SDLCALL SDL_free(void *mem)
SDL_VideoDevice::SetWindowGrab
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
Definition: SDL_sysvideo.h:201
SDL_QuitBeApp
void SDL_QuitBeApp(void)
SDL_VideoDevice::SetWindowIcon
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Definition: SDL_sysvideo.h:186
SDL_bmodes.h
BE_MinimizeWindow
void BE_MinimizeWindow(_THIS, SDL_Window *window)
BE_GetWindowWMInfo
SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
SDL_VideoDevice::CreateWindowFrom
int(* CreateWindowFrom)(_THIS, SDL_Window *window, const void *data)
Definition: SDL_sysvideo.h:184
SDL_bevents.h
SDL_config.h
SDL_VideoDevice::free
void(* free)(_THIS)
Definition: SDL_sysvideo.h:327
BE_CreateWindow
int BE_CreateWindow(_THIS, SDL_Window *window)
SDL_bframebuffer.h
BE_GetWindowGammaRamp
int BE_GetWindowGammaRamp(_THIS, SDL_Window *window, Uint16 *ramp)
SDL_bwindow.h
SDL_VideoDevice::GL_SetSwapInterval
int(* GL_SetSwapInterval)(_THIS, int interval)
Definition: SDL_sysvideo.h:228
BE_SetWindowPosition
void BE_SetWindowPosition(_THIS, SDL_Window *window)
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:92
BE_SetWindowGrab
void BE_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
SDL_VideoDevice::DestroyWindowFramebuffer
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:205
SDL_VideoDevice::CreateWindow
int(* CreateWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:183
SDL_VideoDevice::GL_UnloadLibrary
void(* GL_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:224
BE_SetWindowFullscreen
void BE_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
SDL_ShapeDriver::SetWindowShape
int(* SetWindowShape)(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
Definition: SDL_sysvideo.h:59
SDL_VideoDevice::VideoInit
int(* VideoInit)(_THIS)
Definition: SDL_sysvideo.h:148
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
VideoBootStrap
Definition: SDL_sysvideo.h:330
SDL_VideoDevice::SetWindowGammaRamp
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
Definition: SDL_sysvideo.h:199
BE_GL_GetSwapInterval
int BE_GL_GetSwapInterval(_THIS)
BE_GetClipboardText
char * BE_GetClipboardText(_THIS)
BE_SetClipboardText
int BE_SetClipboardText(_THIS, const char *text)
SDL_VideoDevice::SetWindowPosition
void(* SetWindowPosition)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:187
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::PumpEvents
void(* PumpEvents)(_THIS)
Definition: SDL_sysvideo.h:237
BE_UpdateWindowFramebuffer
int BE_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
SDL_ShapeDriver::CreateShaper
SDL_WindowShaper *(* CreateShaper)(SDL_Window *window)
Definition: SDL_sysvideo.h:58
SDL_VideoDevice::GL_GetSwapInterval
int(* GL_GetSwapInterval)(_THIS)
Definition: SDL_sysvideo.h:229
SDL_VideoDevice::GL_DeleteContext
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
Definition: SDL_sysvideo.h:231
SDL_VideoDevice::MaximizeWindow
void(* MaximizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:194
BE_CreateWindowFramebuffer
int BE_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
SDL_VideoDevice::DestroyWindow
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:202
SDL_bvideo.h
SDL_bclipboard.h
SDL_VideoDevice::SetTextInputRect
void(* SetTextInputRect)(_THIS, SDL_Rect *rect)
Definition: SDL_sysvideo.h:245
BE_DestroyWindowFramebuffer
void BE_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
SDL_VideoDevice::SetWindowSize
void(* SetWindowSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:188
SDL_VideoDevice::SetDisplayMode
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
Definition: SDL_sysvideo.h:177
BE_VideoQuit
void BE_VideoQuit(_THIS)
BE_GL_SetSwapInterval
int BE_GL_SetSwapInterval(_THIS, int interval)
BE_InitOSKeymap
void BE_InitOSKeymap()
SDL_VideoDevice::GetClipboardText
char *(* GetClipboardText)(_THIS)
Definition: SDL_sysvideo.h:255
SDL_VideoDevice::GL_CreateContext
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:225
BE_GL_MakeCurrent
int BE_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
SDL_VideoDevice::GL_LoadLibrary
int(* GL_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:222
SDL_VideoDevice::GL_SwapWindow
void(* GL_SwapWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:230
BE_Available
int BE_Available(void)
SDL_VideoDevice
Definition: SDL_sysvideo.h:135
SDL_VideoDevice::VideoQuit
void(* VideoQuit)(_THIS)
Definition: SDL_sysvideo.h:154
SDL_VideoDevice::ShowWindow
void(* ShowWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:191
SDL_VideoDevice::shape_driver
SDL_ShapeDriver shape_driver
Definition: SDL_sysvideo.h:212
SDL_VideoDevice::CreateWindowFramebuffer
int(* CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
Definition: SDL_sysvideo.h:203
SDL_bopengl.h
SDL_VideoDevice::HasClipboardText
SDL_bool(* HasClipboardText)(_THIS)
Definition: SDL_sysvideo.h:256
BE_SetWindowTitle
void BE_SetWindowTitle(_THIS, SDL_Window *window)
SDL_VideoDevice::SetWindowTitle
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:185
SDL_VideoDevice::SetWindowBordered
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
Definition: SDL_sysvideo.h:197
SDL_VideoDevice::StartTextInput
void(* StartTextInput)(_THIS)
Definition: SDL_sysvideo.h:243
SDL_VideoDevice::SetWindowFullscreen
void(* SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
Definition: SDL_sysvideo.h:198
BE_MaximizeWindow
void BE_MaximizeWindow(_THIS, SDL_Window *window)
BE_HasClipboardText
SDL_bool BE_HasClipboardText(_THIS)
BE_GL_SwapWindow
void BE_GL_SwapWindow(_THIS, SDL_Window *window)
SDL_VideoDevice::GL_GetProcAddress
void *(* GL_GetProcAddress)(_THIS, const char *proc)
Definition: SDL_sysvideo.h:223
BE_ShowWindow
void BE_ShowWindow(_THIS, SDL_Window *window)
BE_SetWindowSize
void BE_SetWindowSize(_THIS, SDL_Window *window)
SDL_ShapeDriver::ResizeWindowShape
int(* ResizeWindowShape)(SDL_Window *window)
Definition: SDL_sysvideo.h:60
SDL_VideoDevice::RestoreWindow
void(* RestoreWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:196
SDL_bkeyboard.h
BE_PumpEvents
void BE_PumpEvents(_THIS)