src/video/haiku/SDL_bvideo.cc
changeset 12082 09999a0e8f9a
parent 11811 5d94cb6b24d3
child 12201 8bdc4d340419
equal deleted inserted replaced
12081:277e57c09ff4 12082:09999a0e8f9a
    35 #include "SDL_bmodes.h"
    35 #include "SDL_bmodes.h"
    36 #include "SDL_bframebuffer.h"
    36 #include "SDL_bframebuffer.h"
    37 #include "SDL_bevents.h"
    37 #include "SDL_bevents.h"
    38 
    38 
    39 /* FIXME: Undefined functions */
    39 /* FIXME: Undefined functions */
    40 //    #define BE_PumpEvents NULL
    40 //    #define HAIKU_PumpEvents NULL
    41     #define BE_StartTextInput NULL
    41     #define HAIKU_StartTextInput NULL
    42     #define BE_StopTextInput NULL
    42     #define HAIKU_StopTextInput NULL
    43     #define BE_SetTextInputRect NULL
    43     #define HAIKU_SetTextInputRect NULL
    44 
    44 
    45 //    #define BE_DeleteDevice NULL
    45 //    #define HAIKU_DeleteDevice NULL
    46 
    46 
    47 /* End undefined functions */
    47 /* End undefined functions */
    48 
    48 
    49 static SDL_VideoDevice *
    49 static SDL_VideoDevice *
    50 BE_CreateDevice(int devindex)
    50 HAIKU_CreateDevice(int devindex)
    51 {
    51 {
    52     SDL_VideoDevice *device;
    52     SDL_VideoDevice *device;
    53     /*SDL_VideoData *data;*/
    53     /*SDL_VideoData *data;*/
    54 
    54 
    55     /* Initialize all variables that we clean on shutdown */
    55     /* Initialize all variables that we clean on shutdown */
    59     							  SDL_Quit() errors? */
    59     							  SDL_Quit() errors? */
    60 
    60 
    61 /* TODO: Figure out if any initialization needs to go here */
    61 /* TODO: Figure out if any initialization needs to go here */
    62 
    62 
    63     /* Set the function pointers */
    63     /* Set the function pointers */
    64     device->VideoInit = BE_VideoInit;
    64     device->VideoInit = HAIKU_VideoInit;
    65     device->VideoQuit = BE_VideoQuit;
    65     device->VideoQuit = HAIKU_VideoQuit;
    66     device->GetDisplayBounds = BE_GetDisplayBounds;
    66     device->GetDisplayBounds = HAIKU_GetDisplayBounds;
    67     device->GetDisplayModes = BE_GetDisplayModes;
    67     device->GetDisplayModes = HAIKU_GetDisplayModes;
    68     device->SetDisplayMode = BE_SetDisplayMode;
    68     device->SetDisplayMode = HAIKU_SetDisplayMode;
    69     device->PumpEvents = BE_PumpEvents;
    69     device->PumpEvents = HAIKU_PumpEvents;
    70 
    70 
    71     device->CreateSDLWindow = BE_CreateWindow;
    71     device->CreateSDLWindow = HAIKU_CreateWindow;
    72     device->CreateSDLWindowFrom = BE_CreateWindowFrom;
    72     device->CreateSDLWindowFrom = HAIKU_CreateWindowFrom;
    73     device->SetWindowTitle = BE_SetWindowTitle;
    73     device->SetWindowTitle = HAIKU_SetWindowTitle;
    74     device->SetWindowIcon = BE_SetWindowIcon;
    74     device->SetWindowIcon = HAIKU_SetWindowIcon;
    75     device->SetWindowPosition = BE_SetWindowPosition;
    75     device->SetWindowPosition = HAIKU_SetWindowPosition;
    76     device->SetWindowSize = BE_SetWindowSize;
    76     device->SetWindowSize = HAIKU_SetWindowSize;
    77     device->ShowWindow = BE_ShowWindow;
    77     device->ShowWindow = HAIKU_ShowWindow;
    78     device->HideWindow = BE_HideWindow;
    78     device->HideWindow = HAIKU_HideWindow;
    79     device->RaiseWindow = BE_RaiseWindow;
    79     device->RaiseWindow = HAIKU_RaiseWindow;
    80     device->MaximizeWindow = BE_MaximizeWindow;
    80     device->MaximizeWindow = HAIKU_MaximizeWindow;
    81     device->MinimizeWindow = BE_MinimizeWindow;
    81     device->MinimizeWindow = HAIKU_MinimizeWindow;
    82     device->RestoreWindow = BE_RestoreWindow;
    82     device->RestoreWindow = HAIKU_RestoreWindow;
    83     device->SetWindowBordered = BE_SetWindowBordered;
    83     device->SetWindowBordered = HAIKU_SetWindowBordered;
    84     device->SetWindowResizable = BE_SetWindowResizable;
    84     device->SetWindowResizable = HAIKU_SetWindowResizable;
    85     device->SetWindowFullscreen = BE_SetWindowFullscreen;
    85     device->SetWindowFullscreen = HAIKU_SetWindowFullscreen;
    86     device->SetWindowGammaRamp = BE_SetWindowGammaRamp;
    86     device->SetWindowGammaRamp = HAIKU_SetWindowGammaRamp;
    87     device->GetWindowGammaRamp = BE_GetWindowGammaRamp;
    87     device->GetWindowGammaRamp = HAIKU_GetWindowGammaRamp;
    88     device->SetWindowGrab = BE_SetWindowGrab;
    88     device->SetWindowGrab = HAIKU_SetWindowGrab;
    89     device->DestroyWindow = BE_DestroyWindow;
    89     device->DestroyWindow = HAIKU_DestroyWindow;
    90     device->GetWindowWMInfo = BE_GetWindowWMInfo;
    90     device->GetWindowWMInfo = HAIKU_GetWindowWMInfo;
    91     device->CreateWindowFramebuffer = BE_CreateWindowFramebuffer;
    91     device->CreateWindowFramebuffer = HAIKU_CreateWindowFramebuffer;
    92     device->UpdateWindowFramebuffer = BE_UpdateWindowFramebuffer;
    92     device->UpdateWindowFramebuffer = HAIKU_UpdateWindowFramebuffer;
    93     device->DestroyWindowFramebuffer = BE_DestroyWindowFramebuffer;
    93     device->DestroyWindowFramebuffer = HAIKU_DestroyWindowFramebuffer;
    94     
    94     
    95     device->shape_driver.CreateShaper = NULL;
    95     device->shape_driver.CreateShaper = NULL;
    96     device->shape_driver.SetWindowShape = NULL;
    96     device->shape_driver.SetWindowShape = NULL;
    97     device->shape_driver.ResizeWindowShape = NULL;
    97     device->shape_driver.ResizeWindowShape = NULL;
    98 
    98 
    99 #if SDL_VIDEO_OPENGL
    99 #if SDL_VIDEO_OPENGL
   100     device->GL_LoadLibrary = BE_GL_LoadLibrary;
   100     device->GL_LoadLibrary = HAIKU_GL_LoadLibrary;
   101     device->GL_GetProcAddress = BE_GL_GetProcAddress;
   101     device->GL_GetProcAddress = HAIKU_GL_GetProcAddress;
   102     device->GL_UnloadLibrary = BE_GL_UnloadLibrary;
   102     device->GL_UnloadLibrary = HAIKU_GL_UnloadLibrary;
   103     device->GL_CreateContext = BE_GL_CreateContext;
   103     device->GL_CreateContext = HAIKU_GL_CreateContext;
   104     device->GL_MakeCurrent = BE_GL_MakeCurrent;
   104     device->GL_MakeCurrent = HAIKU_GL_MakeCurrent;
   105     device->GL_SetSwapInterval = BE_GL_SetSwapInterval;
   105     device->GL_SetSwapInterval = HAIKU_GL_SetSwapInterval;
   106     device->GL_GetSwapInterval = BE_GL_GetSwapInterval;
   106     device->GL_GetSwapInterval = HAIKU_GL_GetSwapInterval;
   107     device->GL_SwapWindow = BE_GL_SwapWindow;
   107     device->GL_SwapWindow = HAIKU_GL_SwapWindow;
   108     device->GL_DeleteContext = BE_GL_DeleteContext;
   108     device->GL_DeleteContext = HAIKU_GL_DeleteContext;
   109 #endif
   109 #endif
   110 
   110 
   111     device->StartTextInput = BE_StartTextInput;
   111     device->StartTextInput = HAIKU_StartTextInput;
   112     device->StopTextInput = BE_StopTextInput;
   112     device->StopTextInput = HAIKU_StopTextInput;
   113     device->SetTextInputRect = BE_SetTextInputRect;
   113     device->SetTextInputRect = HAIKU_SetTextInputRect;
   114 
   114 
   115     device->SetClipboardText = BE_SetClipboardText;
   115     device->SetClipboardText = HAIKU_SetClipboardText;
   116     device->GetClipboardText = BE_GetClipboardText;
   116     device->GetClipboardText = HAIKU_GetClipboardText;
   117     device->HasClipboardText = BE_HasClipboardText;
   117     device->HasClipboardText = HAIKU_HasClipboardText;
   118 
   118 
   119     device->free = BE_DeleteDevice;
   119     device->free = HAIKU_DeleteDevice;
   120 
   120 
   121     return device;
   121     return device;
   122 }
   122 }
   123 
   123 
   124 VideoBootStrap HAIKU_bootstrap = {
   124 VideoBootStrap HAIKU_bootstrap = {
   125 	"haiku", "Haiku graphics",
   125 	"haiku", "Haiku graphics",
   126 	BE_Available, BE_CreateDevice
   126 	HAIKU_Available, HAIKU_CreateDevice
   127 };
   127 };
   128 
   128 
   129 void BE_DeleteDevice(SDL_VideoDevice * device)
   129 void HAIKU_DeleteDevice(SDL_VideoDevice * device)
   130 {
   130 {
   131 	SDL_free(device->driverdata);
   131 	SDL_free(device->driverdata);
   132 	SDL_free(device);
   132 	SDL_free(device);
   133 }
   133 }
   134 
   134 
   135 int BE_VideoInit(_THIS)
   135 int HAIKU_VideoInit(_THIS)
   136 {
   136 {
   137 	/* Initialize the Be Application for appserver interaction */
   137 	/* Initialize the Be Application for appserver interaction */
   138 	if (SDL_InitBeApp() < 0) {
   138 	if (SDL_InitBeApp() < 0) {
   139 		return -1;
   139 		return -1;
   140 	}
   140 	}
   141 	
   141 	
   142 	/* Initialize video modes */
   142 	/* Initialize video modes */
   143 	BE_InitModes(_this);
   143 	HAIKU_InitModes(_this);
   144 
   144 
   145 	/* Init the keymap */
   145 	/* Init the keymap */
   146 	BE_InitOSKeymap();
   146 	HAIKU_InitOSKeymap();
   147 	
   147 	
   148 	
   148 	
   149 #if SDL_VIDEO_OPENGL
   149 #if SDL_VIDEO_OPENGL
   150         /* testgl application doesn't load library, just tries to load symbols */
   150         /* testgl application doesn't load library, just tries to load symbols */
   151         /* is it correct? if so we have to load library here */
   151         /* is it correct? if so we have to load library here */
   152     BE_GL_LoadLibrary(_this, NULL);
   152     HAIKU_GL_LoadLibrary(_this, NULL);
   153 #endif
   153 #endif
   154 
   154 
   155         /* We're done! */
   155         /* We're done! */
   156     return (0);
   156     return (0);
   157 }
   157 }
   158 
   158 
   159 int BE_Available(void)
   159 int HAIKU_Available(void)
   160 {
   160 {
   161     return (1);
   161     return (1);
   162 }
   162 }
   163 
   163 
   164 void BE_VideoQuit(_THIS)
   164 void HAIKU_VideoQuit(_THIS)
   165 {
   165 {
   166 
   166 
   167     BE_QuitModes(_this);
   167     HAIKU_QuitModes(_this);
   168 
   168 
   169     SDL_QuitBeApp();
   169     SDL_QuitBeApp();
   170 }
   170 }
   171 
   171 
   172 #ifdef __cplusplus
   172 #ifdef __cplusplus