• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Cocoa<->Carbon troubles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cocoa<->Carbon troubles


  • Subject: Cocoa<->Carbon troubles
  • From: Tomas Zahradnicky <email@hidden>
  • Date: Wed, 21 Jul 2004 21:39:19 +0200

Hello,

Sorry for a pretty long mail but my (still) desperate attempts deserve some explanation (-:.

I'm in need of WebKit therefore I have to use Cocoa. Not that I did not like Cocoa (it's truly amazing!!), but I have to use C/C++ for a plug-in I'm programming and have to do that in CodeWarrior to match the structure of STL.

The problem I have is that I need to create NSWindow and embed WebView into it. I created a Cocoa bundle project in Xcode and put a simple code that creates a window first:

void* WVB_CreateWindow(const Rect *iRect)
{
NSWindow* progress = [[[NSWindow alloc] initWithContentRect:NSMakeRect(iRect->left,iRect->top,iRect->right-iRect->left,iRect->bottom-iRect->top) styleMask:NSBorderlessWindowMask backing:NSBackingStoreRetained defer:NO] autorelease];

[progress setHasShadow:NO];
[progress setOpaque:YES];

[progress makeKeyAndOrderFront:nil];

return progress;
}

and use Carbon code to load that bundle, find WVB_CreateWindow's function pointer and execute it. The problem is however that the application plug-in runs in is a Carbon app and therefore no NSApplication object exists and AppKit is not initialized. The program ends with:

*** Uncaught exception: <NSInternalInconsistencyException> Error (1002) creating CGSWindow

If the same code gets executed from a -(void)awakeFromNib method from a testing cocoa app that calls NSApplicationMain, everything works normal.


I'd like to get advised on how to:

a) have Cocoa/AppKit initialized (I assume I cannot call
NSApplicationMain(argc,argv) to not let underlying app go mad )

I don't know what AppKit does in its initialization but this seems that
it estabilishes a connection with WindowServer and creates a raw window
with CoreGraphics Services API. That would explain why the buffering
method is required with initWithContentRect method.

b) make this work
c) make this work better (-:

Thanks,

Tomas
--
Ing. Tomas Zahradnicky, Jr.
Quality Manager, 24U Software
Associate Member, FileMaker Solutions Alliance
mailto:email@hidden
http://www.24uSoftware.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Cocoa<->Carbon troubles
      • From: Frederick Cheung <email@hidden>
    • Re: Cocoa<->Carbon troubles
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Links in NSTextView
  • Next by Date: Re: Cocoa<->Carbon troubles
  • Previous by thread: Scale and NSCompositePlusDarker
  • Next by thread: Re: Cocoa<->Carbon troubles
  • Index(es):
    • Date
    • Thread