src/video/android/SDL_androidwindow.c
author Sam Lantinga <slouken@libsdl.org>
Fri, 11 Feb 2011 00:25:44 -0800
changeset 5249 7a963be087ef
parent 5222 c66b2a778b7e
child 5262 b530ef003506
permissions -rw-r--r--
Mostly fixed fullscreen mode on Mac OS X, and you can toggle it on and off.

There are still some problems with the ConvertNSRect() calculations when switching video modes, which causes wierd window positioning issues, and the fullscreen window is still minimized on exit.
slouken@4998
     1
/*
slouken@4998
     2
    SDL - Simple DirectMedia Layer
slouken@4998
     3
    Copyright (C) 1997-2010 Sam Lantinga
slouken@4998
     4
slouken@4998
     5
    This library is free software; you can redistribute it and/or
slouken@4998
     6
    modify it under the terms of the GNU Lesser General Public
slouken@4998
     7
    License as published by the Free Software Foundation; either
slouken@4998
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@4998
     9
slouken@4998
    10
    This library is distributed in the hope that it will be useful,
slouken@4998
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@4998
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@4998
    13
    Lesser General Public License for more details.
slouken@4998
    14
slouken@4998
    15
    You should have received a copy of the GNU Lesser General Public
slouken@4998
    16
    License along with this library; if not, write to the Free Software
slouken@4998
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@4998
    18
slouken@4998
    19
    Sam Lantinga
slouken@4998
    20
    slouken@libsdl.org
slouken@4998
    21
*/
slouken@4998
    22
#include "SDL_config.h"
slouken@4998
    23
slouken@4998
    24
#include "../SDL_sysvideo.h"
slouken@4998
    25
slouken@4998
    26
#include "SDL_androidvideo.h"
slouken@4998
    27
#include "SDL_androidwindow.h"
slouken@4998
    28
slouken@4998
    29
int
slouken@4998
    30
Android_CreateWindow(_THIS, SDL_Window * window)
slouken@4998
    31
{
slouken@5001
    32
    if (Android_Window) {
slouken@5001
    33
        SDL_SetError("Android only supports one window");
slouken@5001
    34
        return -1;
slouken@5001
    35
    }
slouken@5001
    36
    Android_Window = window;
slouken@5001
    37
slouken@4998
    38
    /* Adjust the window data to match the screen */
slouken@4998
    39
    window->x = 0;
slouken@4998
    40
    window->y = 0;
slouken@4998
    41
    window->w = Android_ScreenWidth;
slouken@4998
    42
    window->h = Android_ScreenHeight;
slouken@4998
    43
slouken@5222
    44
    window->flags &= ~SDL_WINDOW_RESIZABLE;     /* window is NEVER resizeable */
slouken@5222
    45
    window->flags |= SDL_WINDOW_FULLSCREEN;     /* window is always fullscreen */
slouken@5222
    46
    window->flags |= SDL_WINDOW_SHOWN;          /* only one window on Android */
slouken@5222
    47
    window->flags |= SDL_WINDOW_INPUT_FOCUS;    /* always has input focus */    
slouken@5222
    48
slouken@4998
    49
    return 0;
slouken@4998
    50
}
slouken@4998
    51
slouken@4998
    52
void
slouken@4998
    53
Android_SetWindowTitle(_THIS, SDL_Window * window)
slouken@4998
    54
{
slouken@4998
    55
    Android_JNI_SetActivityTitle(window->title);
slouken@4998
    56
}
slouken@4998
    57
slouken@4998
    58
void
slouken@4998
    59
Android_DestroyWindow(_THIS, SDL_Window * window)
slouken@4998
    60
{
slouken@5001
    61
    if (window == Android_Window) {
slouken@5001
    62
        Android_Window = NULL;
slouken@5001
    63
    }
slouken@4998
    64
}
slouken@4998
    65
slouken@4998
    66
/* vi: set ts=4 sw=4 expandtab: */