Atlas - SDL_bvideo.cc

Home / ext / SDL2 / src / video / haiku Lines: 1 | Size: 5503 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2018 Sam Lantinga <[email protected]> 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{ 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 = 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 124VideoBootStrap HAIKU_bootstrap = { 125 "haiku", "Haiku graphics", 126 HAIKU_Available, HAIKU_CreateDevice 127}; 128 129void HAIKU_DeleteDevice(SDL_VideoDevice * device) 130{ 131 SDL_free(device->driverdata); 132 SDL_free(device); 133} 134 135int HAIKU_VideoInit(_THIS) 136{ 137 /* Initialize the Be Application for appserver interaction */ 138 if (SDL_InitBeApp() < 0) { 139 return -1; 140 } 141 142 /* Initialize video modes */ 143 HAIKU_InitModes(_this); 144 145 /* Init the keymap */ 146 HAIKU_InitOSKeymap(); 147 148 149#if SDL_VIDEO_OPENGL 150 /* testgl application doesn't load library, just tries to load symbols */ 151 /* is it correct? if so we have to load library here */ 152 HAIKU_GL_LoadLibrary(_this, NULL); 153#endif 154 155 /* We're done! */ 156 return (0); 157} 158 159int HAIKU_Available(void) 160{ 161 return (1); 162} 163 164void HAIKU_VideoQuit(_THIS) 165{ 166 167 HAIKU_QuitModes(_this); 168 169 SDL_QuitBeApp(); 170} 171 172#ifdef __cplusplus 173} 174#endif 175 176#endif /* SDL_VIDEO_DRIVER_HAIKU */ 177 178/* vi: set ts=4 sw=4 expandtab: */ 179
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.