1/*
2    SDL - Simple DirectMedia Layer
3    Copyright (C) 1997-2012 Sam Lantinga
4    Copyright (C) 2001  Hsieh-Fu Tsai
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Library General Public
8    License as published by the Free Software Foundation; either
9    version 2 of the License, or (at your option) any later version.
10
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Library General Public License for more details.
15
16    You should have received a copy of the GNU Library General Public
17    License along with this library; if not, write to the Free
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20    Sam Lantinga
21    slouken@libsdl.org
22
23    Hsieh-Fu Tsai
24    clare@setabox.com
25*/
26#include "SDL_config.h"
27
28#include "SDL_stdinc.h"
29#include "SDL_nxmodes_c.h"
30
31SDL_Rect ** NX_ListModes (_THIS, SDL_PixelFormat * format, Uint32 flags)
32{
33    if (flags & SDL_FULLSCREEN)
34        return SDL_modelist ;
35
36    if (SDL_Visual.bpp == format -> BitsPerPixel) {
37        return ((SDL_Rect **) -1) ;
38    } else {
39        return ((SDL_Rect **) 0) ;
40    }
41}
42
43void NX_FreeVideoModes (_THIS)
44{
45    int i ;
46
47    if (SDL_modelist) {
48        for (i = 0; SDL_modelist [i]; ++ i) {
49            SDL_free (SDL_modelist [i]) ;
50        }
51        SDL_free (SDL_modelist) ;
52        SDL_modelist = NULL;
53    }
54}
55
56int NX_EnterFullScreen (_THIS)
57{
58    if (! currently_fullscreen) {
59        GR_SCREEN_INFO si ;
60
61        GrGetScreenInfo (& si) ;
62        GrResizeWindow (FSwindow, si.cols, si.rows) ;
63        GrUnmapWindow (SDL_Window) ;
64        GrMapWindow (FSwindow) ;
65        GrRaiseWindow (FSwindow) ;
66        GrSetFocus (FSwindow) ;
67        currently_fullscreen = 1 ;
68    }
69
70    return 1 ;
71}
72
73int NX_LeaveFullScreen (_THIS)
74{
75    if (currently_fullscreen) {
76        GrUnmapWindow (FSwindow) ;
77        GrMapWindow (SDL_Window) ;
78        GrRaiseWindow (SDL_Window) ;
79        GrSetFocus (SDL_Window) ;
80        currently_fullscreen = 0 ;
81    }
82
83    return 0 ;
84}
85