src/video/nacl/SDL_naclwindow.c
author Sam Lantinga <slouken@libsdl.org>
Tue, 26 May 2015 06:27:46 -0700
changeset 9619 b94b6d0bff0f
parent 8879 f6e4f24df1ac
child 9998 f67cf37e9cd4
permissions -rw-r--r--
Updated the copyright year to 2015
gabomdq@8833
     1
/*
gabomdq@8833
     2
  Simple DirectMedia Layer
slouken@9619
     3
  Copyright (C) 1997-2015 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
sbc@8879
    27
#include "../../events/SDL_mouse_c.h"
sbc@8879
    28
#include "../../events/SDL_keyboard_c.h"
gabomdq@8833
    29
#include "SDL_naclvideo.h"
gabomdq@8833
    30
#include "SDL_naclwindow.h"
gabomdq@8833
    31
gabomdq@8833
    32
int
gabomdq@8833
    33
NACL_CreateWindow(_THIS, SDL_Window * window)
gabomdq@8833
    34
{
gabomdq@8833
    35
    SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
gabomdq@8833
    36
    
gabomdq@8833
    37
    if (driverdata->window) {
gabomdq@8833
    38
        SDL_SetError("NaCl only supports one window");
gabomdq@8833
    39
        return -1;
gabomdq@8833
    40
    }
gabomdq@8833
    41
    driverdata->window = window;
gabomdq@8833
    42
gabomdq@8833
    43
    /* Adjust the window data to match the screen */
gabomdq@8833
    44
    window->x = 0;
gabomdq@8833
    45
    window->y = 0;
gabomdq@8833
    46
    window->w = driverdata->w;
gabomdq@8833
    47
    window->h = driverdata->h;
gabomdq@8833
    48
gabomdq@8833
    49
    window->flags &= ~SDL_WINDOW_RESIZABLE;     /* window is NEVER resizeable */
gabomdq@8833
    50
    window->flags |= SDL_WINDOW_FULLSCREEN;     /* window is always fullscreen */
gabomdq@8833
    51
    window->flags &= ~SDL_WINDOW_HIDDEN;
gabomdq@8833
    52
    window->flags |= SDL_WINDOW_SHOWN;          /* only one window on NaCl */
gabomdq@8833
    53
    window->flags |= SDL_WINDOW_INPUT_FOCUS;    /* always has input focus */    
gabomdq@8833
    54
    window->flags |= SDL_WINDOW_OPENGL;
gabomdq@8833
    55
  
gabomdq@8873
    56
    SDL_SetMouseFocus(window);
gabomdq@8873
    57
    SDL_SetKeyboardFocus(window);
gabomdq@8873
    58
    
gabomdq@8833
    59
    return 0;
gabomdq@8833
    60
}
gabomdq@8833
    61
gabomdq@8833
    62
void
gabomdq@8833
    63
NACL_SetWindowTitle(_THIS, SDL_Window * window)
gabomdq@8833
    64
{
gabomdq@8833
    65
    /* TODO */
gabomdq@8833
    66
}
gabomdq@8833
    67
gabomdq@8833
    68
void
gabomdq@8833
    69
NACL_DestroyWindow(_THIS, SDL_Window * window)
gabomdq@8833
    70
{
gabomdq@8833
    71
    SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
gabomdq@8833
    72
    if (window == driverdata->window) {
gabomdq@8833
    73
        driverdata->window = NULL;
gabomdq@8833
    74
    }
gabomdq@8833
    75
}
gabomdq@8833
    76
gabomdq@8833
    77
#endif /* SDL_VIDEO_DRIVER_NACL */
gabomdq@8833
    78
gabomdq@8833
    79
/* vi: set ts=4 sw=4 expandtab: */