the various changes that I forgot to commit (cleanup and so forth) into hg,

culminating in syncing with sm-ssc v1.0 public beta 2
This commit is contained in:
AJ Kelly
2010-03-31 17:37:09 -05:00
parent b279635401
commit 642f4b107c
80 changed files with 1200 additions and 918 deletions
+10 -10
View File
@@ -39,14 +39,14 @@ static bool DoCleanShutdown( int signal, siginfo_t *si, const ucontext_t *uc )
if( IsFatalSignal(signal) )
return false;
/* ^C. */
// ^C.
ArchHooks::SetUserQuit();
return true;
}
static bool DoCrashSignalHandler( int signal, siginfo_t *si, const ucontext_t *uc )
{
/* Don't dump a debug file if the user just hit ^C. */
// Don't dump a debug file if the user just hit ^C.
if( !IsFatalSignal(signal) )
return true;
@@ -63,14 +63,14 @@ static bool DoEmergencyShutdown( int signal, siginfo_t *si, const ucontext_t *us
void ArchHooks_MacOSX::Init()
{
/* First, handle non-fatal termination signals. */
// First, handle non-fatal termination signals.
SignalHandler::OnClose( DoCleanShutdown );
CrashHandler::CrashHandlerHandleArgs( g_argc, g_argv );
CrashHandler::InitializeCrashHandler();
SignalHandler::OnClose( DoCrashSignalHandler );
SignalHandler::OnClose( DoEmergencyShutdown );
/* Now that the crash handler is set up, disable crash reporter. */
// Now that the crash handler is set up, disable crash reporter.
// Breaks gdb
// task_set_exception_ports( mach_task_self(), EXC_MASK_ALL, MACH_PORT_NULL, EXCEPTION_DEFAULT, 0 );
@@ -220,7 +220,7 @@ RString ArchHooks_MacOSX::GetMachineId() const
void ArchHooks_MacOSX::DumpDebugInfo()
{
/* Get system version */
// Get system version
RString sSystemVersion;
{
long major = 0, minor = 0, bugFix = 0;
@@ -236,7 +236,7 @@ void ArchHooks_MacOSX::DumpDebugInfo()
size_t size;
#define GET_PARAM( name, var ) (size = sizeof(var), sysctlbyname(name, &var, &size, NULL, 0) )
/* Get memory */
// Get memory
float fRam;
char ramPower;
{
@@ -254,7 +254,7 @@ void ArchHooks_MacOSX::DumpDebugInfo()
}
}
/* Get processor information */
// Get processor information
int iMaxCPUs = 0;
int iCPUs = 0;
float fFreq;
@@ -314,7 +314,7 @@ void ArchHooks_MacOSX::DumpDebugInfo()
} while( false );
#undef GET_PARAM
/* Send all of the information to the log */
// Send all of the information to the log
LOG->Info( "Model: %s (%d/%d)", sModel.c_str(), iCPUs, iMaxCPUs );
LOG->Info( "Clock speed %.2f %cHz", fFreq, freqPower );
LOG->Info( "%s", sSystemVersion.c_str());
@@ -339,7 +339,7 @@ RString ArchHooks::GetPreferredLanguage()
CFStringRef lang;
if( CFArrayGetCount(languages) > 0 &&
(lang = (CFStringRef)CFArrayGetValueAtIndex(languages, 0)) != NULL )
(lang = (CFStringRef)CFArrayGetValueAtIndex(languages, 0)) != NULL )
{
// MacRoman agrees with ASCII in the low-order 7 bits.
const char *str = CFStringGetCStringPtr( lang, kCFStringEncodingMacRoman );
@@ -354,7 +354,7 @@ RString ArchHooks::GetPreferredLanguage()
bool ArchHooks_MacOSX::GoToURL( RString sUrl )
{
CFURLRef url = CFURLCreateWithBytes( kCFAllocatorDefault, (const UInt8*)sUrl.data(),
sUrl.length(), kCFStringEncodingUTF8, NULL );
sUrl.length(), kCFStringEncodingUTF8, NULL );
OSStatus result = LSOpenCFURLRef( url, NULL );
CFRelease( url );
@@ -670,7 +670,7 @@ static wchar_t ScancodeAndKeysToChar( DWORD scancode, unsigned char keys[256] )
{
static HKL layout = GetKeyboardLayout(0); // 0 == current thread
UINT vk = MapVirtualKeyEx( scancode, 1, layout );
static bool bInitialized = false;
typedef int (WINAPI TOUNICODEEX)( IN UINT wVirtKey, IN UINT wScanCode, IN CONST BYTE *lpKeyState, OUT LPWSTR pwszBuff, IN int cchBuff, IN UINT wFlags, IN HKL dwhkl );
+29 -31
View File
@@ -60,7 +60,7 @@ LowLevelWindow_X11::~LowLevelWindow_X11()
if( !m_bWasWindowed )
{
XRRSetScreenConfig( Dpy, g_pScreenConfig, RootWindow(Dpy, DefaultScreen(Dpy)), g_iOldSize, g_OldRotation, CurrentTime );
XUngrabKeyboard( Dpy, CurrentTime );
}
if( g_pContext )
@@ -94,8 +94,7 @@ void *LowLevelWindow_X11::GetProcAddress( RString s )
RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut )
{
#if defined(UNIX)
/*
* nVidia cards:
/* nVidia cards:
*
* This only works the first time we set up a window; after that, the
* drivers appear to cache the value, so you have to actually restart
@@ -118,13 +117,13 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
if( p.bpp == 32 )
{
visAttribs[i++] = GLX_RED_SIZE; visAttribs[i++] = 8;
visAttribs[i++] = GLX_RED_SIZE; visAttribs[i++] = 8;
visAttribs[i++] = GLX_GREEN_SIZE; visAttribs[i++] = 8;
visAttribs[i++] = GLX_BLUE_SIZE; visAttribs[i++] = 8;
}
else
{
visAttribs[i++] = GLX_RED_SIZE; visAttribs[i++] = 5;
visAttribs[i++] = GLX_RED_SIZE; visAttribs[i++] = 5;
visAttribs[i++] = GLX_GREEN_SIZE; visAttribs[i++] = 6;
visAttribs[i++] = GLX_BLUE_SIZE; visAttribs[i++] = 5;
}
@@ -143,7 +142,7 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
// So, let's recreate the window when changing that state.
if( !MakeWindow(Win, xvi->screen, xvi->depth, xvi->visual, p.width, p.height, !p.windowed) )
return "Failed to create the window.";
if( !MakeWindow(g_AltWindow, xvi->screen, xvi->depth, xvi->visual, p.width, p.height, !p.windowed) )
FAIL_M( "Failed to create the alt window." ); // Should this be fatal?
@@ -178,8 +177,7 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
}
else
{
// We're remodeling the existing window, and not touching the
// context.
// We're remodeling the existing window, and not touching the context.
bNewDeviceOut = false;
}
@@ -196,9 +194,9 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
int iSizesXct;
XRRScreenSize *pSizesX = XRRSizes( Dpy, DefaultScreen(Dpy), &iSizesXct );
ASSERT_M( iSizesXct != 0, "Couldn't get resolution list from X server" );
int iSizeMatch = -1;
for( int i = 0; i < iSizesXct; ++i )
{
if( pSizesX[i].width == p.width && pSizesX[i].height == p.height )
@@ -211,10 +209,10 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
// Set this mode.
// XXX: This doesn't handle if the config has changed since we queried it (see man Xrandr)
XRRSetScreenConfig( Dpy, g_pScreenConfig, RootWindow(Dpy, DefaultScreen(Dpy)), iSizeMatch, 1, CurrentTime );
// Move the window to the corner that the screen focuses in on.
XMoveWindow( Dpy, Win, 0, 0 );
XRaiseWindow( Dpy, Win );
// We want to prevent the WM from catching anything that comes from the keyboard.
@@ -275,21 +273,21 @@ void LowLevelWindow_X11::SwapBuffers()
if( PREFSMAN->m_bDisableScreenSaver )
{
/* Disable the screensaver. */
// Disable the screensaver.
#if defined(HAVE_LIBXTST)
/* This causes flicker. */
// This causes flicker.
// XForceScreenSaver( Dpy, ScreenSaverReset );
/*
* Instead, send a null relative mouse motion, to trick X into thinking there has been
* user activity.
/* Instead, send a null relative mouse motion, to trick X into thinking
* there has been user activity.
*
* This also handles XScreenSaver; XForceScreenSaver only handles the internal X11
* screen blanker.
* This also handles XScreenSaver; XForceScreenSaver only handles the
* internal X11 screen blanker.
*
* This will delay the X blanker, DPMS and XScreenSaver from activating, and will
* disable the blanker and XScreenSaver if they're already active (unless XSS is
* locked). For some reason, it doesn't un-blank DPMS if it's already active.
* This will delay the X blanker, DPMS and XScreenSaver from activating,
* and will disable the blanker and XScreenSaver if they're already active
* (unless XSS is locked). For some reason, it doesn't un-blank DPMS if
* it's already active.
*/
XLockDisplay( Dpy );
@@ -311,7 +309,7 @@ void LowLevelWindow_X11::GetDisplayResolutions( DisplayResolutions &out ) const
int iSizesXct;
XRRScreenSize *pSizesX = XRRSizes( Dpy, DefaultScreen( Dpy ), &iSizesXct );
ASSERT_M( iSizesXct != 0, "Couldn't get resolution list from X server" );
for( int i = 0; i < iSizesXct; ++i )
{
DisplayResolution res = { pSizesX[i].width, pSizesX[i].height, true };
@@ -334,8 +332,8 @@ public:
unsigned GetTexture() const { return m_iTexHandle; }
void StartRenderingTo();
void FinishRenderingTo();
/* Copying from the Pbuffer to the texture flips Y. */
// Copying from the Pbuffer to the texture flips Y.
virtual bool InvertY() const { return true; }
private:
@@ -373,7 +371,7 @@ RenderTarget_X11::~RenderTarget_X11()
* does not. */
void RenderTarget_X11::Create( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut )
{
//ASSERT( param.iWidth == power_of_two(param.iWidth) && param.iHeight == power_of_two(param.iHeight) );
//ASSERT( param.iWidth == power_of_two(param.iWidth) && param.iHeight == power_of_two(param.iHeight) );
m_iWidth = param.iWidth;
m_iHeight = param.iHeight;
@@ -423,10 +421,10 @@ void RenderTarget_X11::Create( const RenderTargetParam &param, int &iTextureWidt
glBindTexture( GL_TEXTURE_2D, m_iTexHandle );
LOG->Trace( "n %i, %ix%i", m_iTexHandle, param.iWidth, param.iHeight );
while( glGetError() != GL_NO_ERROR )
while( glGetError() != GL_NO_ERROR )
;
int iTextureWidth = power_of_two( param.iWidth );
int iTextureWidth = power_of_two( param.iWidth );
int iTextureHeight = power_of_two( param.iHeight );
iTextureWidthOut = iTextureWidth;
iTextureHeightOut = iTextureHeight;
@@ -458,7 +456,7 @@ void RenderTarget_X11::FinishRenderingTo()
glBindTexture( GL_TEXTURE_2D, m_iTexHandle );
while( glGetError() != GL_NO_ERROR )
while( glGetError() != GL_NO_ERROR )
;
glCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, m_iWidth, m_iHeight );
@@ -476,7 +474,7 @@ void RenderTarget_X11::FinishRenderingTo()
bool LowLevelWindow_X11::SupportsRenderToTexture() const
{
/* Server must support pbuffers: */
// Server must support pbuffers:
const int iScreen = DefaultScreen( Dpy );
float fVersion = strtof( glXQueryServerString(Dpy, iScreen, GLX_VERSION), NULL );
if( fVersion < 1.3f )