From da827dbb091b0cba604e408854fa7d89f83c5b65 Mon Sep 17 00:00:00 2001 From: icculus Date: Tue, 15 Sep 2009 05:38:27 +0000 Subject: Added a real GUI message box to Sys_ErrorDialog() on Mac OS X. Fixes Bugzilla #3654. git-svn-id: svn://svn.icculus.org/quake3/trunk@1616 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/sys/sys_cocoa.m | 40 ++++++++++++++++++++++++++++++++++++++++ code/sys/sys_local.h | 1 + code/sys/sys_unix.c | 5 +++++ 3 files changed, 46 insertions(+) create mode 100644 code/sys/sys_cocoa.m (limited to 'code') diff --git a/code/sys/sys_cocoa.m b/code/sys/sys_cocoa.m new file mode 100644 index 0000000..7efa615 --- /dev/null +++ b/code/sys/sys_cocoa.m @@ -0,0 +1,40 @@ +/* +=========================================================================== +Copyright (C) 1999-2005 Id Software, Inc. + +This file is part of Quake III Arena source code. + +Quake III Arena source code is free software; you can redistribute it +and/or modify it under the terms of the GNU General Public License as +published by the Free Software Foundation; either version 2 of the License, +or (at your option) any later version. + +Quake III Arena source code is distributed in the hope that it will be +useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Quake III Arena source code; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +=========================================================================== +*/ + +#ifndef MACOS_X +#error This file is for Mac OS X only. You probably should not compile it. +#endif + +// Please note that this file is just some Mac-specific bits. Most of the +// Mac OS X code is shared with other Unix platforms in sys_unix.c ... + +#import + +void Sys_Cocoa_MsgBox( const char *text ) +{ + NSRunInformationalAlertPanel(@"ioquake3", + [NSString stringWithUTF8String:text], + @"OK", nil, nil); +} + +// end of sys_cocoa.m ... + diff --git a/code/sys/sys_local.h b/code/sys/sys_local.h index 6174876..09d0cc0 100644 --- a/code/sys/sys_local.h +++ b/code/sys/sys_local.h @@ -46,6 +46,7 @@ unsigned int CON_LogRead( char *out, unsigned int outSize ); #ifdef MACOS_X char *Sys_StripAppBundle( char *pwd ); +void Sys_Cocoa_MsgBox( const char *text ); #endif void Sys_GLimpSafeInit( void ); diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c index bcbb086..641770c 100644 --- a/code/sys/sys_unix.c +++ b/code/sys/sys_unix.c @@ -510,6 +510,11 @@ void Sys_ErrorDialog( const char *error ) Sys_Print( va( "%s\n", error ) ); +#if defined(MACOS_X) && !DEDICATED + if (!com_dedicated || !com_dedicated->integer) + Sys_Cocoa_MsgBox(error); +#endif + /* make sure the write path for the crashlog exists... */ if( FS_CreatePath( ospath ) ) { Com_Printf( "ERROR: couldn't create path '%s' for crash log.\n", ospath ); -- cgit v1.2.3