3 * ***** BEGIN GPL LICENSE BLOCK *****
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.
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.
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.
19 * Contributor(s): Campbell Barton
21 * ***** END GPL LICENSE BLOCK *****
24 /** \file ghost/intern/GHOST_DisplayManagerSDL.cpp
28 #include "GHOST_SystemSDL.h"
29 #include "GHOST_DisplayManagerSDL.h"
31 GHOST_DisplayManagerSDL::GHOST_DisplayManagerSDL(GHOST_SystemSDL *system)
33 GHOST_DisplayManager(),
40 GHOST_DisplayManagerSDL::getNumDisplays(GHOST_TUns8& numDisplays)
42 numDisplays= SDL_GetNumVideoDisplays();
43 return GHOST_kSuccess;
47 GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplaySettings(GHOST_TUns8 display,
48 GHOST_TInt32& numSettings)
50 GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
51 numSettings= GHOST_TInt32(1);
52 return GHOST_kSuccess;
56 GHOST_DisplayManagerSDL::getDisplaySetting(GHOST_TUns8 display,
58 GHOST_DisplaySetting& setting)
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");
65 SDL_GetDesktopDisplayMode(display, &mode);
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;
73 return GHOST_kSuccess;
77 GHOST_DisplayManagerSDL::getCurrentDisplaySetting(GHOST_TUns8 display,
78 GHOST_DisplaySetting& setting)
80 return getDisplaySetting(display,GHOST_TInt32(0),setting);
84 GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display,
85 const GHOST_DisplaySetting& setting)
87 // This is never going to work robustly in X
88 // but it's currently part of the full screen interface
90 // we fudge it for now.
92 return GHOST_kSuccess;