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