Skip to content

Latest commit

 

History

History
177 lines (141 loc) · 5.43 KB

SDL_bvideo.cc

File metadata and controls

177 lines (141 loc) · 5.43 KB
 
1
2
/*
Simple DirectMedia Layer
Jan 3, 2018
Jan 3, 2018
3
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 */
Aug 7, 2018
Aug 7, 2018
40
41
42
43
// #define HAIKU_PumpEvents NULL
#define HAIKU_StartTextInput NULL
#define HAIKU_StopTextInput NULL
#define HAIKU_SetTextInputRect NULL
Aug 7, 2018
Aug 7, 2018
45
// #define HAIKU_DeleteDevice NULL
46
47
48
49
/* End undefined functions */
static SDL_VideoDevice *
Aug 7, 2018
Aug 7, 2018
50
HAIKU_CreateDevice(int devindex)
51
52
53
54
55
56
57
58
{
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
Sep 24, 2018
Sep 24, 2018
59
SDL_Quit() errors? */
60
61
62
63
/* TODO: Figure out if any initialization needs to go here */
/* Set the function pointers */
Aug 7, 2018
Aug 7, 2018
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
device->VideoInit = HAIKU_VideoInit;
device->VideoQuit = HAIKU_VideoQuit;
device->GetDisplayBounds = HAIKU_GetDisplayBounds;
device->GetDisplayModes = HAIKU_GetDisplayModes;
device->SetDisplayMode = HAIKU_SetDisplayMode;
device->PumpEvents = HAIKU_PumpEvents;
device->CreateSDLWindow = HAIKU_CreateWindow;
device->CreateSDLWindowFrom = HAIKU_CreateWindowFrom;
device->SetWindowTitle = HAIKU_SetWindowTitle;
device->SetWindowIcon = HAIKU_SetWindowIcon;
device->SetWindowPosition = HAIKU_SetWindowPosition;
device->SetWindowSize = HAIKU_SetWindowSize;
device->ShowWindow = HAIKU_ShowWindow;
device->HideWindow = HAIKU_HideWindow;
device->RaiseWindow = HAIKU_RaiseWindow;
device->MaximizeWindow = HAIKU_MaximizeWindow;
device->MinimizeWindow = HAIKU_MinimizeWindow;
device->RestoreWindow = HAIKU_RestoreWindow;
device->SetWindowBordered = HAIKU_SetWindowBordered;
device->SetWindowResizable = HAIKU_SetWindowResizable;
device->SetWindowFullscreen = HAIKU_SetWindowFullscreen;
device->SetWindowGammaRamp = HAIKU_SetWindowGammaRamp;
device->GetWindowGammaRamp = HAIKU_GetWindowGammaRamp;
device->SetWindowGrab = HAIKU_SetWindowGrab;
device->DestroyWindow = HAIKU_DestroyWindow;
device->GetWindowWMInfo = HAIKU_GetWindowWMInfo;
device->CreateWindowFramebuffer = HAIKU_CreateWindowFramebuffer;
device->UpdateWindowFramebuffer = HAIKU_UpdateWindowFramebuffer;
device->DestroyWindowFramebuffer = HAIKU_DestroyWindowFramebuffer;
94
95
96
97
98
device->shape_driver.CreateShaper = NULL;
device->shape_driver.SetWindowShape = NULL;
device->shape_driver.ResizeWindowShape = NULL;
Jul 7, 2017
Jul 7, 2017
99
#if SDL_VIDEO_OPENGL
Aug 7, 2018
Aug 7, 2018
100
101
102
103
104
105
106
107
108
device->GL_LoadLibrary = HAIKU_GL_LoadLibrary;
device->GL_GetProcAddress = HAIKU_GL_GetProcAddress;
device->GL_UnloadLibrary = HAIKU_GL_UnloadLibrary;
device->GL_CreateContext = HAIKU_GL_CreateContext;
device->GL_MakeCurrent = HAIKU_GL_MakeCurrent;
device->GL_SetSwapInterval = HAIKU_GL_SetSwapInterval;
device->GL_GetSwapInterval = HAIKU_GL_GetSwapInterval;
device->GL_SwapWindow = HAIKU_GL_SwapWindow;
device->GL_DeleteContext = HAIKU_GL_DeleteContext;
Jul 7, 2017
Jul 7, 2017
109
#endif
Aug 7, 2018
Aug 7, 2018
111
112
113
device->StartTextInput = HAIKU_StartTextInput;
device->StopTextInput = HAIKU_StopTextInput;
device->SetTextInputRect = HAIKU_SetTextInputRect;
Aug 7, 2018
Aug 7, 2018
115
116
117
device->SetClipboardText = HAIKU_SetClipboardText;
device->GetClipboardText = HAIKU_GetClipboardText;
device->HasClipboardText = HAIKU_HasClipboardText;
Aug 7, 2018
Aug 7, 2018
119
device->free = HAIKU_DeleteDevice;
120
121
122
123
124
return device;
}
VideoBootStrap HAIKU_bootstrap = {
Sep 24, 2018
Sep 24, 2018
125
126
"haiku", "Haiku graphics",
HAIKU_Available, HAIKU_CreateDevice
Aug 7, 2018
Aug 7, 2018
129
void HAIKU_DeleteDevice(SDL_VideoDevice * device)
Sep 24, 2018
Sep 24, 2018
131
132
SDL_free(device->driverdata);
SDL_free(device);
Aug 7, 2018
Aug 7, 2018
135
int HAIKU_VideoInit(_THIS)
Sep 24, 2018
Sep 24, 2018
137
138
139
140
141
142
143
144
145
146
147
/* Initialize the Be Application for appserver interaction */
if (SDL_InitBeApp() < 0) {
return -1;
}
/* Initialize video modes */
HAIKU_InitModes(_this);
/* Init the keymap */
HAIKU_InitOSKeymap();
148
149
150
#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 */
Aug 7, 2018
Aug 7, 2018
151
HAIKU_GL_LoadLibrary(_this, NULL);
Sep 24, 2018
Sep 24, 2018
154
/* We're done! */
155
156
157
return (0);
}
Aug 7, 2018
Aug 7, 2018
158
int HAIKU_Available(void)
159
160
161
162
{
return (1);
}
Aug 7, 2018
Aug 7, 2018
163
void HAIKU_VideoQuit(_THIS)
Aug 7, 2018
Aug 7, 2018
166
HAIKU_QuitModes(_this);
167
168
169
170
171
172
173
174
175
SDL_QuitBeApp();
}
#ifdef __cplusplus
}
#endif
#endif /* SDL_VIDEO_DRIVER_HAIKU */
Dec 9, 2016
Dec 9, 2016
176
177
/* vi: set ts=4 sw=4 expandtab: */