discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Command lien tools that use appkit


From: Ivan Vučica
Subject: Command lien tools that use appkit
Date: Wed, 23 May 2012 13:19:51 +0200

Hi,

for QuartzCore I'll be implementing small command-line tools that in fact open an AppKit window with NSOpenGLView as the content view.

This sort of thing is not officially supported in Cocoa (a bundle is required, or hacks with CPSEnableForegroundOperation() are required). However, it works just fine with GNUstep.

Except for one small error that I just noticed and don't remember seeing before.

"Bad application class '(null)' specified"

Looks like in gui's Source/Functions.m, NSApplicationMain() is explicitly demanding that the bundle and its info dictionary exist, and that NSPrincipalClass is specified, instead of either defaulting to NSApplication, or simply checking whether the class is already initialized.

Since NSApp is a global variable, this should work fine:

Index: Source/Functions.m
===================================================================
--- Source/Functions.m    (revision 35156)
+++ Source/Functions.m    (working copy)
@@ -70,7 +70,7 @@
   className = [infoDict objectForKey: @"NSPrincipalClass"];
   appClass = NSClassFromString(className);
 
-  if (appClass == 0)
+  if (appClass == 0 && NSApp == nil)
     {
       NSLog(@"Bad application class '%@' specified", className);
       appClass = [NSApplication class];

Thoughts?
--
Ivan Vučica - ivan@vucica.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]