many mathutils exception types were wrong, went over all exceptions in mathutils...
[blender.git] / intern / ghost / intern / GHOST_DisplayManagerSDL.cpp
1 /*
2  * $Id$
3  * ***** BEGIN GPL LICENSE BLOCK *****
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program 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
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  * Contributor(s): Campbell Barton
20  *
21  * ***** END GPL LICENSE BLOCK *****
22  */
23
24 /** \file ghost/intern/GHOST_DisplayManagerSDL.cpp
25  *  \ingroup GHOST
26  */
27
28 #include "GHOST_SystemSDL.h"
29 #include "GHOST_DisplayManagerSDL.h"
30
31 GHOST_DisplayManagerSDL::GHOST_DisplayManagerSDL(GHOST_SystemSDL *system)
32     :
33       GHOST_DisplayManager(),
34       m_system(system)
35 {
36         /* do nothing */
37 }
38
39 GHOST_TSuccess
40 GHOST_DisplayManagerSDL::getNumDisplays(GHOST_TUns8& numDisplays)
41 {
42         numDisplays=  SDL_GetNumVideoDisplays();
43         return GHOST_kSuccess;
44 }
45
46
47 GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplaySettings(GHOST_TUns8 display,
48                                                               GHOST_TInt32& numSettings)
49 {
50         GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
51         numSettings= GHOST_TInt32(1);
52         return GHOST_kSuccess;
53 }
54
55 GHOST_TSuccess
56 GHOST_DisplayManagerSDL::getDisplaySetting(GHOST_TUns8 display,
57                                            GHOST_TInt32 index,
58                                            GHOST_DisplaySetting& setting)
59 {
60
61         GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
62         GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n");
63         SDL_DisplayMode mode;
64
65         SDL_GetDesktopDisplayMode(display, &mode);
66
67         setting.xPixels= mode.w;
68         setting.yPixels= mode.h;
69         setting.bpp= SDL_BYTESPERPIXEL(mode.format);
70         /* assume 60 when unset */
71         setting.frequency= mode.refresh_rate ? mode.refresh_rate : 60;
72
73         return GHOST_kSuccess;
74 }
75
76 GHOST_TSuccess
77 GHOST_DisplayManagerSDL::getCurrentDisplaySetting(GHOST_TUns8 display,
78                                                   GHOST_DisplaySetting& setting)
79 {
80         return getDisplaySetting(display,GHOST_TInt32(0),setting);
81 }
82
83 GHOST_TSuccess
84 GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display,
85                                                    const GHOST_DisplaySetting& setting)
86 {
87         // This is never going to work robustly in X
88         // but it's currently part of the full screen interface
89
90         // we fudge it for now.
91
92         return GHOST_kSuccess;
93 }