macos-carbon

What to do about Carbon functions that are deprecated in MacOS/X 10.8.x?

こ雲淡風輕ζ 提交于 2020-01-01 11:41:07
问题 I have a C++ codebase that has been around for a while (10+ years) and it compiles and runs fine, but I notice that when I compile it under OS/X 10.8.x (Mountain Lion), the compiler emits deprecation warnings about some of the Carbon functions it calls: ../system/SetupSystem.cpp:575:44: warning: 'UpTime' is deprecated: first deprecated in OS X 10.8 [-Wdeprecated-declarations] ../system/SetupSystem.cpp:575:22: warning: 'AbsoluteToNanoseconds' is deprecated: first deprecated in OS X 10.8 [

Mac OS X Window Server vs. X11: the insane task

♀尐吖头ヾ 提交于 2020-01-01 03:23:08
问题 Dedicated to all who likes low-level Window Server (CoreGraphicsPrivate.h, etc), X11 on Mac, SIMBL and other crazy stuff :) There's a simple X11-emulated application on Mac (like xterm, xeyes and so on) with one window. While running, X11 somehow creates a native Quartz window to represent this emulated application, and this window is accessible via Quartz Window Services so that I can get its CSWindowID, title, position, size and owner's PID (PID of X11.app). But it does not support

What is equivalent usage of sendmessage()[WINDOWS] in MAC OS X?

99封情书 提交于 2019-12-25 07:49:57
问题 I have a ContextualMenuPlugin and an application. When user clicks the option from context menu i need to send a message to my app. In windows i achieved this using sendmessage() function. But i'm new to MAC OS X. Can any one please help me, by giving some api's or functions which will enlighten this situation? 回答1: You have plenty of choices on how to get messages into an application on your Macintosh. The ways I'm thinking of include Apple Events or sockets or kqueues, but there's other

Xcode 4.3 can't find Carbon libs on 10.7

前提是你 提交于 2019-12-25 07:29:23
问题 I am trying to compile a legacy Carbon app on Xcode 4.6, that used to compile nicely on 10.6, but doesn't on 10.8 and can't see to be able to find the Carbon or QT libs. How can I connect them back? Thanks, Bill 回答1: It turned out that I needed to copy the 10.6 SDK to the the XCode app: I found an old version and dragged a copy of: /Developer/SDKs/MacOSX10.6.sdk to: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs It now sits along side the MacOSX10.7.sdk

How to set an external application always being frontmost on OS X?

怎甘沉沦 提交于 2019-12-24 08:04:11
问题 I am trying to launch the built-in calculator.app on my Mac(which means it is external to my application) within my application and force the calculator to stay frontmost permanently on screen. Here is my process. Firstly, I launch the calculator and place it frontmost temporarily. if ([[NSWorkspace sharedWorkspace] respondsToSelector:@selector(launchApplicationAtURL:options:configuration:error:)]) [[NSWorkspace sharedWorkspace] launchApplicationAtURL:[NSURL fileURLWithPath:@"/Applications

Is there a way of getting the process id of my C++ application?

爱⌒轻易说出口 提交于 2019-12-23 12:16:53
问题 Is there a way of getting the process id of my C++ application? I am using the Carbon framework, but not Cocoa… 回答1: can you use the getpid() function found in unistd.h ? osx reference 回答2: GetProcessPID is what you need. This takes a ProcessSerialNumber, which you can obtain from GetCurrentProcess. 回答3: Note that you don't actually need to call GetCurrentProcess, you can use the constant kCurrentProcess. (But getpid is a lot less work if you're not trying to access another process's PID,

Tap AppleEvents being sent to another application

南楼画角 提交于 2019-12-23 03:47:08
问题 Is it possible to monitor or tap the stream of Apple Events being sent to a process, in the same way you can tap Quartz Events? I have an application that talks to another application to force it to import files, but it does so in a way that's unavailable through menus or UI scripting, and I'm trying to track down how it does this. 回答1: Do you need to do this programmatically or is manual/interactive OK? If manual is OK, here are some approaches: Try using AppleScript Editor to record the

custom shaped tracking area in cocoa

给你一囗甜甜゛ 提交于 2019-12-23 03:28:05
问题 How to create a custom shaped tracking area in cocoa ? In cocoa I could only find rectangles as tracking area. Carbon provided this functionality through HIViewNewTrackingArea , through which any HIShapeRef could be registered as a tracking area.Do we have something similar to this in cocoa ? I have a complex shape in which I want to change mouse cursors at different regions. One approach I tried was making a big tracking rectangle covering the whole area, and then changing cursor using

Strategies for porting Carbon code to Cocoa

时光怂恿深爱的人放手 提交于 2019-12-22 00:41:37
问题 I'm looking for strategies and articles on making Carbon code 64-bit ready. Carbon for 64-bit does not and will not exist. It's pretty much a dead end. So in order to bring Carbon application and toolkits to 64-bit their GUI part will have to be re-written in Cocoa and Objective-C, right? How can I minimize the effort I have to put into the transition? How can I minimize the amount of needed Objective-C code? 回答1: So in order to bring Carbon application and toolkits to 64-bit their GUI part

Get Current User from root mode?

北慕城南 提交于 2019-12-21 22:26:02
问题 I am writing a login item and I am trying to find if its possible to get the current user. Lets say, I have logged in with user "Test" and when I execute the exe with root privileges and if I use char *user = getenv("USER"); user is "root". My expected answer is "Test". How can I get it? I don't know if I can put objective c code in login item? Is it possible to NSUserName in login item. NSString *user = NSUserName(); 回答1: You want the SCDynamicStoreCopyConsoleUser function. QA1133 gives some