carbon

Are there any API to turn on DXVA in Mac OSX

I wrote a video playback application based on Carbon in MAC OSX, are there any API to turn on the DXVA feature which support by Graphic Card? Does it support in QuickTime SDK or Carbon API? ...

Help with OSSpinLock* usage to replace a while(true) {sleep(1);}

I am maintaining a carbon C++ application on OS X. There is a "spin lock" in one of the objects in the code that looks like this, while ( mState != RELEASED ) { sleep( 1 ); } There is a post render maintenance callback that is fed to AudioUnitAddRenderNotify() that would set the mState of these various objects. I was thinking about ...

Replacing CMNewProfileSearch with non-deprecated, 64-bit code

I have existing code that uses CMNewProfileSearch to find then iterate over the color profiles on the system getting their names and full paths. Unfortunately, CMNewProfileSearch is deprecated in Mac OS X 10.5 and is also unavailable when compiling a 64-bit application. In reading the ColorSync Manager 2.5 Reference, it seems like the ...

How do I programmatically get the shortcut keys reserved by Mac OS X

I'm working with an application that allows the customer to customize what shortcut keys are assigned. One thing I want to do is warn if a shortcut key is chosen that is already in use by Mac OS X. I'm trying to work with CopySymbolicHotKeys, but I'm not sure that I'm using it correctly as it lists commands as being reserved even thoug...

FSEvents weirdness on OS X Leopard

I want to monitor file-system events for a couple of directories on the mac. The directories I want to monitor might change at runtime, so using FSEvents here's what my app does: creates a global callback function to handle callbacks create a new FSEventStreamRef per folder, associating it with the callback created above and adding a c...

Marking file as executable on OSX using C (Carbon, standard C/C++)

I'm looking for a way to programatically set the 'executable' bit on a file on OS X. I don't want to invoke 'chmod a+x' but I want the same effect as the chmod call. Any suggestions? A carbon API or any other C/C++ function would work... ...

Mac OS X: Quickest way to kill/quit an entire process tree from within a Cocoa application.

I know there are many questions and answers about this, but I am looking for an efficient and robust solution. I need to kill a process AND all it's child processes from within a Cocoa app. I got the process ID and what I am about to code is to execute the kill command like so kill -- -<parent PID> from within my app ... but that seem...

Carbon/Cocoa fonts look different.

I'm trying to draw in the currently selected system font using the ATSU api in a Carbon app. And the fonts are coming out bolder than all the other native apps. Here is a screenshot example of what I'm talking about: The top line is XCode, and the middle is my app using a non-bold font and the bottom is my app using a bold font. I use...

Why does Spotlight sometimes not run my query?

I'm playing around with the Spotlight API, both the Carbon and Cocoa versions, and I seem to have the same problem crop up every once in a while: The query never runs, and never fires any notifications. However, I want to stress that most of the time it does run, so something strange is going on. I'm not writing any particular app. This...

Why is Xcode Giving Me These Errors?

The error I get is Xcode saying 3 things are un-declared (see below picture) But in the Header File I have declared them (see below picture) Why I am getting these errors when I have declared them. The Full Code: Header File. #import <Foundation/Foundation.h> @interface HotKeyController : NSObject { IBOutlet NSButton *cmdHK...

How do I take a screengrab of a single window using Cocoa or Carbon on OS X?

I need to be able to identify a single window on the user's screen and take a screen capture of it. The screen data is to be stored in memory and not written to disk. This is already supported through the commandline tool /usr/sbin/screencapture or through the Grab utility (though their functionality is not extensive enough to justify ...

Can I make this code work with Shortcut Recorder?

I have this code(below) to create a customizable Hot Key. OSStatus MyHotKeyHandler(EventHandlerCallRef nextHandler,EventRef theEvent,void *userData) { EventHotKeyID hkCom; GetEventParameter(theEvent,kEventParamDirectObject,typeEventHotKeyID,NULL,sizeof(hkCom),NULL,&hkCom); HotKeyController *controller = (HotKeyController *)u...

Listing and finding windows on OS X

I am trying to do some stuff on OS X using the carbon api, but I can't find anything I am looking for on google or the Apple development website. Ideally I would like to find a function that finds the window at a certain location on screen. It seems that there are similar functions, but one of them says that it only finds windows in th...

Resolving cast to pointer from integer of different size error in 64-bit conversion

I'm working on modifying the PTHotKeyLib to be 64-bit friendly, but I've run into an issue in the code that I'm not sure how to get around. In PTHotKeyCenter, the registerHotKey method create an EventHotKeyID instance and then stuffs the of PTHotKey object into the id attribute. The original code used a long. I converted it to NSInteg...

When are -framework and -I/System/.../Example.framework/Headers/ needed?

I am trying to compile a JNI library which uses carbon from the command line. If I don't -I/System/.../JavaVM.Framework/Headers/, It can't find any of the jni types, and gives errors. If I just -I/System/.../FlatCarbon.framework/Headers but don't "-framework Carbon", it compiles fine, but the linker gives an error about an undefined sy...

Working with AFP in Objective-C/Carbon

I'm working on an app that needs to transfer files to an AFP volume -- ideally, it wouldn't mount the volume on OSX, since it's really unnecessary. Looking over the AFP protocol stuff, I came across an old Carbon header file "afpDatastream.h". This used to be in the framework "AppleShareClientCore", however it's no longer there (on Leo...

Limiting Singleton instance to thread.

What is a good way to implement a singleton that will be restricted only to the thread that seeks its instance? Is there a thread id or something that I can use to do that? I'm using Carbon threading API but will have to implement this on windows and pure POSIX later too, so any technique is appreciated. ...

Which function does Leopard's Finder get the preview icons with the watermark on them?

I already took a look at GetIconRefFromFileInfo() and QLThumbnailImageCreate() but they just doesn't seem to be similar with what I see from the finder, which is a square icon with watermarks on it, e.g. if the file is RTF, it has this greyish watermark below that says RTF or RTFD or PDF... Please help me out on this. Thanks. If the que...

NSString to FSRef conversion doesn't work

Hi, For my app I need to use the Carbon file manager API to get the size of a folder (NSEnumerator is slow, and using NSTask with a shell command is even worse). I've imported the Carbon framework, and I'm using this method to get the size of a folder: http://www.cocoabuilder.com/archive/message/cocoa/2005/5/20/136503 It uses an FSRef...

Size discrepancy between size of folder from Finder and from Carbon file manager

Hi, I'm using this method by Dave DeLong to calculate the size of a folder using the Carbon File Manager API: http://github.com/davedelong/BuildCleaner/blob/b2712242b4eea1fff0e78a08b393a417e3019c8a/NSFileManager+FileSize.m (Its the first method there) The issue I'm having is that some folders (.app bundles in my case) are not reporti...