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 --- Makefile | 17 +++++++++++++++++ code/sys/sys_cocoa.m | 40 ++++++++++++++++++++++++++++++++++++++++ code/sys/sys_local.h | 1 + code/sys/sys_unix.c | 5 +++++ 4 files changed, 63 insertions(+) create mode 100644 code/sys/sys_cocoa.m diff --git a/Makefile b/Makefile index d190f6d..b2ad6cb 100644 --- a/Makefile +++ b/Makefile @@ -1502,6 +1502,11 @@ else $(B)/client/sys_unix.o endif +ifeq ($(PLATFORM),darwin) + Q3OBJ += \ + $(B)/client/sys_cocoa.o +endif + ifeq ($(USE_MUMBLE),1) Q3OBJ += \ $(B)/client/libmumblelink.o @@ -1653,6 +1658,12 @@ else $(B)/ded/con_tty.o endif +# Not currently referenced in the dedicated server. +#ifeq ($(PLATFORM),darwin) +# Q3DOBJ += \ +# $(B)/ded/sys_cocoa.o +#endif + $(B)/ioq3ded$(FULLBINEXT): $(Q3DOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(Q3DOBJ) $(LIBS) @@ -1979,6 +1990,9 @@ $(B)/clientsmp/%.o: $(SDLDIR)/%.c $(B)/client/%.o: $(SYSDIR)/%.c $(DO_CC) +$(B)/client/%.o: $(SYSDIR)/%.m + $(DO_CC) + $(B)/client/%.o: $(SYSDIR)/%.rc $(DO_WINDRES) @@ -1998,6 +2012,9 @@ $(B)/ded/%.o: $(BLIBDIR)/%.c $(B)/ded/%.o: $(SYSDIR)/%.c $(DO_DED_CC) +$(B)/ded/%.o: $(SYSDIR)/%.m + $(DO_DED_CC) + $(B)/ded/%.o: $(SYSDIR)/%.rc $(DO_WINDRES) 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