src/video/nacl/SDL_naclwindow.c
author Gabriel Jacobo <gabomdq@gmail.com>
Fri, 06 Jun 2014 15:45:59 -0300
changeset 8833 ae720d61d14d
child 8873 77ffe680093f
permissions -rw-r--r--
Chrome's Native Client backend implementation
gabomdq@8833
     1
/*
gabomdq@8833
     2
  Simple DirectMedia Layer
gabomdq@8833
     3
  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
gabomdq@8833
     4
gabomdq@8833
     5
  This software is provided 'as-is', without any express or implied
gabomdq@8833
     6
  warranty.  In no event will the authors be held liable for any damages
gabomdq@8833
     7
  arising from the use of this software.
gabomdq@8833
     8
gabomdq@8833
     9
  Permission is granted to anyone to use this software for any purpose,
gabomdq@8833
    10
  including commercial applications, and to alter it and redistribute it
gabomdq@8833
    11
  freely, subject to the following restrictions:
gabomdq@8833
    12
gabomdq@8833
    13
  1. The origin of this software must not be misrepresented; you must not
gabomdq@8833
    14
     claim that you wrote the original software. If you use this software
gabomdq@8833
    15
     in a product, an acknowledgment in the product documentation would be
gabomdq@8833
    16
     appreciated but is not required.
gabomdq@8833
    17
  2. Altered source versions must be plainly marked as such, and must not be
gabomdq@8833
    18
     misrepresented as being the original software.
gabomdq@8833
    19
  3. This notice may not be removed or altered from any source distribution.
gabomdq@8833
    20
*/
gabomdq@8833
    21
#include "../../SDL_internal.h"
gabomdq@8833
    22
gabomdq@8833
    23
#if SDL_VIDEO_DRIVER_NACL
gabomdq@8833
    24
gabomdq@8833
    25
#include "../SDL_sysvideo.h"
gabomdq@8833
    26
gabomdq@8833
    27
#include "SDL_naclvideo.h"
gabomdq@8833
    28
#include "SDL_naclwindow.h"
gabomdq@8833
    29
gabomdq@8833
    30
int
gabomdq@8833
    31
NACL_CreateWindow(_THIS, SDL_Window * window)
gabomdq@8833
    32
{
gabomdq@8833
    33
    SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
gabomdq@8833
    34
    
gabomdq@8833
    35
    if (driverdata->window) {
gabomdq@8833
    36
        SDL_SetError("NaCl only supports one window");
gabomdq@8833
    37
        return -1;
gabomdq@8833
    38
    }
gabomdq@8833
    39
    driverdata->window = window;
gabomdq@8833
    40
gabomdq@8833
    41
    /* Adjust the window data to match the screen */
gabomdq@8833
    42
    window->x = 0;
gabomdq@8833
    43
    window->y = 0;
gabomdq@8833
    44
    window->w = driverdata->w;
gabomdq@8833
    45
    window->h = driverdata->h;
gabomdq@8833
    46
gabomdq@8833
    47
    window->flags &= ~SDL_WINDOW_RESIZABLE;     /* window is NEVER resizeable */
gabomdq@8833
    48
    window->flags |= SDL_WINDOW_FULLSCREEN;     /* window is always fullscreen */
gabomdq@8833
    49
    window->flags &= ~SDL_WINDOW_HIDDEN;
gabomdq@8833
    50
    window->flags |= SDL_WINDOW_SHOWN;          /* only one window on NaCl */
gabomdq@8833
    51
    window->flags |= SDL_WINDOW_INPUT_FOCUS;    /* always has input focus */    
gabomdq@8833
    52
    window->flags |= SDL_WINDOW_OPENGL;
gabomdq@8833
    53
  
gabomdq@8833
    54
    return 0;
gabomdq@8833
    55
}
gabomdq@8833
    56
gabomdq@8833
    57
void
gabomdq@8833
    58
NACL_SetWindowTitle(_THIS, SDL_Window * window)
gabomdq@8833
    59
{
gabomdq@8833
    60
    /* TODO */
gabomdq@8833
    61
}
gabomdq@8833
    62
gabomdq@8833
    63
void
gabomdq@8833
    64
NACL_DestroyWindow(_THIS, SDL_Window * window)
gabomdq@8833
    65
{
gabomdq@8833
    66
    SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
gabomdq@8833
    67
    if (window == driverdata->window) {
gabomdq@8833
    68
        driverdata->window = NULL;
gabomdq@8833
    69
    }
gabomdq@8833
    70
}
gabomdq@8833
    71
gabomdq@8833
    72
#endif /* SDL_VIDEO_DRIVER_NACL */
gabomdq@8833
    73
gabomdq@8833
    74
/* vi: set ts=4 sw=4 expandtab: */