src/video/haiku/SDL_bvideo.cc
author Sam Lantinga <slouken@libsdl.org>
Mon, 24 Sep 2018 11:49:25 -0700
changeset 12201 8bdc4d340419
parent 12082 09999a0e8f9a
child 12503 806492103856
permissions -rw-r--r--
Fixed whitespace
nathanheisey@5918
     1
/*
nathanheisey@5918
     2
  Simple DirectMedia Layer
slouken@11811
     3
  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
nathanheisey@5918
     4
nathanheisey@5918
     5
  This software is provided 'as-is', without any express or implied
nathanheisey@5918
     6
  warranty.  In no event will the authors be held liable for any damages
nathanheisey@5918
     7
  arising from the use of this software.
nathanheisey@5918
     8
nathanheisey@5918
     9
  Permission is granted to anyone to use this software for any purpose,
nathanheisey@5918
    10
  including commercial applications, and to alter it and redistribute it
nathanheisey@5918
    11
  freely, subject to the following restrictions:
nathanheisey@5918
    12
nathanheisey@5918
    13
  1. The origin of this software must not be misrepresented; you must not
nathanheisey@5918
    14
     claim that you wrote the original software. If you use this software
nathanheisey@5918
    15
     in a product, an acknowledgment in the product documentation would be
nathanheisey@5918
    16
     appreciated but is not required.
nathanheisey@5918
    17
  2. Altered source versions must be plainly marked as such, and must not be
nathanheisey@5918
    18
     misrepresented as being the original software.
nathanheisey@5918
    19
  3. This notice may not be removed or altered from any source distribution.
nathanheisey@5918
    20
*/
icculus@8093
    21
#include "../../SDL_internal.h"
nathanheisey@5918
    22
icculus@7981
    23
#if SDL_VIDEO_DRIVER_HAIKU
nathanheisey@5921
    24
nathanheisey@5921
    25
nathanheisey@5921
    26
#ifdef __cplusplus
nathanheisey@5921
    27
extern "C" {
nathanheisey@5921
    28
#endif
nathanheisey@5921
    29
nathanheisey@5928
    30
#include "SDL_bkeyboard.h"
nathanheisey@5918
    31
#include "SDL_bwindow.h"
nathanheisey@5918
    32
#include "SDL_bclipboard.h"
nathanheisey@5918
    33
#include "SDL_bvideo.h"
nathanheisey@5918
    34
#include "SDL_bopengl.h"
nathanheisey@5918
    35
#include "SDL_bmodes.h"
nathanheisey@5931
    36
#include "SDL_bframebuffer.h"
nathanheisey@5921
    37
#include "SDL_bevents.h"
nathanheisey@5918
    38
nathanheisey@5918
    39
/* FIXME: Undefined functions */
icculus@12082
    40
//    #define HAIKU_PumpEvents NULL
icculus@12082
    41
    #define HAIKU_StartTextInput NULL
icculus@12082
    42
    #define HAIKU_StopTextInput NULL
icculus@12082
    43
    #define HAIKU_SetTextInputRect NULL
nathanheisey@5918
    44
icculus@12082
    45
//    #define HAIKU_DeleteDevice NULL
nathanheisey@5918
    46
nathanheisey@5918
    47
/* End undefined functions */
nathanheisey@5918
    48
nathanheisey@5918
    49
static SDL_VideoDevice *
icculus@12082
    50
HAIKU_CreateDevice(int devindex)
nathanheisey@5918
    51
{
nathanheisey@5918
    52
    SDL_VideoDevice *device;
nathanheisey@5926
    53
    /*SDL_VideoData *data;*/
nathanheisey@5918
    54
nathanheisey@5918
    55
    /* Initialize all variables that we clean on shutdown */
nathanheisey@5918
    56
    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
nathanheisey@5918
    57
nathanheisey@5939
    58
    device->driverdata = NULL; /* FIXME: Is this the cause of some of the
slouken@12201
    59
                                  SDL_Quit() errors? */
nathanheisey@5939
    60
nathanheisey@5939
    61
/* TODO: Figure out if any initialization needs to go here */
nathanheisey@5918
    62
nathanheisey@5918
    63
    /* Set the function pointers */
icculus@12082
    64
    device->VideoInit = HAIKU_VideoInit;
icculus@12082
    65
    device->VideoQuit = HAIKU_VideoQuit;
icculus@12082
    66
    device->GetDisplayBounds = HAIKU_GetDisplayBounds;
icculus@12082
    67
    device->GetDisplayModes = HAIKU_GetDisplayModes;
icculus@12082
    68
    device->SetDisplayMode = HAIKU_SetDisplayMode;
icculus@12082
    69
    device->PumpEvents = HAIKU_PumpEvents;
nathanheisey@5918
    70
icculus@12082
    71
    device->CreateSDLWindow = HAIKU_CreateWindow;
icculus@12082
    72
    device->CreateSDLWindowFrom = HAIKU_CreateWindowFrom;
icculus@12082
    73
    device->SetWindowTitle = HAIKU_SetWindowTitle;
icculus@12082
    74
    device->SetWindowIcon = HAIKU_SetWindowIcon;
icculus@12082
    75
    device->SetWindowPosition = HAIKU_SetWindowPosition;
icculus@12082
    76
    device->SetWindowSize = HAIKU_SetWindowSize;
icculus@12082
    77
    device->ShowWindow = HAIKU_ShowWindow;
icculus@12082
    78
    device->HideWindow = HAIKU_HideWindow;
icculus@12082
    79
    device->RaiseWindow = HAIKU_RaiseWindow;
icculus@12082
    80
    device->MaximizeWindow = HAIKU_MaximizeWindow;
icculus@12082
    81
    device->MinimizeWindow = HAIKU_MinimizeWindow;
icculus@12082
    82
    device->RestoreWindow = HAIKU_RestoreWindow;
icculus@12082
    83
    device->SetWindowBordered = HAIKU_SetWindowBordered;
icculus@12082
    84
    device->SetWindowResizable = HAIKU_SetWindowResizable;
icculus@12082
    85
    device->SetWindowFullscreen = HAIKU_SetWindowFullscreen;
icculus@12082
    86
    device->SetWindowGammaRamp = HAIKU_SetWindowGammaRamp;
icculus@12082
    87
    device->GetWindowGammaRamp = HAIKU_GetWindowGammaRamp;
icculus@12082
    88
    device->SetWindowGrab = HAIKU_SetWindowGrab;
icculus@12082
    89
    device->DestroyWindow = HAIKU_DestroyWindow;
icculus@12082
    90
    device->GetWindowWMInfo = HAIKU_GetWindowWMInfo;
icculus@12082
    91
    device->CreateWindowFramebuffer = HAIKU_CreateWindowFramebuffer;
icculus@12082
    92
    device->UpdateWindowFramebuffer = HAIKU_UpdateWindowFramebuffer;
icculus@12082
    93
    device->DestroyWindowFramebuffer = HAIKU_DestroyWindowFramebuffer;
nathanheisey@5918
    94
    
nathanheisey@5918
    95
    device->shape_driver.CreateShaper = NULL;
nathanheisey@5918
    96
    device->shape_driver.SetWindowShape = NULL;
nathanheisey@5918
    97
    device->shape_driver.ResizeWindowShape = NULL;
nathanheisey@5931
    98
philipp@11130
    99
#if SDL_VIDEO_OPENGL
icculus@12082
   100
    device->GL_LoadLibrary = HAIKU_GL_LoadLibrary;
icculus@12082
   101
    device->GL_GetProcAddress = HAIKU_GL_GetProcAddress;
icculus@12082
   102
    device->GL_UnloadLibrary = HAIKU_GL_UnloadLibrary;
icculus@12082
   103
    device->GL_CreateContext = HAIKU_GL_CreateContext;
icculus@12082
   104
    device->GL_MakeCurrent = HAIKU_GL_MakeCurrent;
icculus@12082
   105
    device->GL_SetSwapInterval = HAIKU_GL_SetSwapInterval;
icculus@12082
   106
    device->GL_GetSwapInterval = HAIKU_GL_GetSwapInterval;
icculus@12082
   107
    device->GL_SwapWindow = HAIKU_GL_SwapWindow;
icculus@12082
   108
    device->GL_DeleteContext = HAIKU_GL_DeleteContext;
philipp@11130
   109
#endif
nathanheisey@5939
   110
icculus@12082
   111
    device->StartTextInput = HAIKU_StartTextInput;
icculus@12082
   112
    device->StopTextInput = HAIKU_StopTextInput;
icculus@12082
   113
    device->SetTextInputRect = HAIKU_SetTextInputRect;
nathanheisey@5918
   114
icculus@12082
   115
    device->SetClipboardText = HAIKU_SetClipboardText;
icculus@12082
   116
    device->GetClipboardText = HAIKU_GetClipboardText;
icculus@12082
   117
    device->HasClipboardText = HAIKU_HasClipboardText;
nathanheisey@5918
   118
icculus@12082
   119
    device->free = HAIKU_DeleteDevice;
nathanheisey@5918
   120
nathanheisey@5918
   121
    return device;
nathanheisey@5918
   122
}
nathanheisey@5918
   123
icculus@7981
   124
VideoBootStrap HAIKU_bootstrap = {
slouken@12201
   125
    "haiku", "Haiku graphics",
slouken@12201
   126
    HAIKU_Available, HAIKU_CreateDevice
nathanheisey@5921
   127
};
nathanheisey@5921
   128
icculus@12082
   129
void HAIKU_DeleteDevice(SDL_VideoDevice * device)
nathanheisey@5918
   130
{
slouken@12201
   131
    SDL_free(device->driverdata);
slouken@12201
   132
    SDL_free(device);
nathanheisey@5918
   133
}
nathanheisey@5918
   134
icculus@12082
   135
int HAIKU_VideoInit(_THIS)
nathanheisey@5918
   136
{
slouken@12201
   137
    /* Initialize the Be Application for appserver interaction */
slouken@12201
   138
    if (SDL_InitBeApp() < 0) {
slouken@12201
   139
        return -1;
slouken@12201
   140
    }
slouken@12201
   141
    
slouken@12201
   142
    /* Initialize video modes */
slouken@12201
   143
    HAIKU_InitModes(_this);
nathanheisey@5918
   144
slouken@12201
   145
    /* Init the keymap */
slouken@12201
   146
    HAIKU_InitOSKeymap();
slouken@12201
   147
nathanheisey@5918
   148
#if SDL_VIDEO_OPENGL
nathanheisey@5918
   149
        /* testgl application doesn't load library, just tries to load symbols */
nathanheisey@5918
   150
        /* is it correct? if so we have to load library here */
icculus@12082
   151
    HAIKU_GL_LoadLibrary(_this, NULL);
nathanheisey@5918
   152
#endif
nathanheisey@5918
   153
slouken@12201
   154
    /* We're done! */
nathanheisey@5918
   155
    return (0);
nathanheisey@5918
   156
}
nathanheisey@5918
   157
icculus@12082
   158
int HAIKU_Available(void)
nathanheisey@5918
   159
{
nathanheisey@5918
   160
    return (1);
nathanheisey@5918
   161
}
nathanheisey@5918
   162
icculus@12082
   163
void HAIKU_VideoQuit(_THIS)
nathanheisey@5918
   164
{
nathanheisey@5918
   165
icculus@12082
   166
    HAIKU_QuitModes(_this);
nathanheisey@5918
   167
nathanheisey@5918
   168
    SDL_QuitBeApp();
nathanheisey@5918
   169
}
nathanheisey@5918
   170
nathanheisey@5918
   171
#ifdef __cplusplus
nathanheisey@5918
   172
}
nathanheisey@5918
   173
#endif
slouken@6044
   174
icculus@7981
   175
#endif /* SDL_VIDEO_DRIVER_HAIKU */
slouken@10690
   176
slouken@10690
   177
/* vi: set ts=4 sw=4 expandtab: */