|
Blender
V2.59
|
00001 /* 00002 * $Id: GHOST_DisplayManagerSDL.cpp 38349 2011-07-13 00:49:22Z gsrb3d $ 00003 * ***** BEGIN GPL LICENSE BLOCK ***** 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software Foundation, 00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 * 00019 * Contributor(s): Campbell Barton 00020 * 00021 * ***** END GPL LICENSE BLOCK ***** 00022 */ 00023 00028 #include "GHOST_SystemSDL.h" 00029 #include "GHOST_DisplayManagerSDL.h" 00030 00031 GHOST_DisplayManagerSDL::GHOST_DisplayManagerSDL(GHOST_SystemSDL *system) 00032 : 00033 GHOST_DisplayManager(), 00034 m_system(system) 00035 { 00036 /* do nothing */ 00037 } 00038 00039 GHOST_TSuccess 00040 GHOST_DisplayManagerSDL::getNumDisplays(GHOST_TUns8& numDisplays) 00041 { 00042 numDisplays= SDL_GetNumVideoDisplays(); 00043 return GHOST_kSuccess; 00044 } 00045 00046 00047 GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplaySettings(GHOST_TUns8 display, 00048 GHOST_TInt32& numSettings) 00049 { 00050 GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n"); 00051 numSettings= GHOST_TInt32(1); 00052 return GHOST_kSuccess; 00053 } 00054 00055 GHOST_TSuccess 00056 GHOST_DisplayManagerSDL::getDisplaySetting(GHOST_TUns8 display, 00057 GHOST_TInt32 index, 00058 GHOST_DisplaySetting& setting) 00059 { 00060 00061 GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n"); 00062 GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n"); 00063 SDL_DisplayMode mode; 00064 00065 SDL_GetDesktopDisplayMode(display, &mode); 00066 00067 setting.xPixels= mode.w; 00068 setting.yPixels= mode.h; 00069 setting.bpp= SDL_BYTESPERPIXEL(mode.format); 00070 /* assume 60 when unset */ 00071 setting.frequency= mode.refresh_rate ? mode.refresh_rate : 60; 00072 00073 return GHOST_kSuccess; 00074 } 00075 00076 GHOST_TSuccess 00077 GHOST_DisplayManagerSDL::getCurrentDisplaySetting(GHOST_TUns8 display, 00078 GHOST_DisplaySetting& setting) 00079 { 00080 return getDisplaySetting(display,GHOST_TInt32(0),setting); 00081 } 00082 00083 GHOST_TSuccess 00084 GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display, 00085 const GHOST_DisplaySetting& setting) 00086 { 00087 // This is never going to work robustly in X 00088 // but it's currently part of the full screen interface 00089 00090 // we fudge it for now. 00091 00092 return GHOST_kSuccess; 00093 }