Added a real GUI message box to Sys_ErrorDialog() on Mac OS X.

Fixes Bugzilla #3654.
This commit is contained in:
Ryan C. Gordon 2009-09-15 05:38:27 +00:00
parent d03120f0b0
commit f8604a64f4
4 changed files with 63 additions and 0 deletions

View File

@ -1502,6 +1502,11 @@ else
$(B)/client/sys_unix.o $(B)/client/sys_unix.o
endif endif
ifeq ($(PLATFORM),darwin)
Q3OBJ += \
$(B)/client/sys_cocoa.o
endif
ifeq ($(USE_MUMBLE),1) ifeq ($(USE_MUMBLE),1)
Q3OBJ += \ Q3OBJ += \
$(B)/client/libmumblelink.o $(B)/client/libmumblelink.o
@ -1653,6 +1658,12 @@ else
$(B)/ded/con_tty.o $(B)/ded/con_tty.o
endif endif
# Not currently referenced in the dedicated server.
#ifeq ($(PLATFORM),darwin)
# Q3DOBJ += \
# $(B)/ded/sys_cocoa.o
#endif
$(B)/ioq3ded$(FULLBINEXT): $(Q3DOBJ) $(B)/ioq3ded$(FULLBINEXT): $(Q3DOBJ)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(Q3DOBJ) $(LIBS) $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(Q3DOBJ) $(LIBS)
@ -1979,6 +1990,9 @@ $(B)/clientsmp/%.o: $(SDLDIR)/%.c
$(B)/client/%.o: $(SYSDIR)/%.c $(B)/client/%.o: $(SYSDIR)/%.c
$(DO_CC) $(DO_CC)
$(B)/client/%.o: $(SYSDIR)/%.m
$(DO_CC)
$(B)/client/%.o: $(SYSDIR)/%.rc $(B)/client/%.o: $(SYSDIR)/%.rc
$(DO_WINDRES) $(DO_WINDRES)
@ -1998,6 +2012,9 @@ $(B)/ded/%.o: $(BLIBDIR)/%.c
$(B)/ded/%.o: $(SYSDIR)/%.c $(B)/ded/%.o: $(SYSDIR)/%.c
$(DO_DED_CC) $(DO_DED_CC)
$(B)/ded/%.o: $(SYSDIR)/%.m
$(DO_DED_CC)
$(B)/ded/%.o: $(SYSDIR)/%.rc $(B)/ded/%.o: $(SYSDIR)/%.rc
$(DO_WINDRES) $(DO_WINDRES)

40
code/sys/sys_cocoa.m Normal file
View File

@ -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 <Cocoa/Cocoa.h>
void Sys_Cocoa_MsgBox( const char *text )
{
NSRunInformationalAlertPanel(@"ioquake3",
[NSString stringWithUTF8String:text],
@"OK", nil, nil);
}
// end of sys_cocoa.m ...

View File

@ -46,6 +46,7 @@ unsigned int CON_LogRead( char *out, unsigned int outSize );
#ifdef MACOS_X #ifdef MACOS_X
char *Sys_StripAppBundle( char *pwd ); char *Sys_StripAppBundle( char *pwd );
void Sys_Cocoa_MsgBox( const char *text );
#endif #endif
void Sys_GLimpSafeInit( void ); void Sys_GLimpSafeInit( void );

View File

@ -510,6 +510,11 @@ void Sys_ErrorDialog( const char *error )
Sys_Print( va( "%s\n", 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... */ /* make sure the write path for the crashlog exists... */
if( FS_CreatePath( ospath ) ) { if( FS_CreatePath( ospath ) ) {
Com_Printf( "ERROR: couldn't create path '%s' for crash log.\n", ospath ); Com_Printf( "ERROR: couldn't create path '%s' for crash log.\n", ospath );