[quake3-commits] r1616 - in trunk: . code/sys

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Sep 15 01:38:27 EDT 2009


Author: icculus
Date: 2009-09-15 01:38:27 -0400 (Tue, 15 Sep 2009)
New Revision: 1616

Added:
   trunk/code/sys/sys_cocoa.m
Modified:
   trunk/Makefile
   trunk/code/sys/sys_local.h
   trunk/code/sys/sys_unix.c
Log:
Added a real GUI message box to Sys_ErrorDialog() on Mac OS X.

  Fixes Bugzilla #3654.


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2009-09-15 05:34:16 UTC (rev 1615)
+++ trunk/Makefile	2009-09-15 05:38:27 UTC (rev 1616)
@@ -1502,6 +1502,11 @@
     $(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 @@
     $(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)/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: $(SYSDIR)/%.c
 	$(DO_DED_CC)
 
+$(B)/ded/%.o: $(SYSDIR)/%.m
+	$(DO_DED_CC)
+
 $(B)/ded/%.o: $(SYSDIR)/%.rc
 	$(DO_WINDRES)
 

Added: trunk/code/sys/sys_cocoa.m
===================================================================
--- trunk/code/sys/sys_cocoa.m	                        (rev 0)
+++ trunk/code/sys/sys_cocoa.m	2009-09-15 05:38:27 UTC (rev 1616)
@@ -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 ...
+

Modified: trunk/code/sys/sys_local.h
===================================================================
--- trunk/code/sys/sys_local.h	2009-09-15 05:34:16 UTC (rev 1615)
+++ trunk/code/sys/sys_local.h	2009-09-15 05:38:27 UTC (rev 1616)
@@ -46,6 +46,7 @@
 
 #ifdef MACOS_X
 char *Sys_StripAppBundle( char *pwd );
+void Sys_Cocoa_MsgBox( const char *text );
 #endif
 
 void Sys_GLimpSafeInit( void );

Modified: trunk/code/sys/sys_unix.c
===================================================================
--- trunk/code/sys/sys_unix.c	2009-09-15 05:34:16 UTC (rev 1615)
+++ trunk/code/sys/sys_unix.c	2009-09-15 05:38:27 UTC (rev 1616)
@@ -510,6 +510,11 @@
 
 	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 );



More information about the quake3-commits mailing list