Blender  V2.59
GHOST_DisplayManagerX11.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: GHOST_DisplayManagerX11.cpp 35152 2011-02-25 11:28:33Z jesterking $
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  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00020  * All rights reserved.
00021  *
00022  * The Original Code is: all of this file.
00023  *
00024  * Contributor(s): none yet.
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00034 #include "GHOST_DisplayManagerX11.h"
00035 #include "GHOST_SystemX11.h"
00036 
00037 
00038 
00039 GHOST_DisplayManagerX11::
00040 GHOST_DisplayManagerX11(
00041         GHOST_SystemX11 *system
00042 ) :
00043         GHOST_DisplayManager(),
00044         m_system(system)
00045 {
00046         //nothing to do.
00047 }
00048 
00049         GHOST_TSuccess 
00050 GHOST_DisplayManagerX11::
00051 getNumDisplays(
00052         GHOST_TUns8& numDisplays
00053 ) const{        
00054         numDisplays =  m_system->getNumDisplays();
00055         return GHOST_kSuccess;
00056 }
00057 
00058 
00059         GHOST_TSuccess 
00060 GHOST_DisplayManagerX11::
00061 getNumDisplaySettings(
00062         GHOST_TUns8 display,
00063         GHOST_TInt32& numSettings
00064 ) const{
00065         
00066         // We only have one X11 setting at the moment.
00067         GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");    
00068         numSettings = GHOST_TInt32(1);
00069         return GHOST_kSuccess;
00070 }
00071 
00072         GHOST_TSuccess 
00073 GHOST_DisplayManagerX11::
00074 getDisplaySetting(
00075         GHOST_TUns8 display,
00076         GHOST_TInt32 index,
00077         GHOST_DisplaySetting& setting
00078 ) const {
00079         
00080         GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");    
00081         GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n"); 
00082         
00083         Display * x_display = m_system->getXDisplay();
00084 
00085         if (x_display == NULL) {
00086                 return GHOST_kFailure;
00087         }
00088 
00089         setting.xPixels  = DisplayWidth(x_display, DefaultScreen(x_display));
00090         setting.yPixels = DisplayHeight(x_display, DefaultScreen(x_display));
00091         setting.bpp = DefaultDepth(x_display,DefaultScreen(x_display));
00092 
00093         // Don't think it's possible to get this value from X!
00094         // So let's guess!!
00095         setting.frequency = 60;
00096 
00097         return GHOST_kSuccess;
00098 }
00099         
00100         GHOST_TSuccess 
00101 GHOST_DisplayManagerX11::
00102 getCurrentDisplaySetting(
00103         GHOST_TUns8 display,
00104         GHOST_DisplaySetting& setting
00105 ) const {
00106         return getDisplaySetting(display,GHOST_TInt32(0),setting);
00107 }
00108 
00109 
00110         GHOST_TSuccess 
00111 GHOST_DisplayManagerX11::
00112 setCurrentDisplaySetting(
00113         GHOST_TUns8 display,
00114         const GHOST_DisplaySetting& setting
00115 ){
00116         // This is never going to work robustly in X 
00117         // but it's currently part of the full screen interface
00118 
00119         // we fudge it for now.
00120 
00121         return GHOST_kSuccess;
00122 }
00123 
00124 
00125 
00126