macos-carbon

A macro highlighted as keyword: pascal

杀马特。学长 韩版系。学妹 提交于 2019-12-06 07:15:21
问题 While looking in the sample code for FunkyOverlayWindow, I just found a pretty interesting declaration: pascal OSStatus MyHotKeyHandler( EventHandlerCallRef nextHandler, EventRef theEvent, void *userData ); Here, pascal is highlighted as a keyword (pink in standard Xcode color scheme). But I just found it's a macro, interestingly enough defined in file CarbonCore/ConditionalMacros.h as: #define pascal So, what is (or was) it supposed to do? Maybe it had some special use in the past? While

How do I determine if a user has a password set on Mac?

こ雲淡風輕ζ 提交于 2019-12-06 05:56:16
问题 I need to determine if a user has a non-empty password set on Mac. Anything will work: a command line call, AppleScript, Carbon, Cocoa, etc. I want to inform the user whether or not they have a password set. 回答1: I've found the answer to my question. Thanks anyway. dscl . -authonly <username> "" 回答2: If you are performing an action that would require any user to enter a password, then you should allow them the opportunity to verify that password even if it is empty, and then handle the

Exception wrapper for Carbon C app in OSX

旧巷老猫 提交于 2019-12-05 21:58:52
How can I efficiently catch and handle segmentation faults from C in an OSX Carbon application? Background: I am making an OSX Carbon application. I must call a library function from a third party. Because of threading issues, the function can occasionally crash, usually because it's updating itself from one thread, and it's got some internally stale pointer or handle as I query it from another. The function is a black box to me. I want to be able to call the function but be able to "catch" if it has crashed and supply an alternative return. In Windows, I can use the simple Visual C and Intel

Using `CGEventSourceSetLocalEventsSuppressionInterval` instead of the deprecated `CGSetLocalEventsSuppressionInterval`

白昼怎懂夜的黑 提交于 2019-12-05 17:56:58
When programmatically moving the mouse cursor, you must set CGSetLocalEventsSuppressionInterval to 0 so the events come in in real-time as opposed to with a 250 millisecond delay. Unfortunately, CGSetLocalEventsSuppressionInterval is marked as deprecated in Snow Leopard. The alternative is CGEventSourceSetLocalEventsSuppressionInterval(CGEventSourceRef source, CFTimeInterval seconds); https://developer.apple.com/library/mac/#documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#//apple_ref/c/func/CGEventSourceSetLocalEventsSuppressionInterval -(void) mouseMovement:

How to hide application icon from Mac OS X dock

一个人想着一个人 提交于 2019-12-05 16:26:29
I have a wxpython script, which creates a wx.App and a frame, hides it and does some processing using hidden frame. I do not want this script's icon to appear in Mac dock but it comes. So how can i hide it, I did not find anything in wxPython so it there some carbon API which I can call? Simplest python script makes icon to appear >>> import wx >>> app = wx.App() I was not able to find a way to hide app icon programmatically, only way seems to be to set LSUIElement=1 in Info.plist, so the apps which need to switch on and off icon depending on user option may have to have two app which share

Event taps: Varying results with CGEventPost, kCGSessionEventTap, kCGAnnotatedSessionEventTap, CGEventTapPostEvent

送分小仙女□ 提交于 2019-12-05 15:23:20
I'm running into a thorny problem with posting an event from an event tap. I'm tapping for NSSystemDefined at kCGHIDEventTap, then replacing the event with a new one. The problem I'm running in to is that depending on how I post the event, it's being seen only by some applications. My test applications are Opera, Firefox, Quicksilver, and Xcode. Here are the different techniques I've tried within my event tap callback, with results. I'm expecting an action (the "correct response") from each app; "system beep" means the nothing-is-bound-to-that-key system sound. Create a new event, and return

can't get wxHaskell to work from ghci on Mac

人走茶凉 提交于 2019-12-05 08:14:07
I'm trying to run an example using EnableGUI function . % ghci -framework Carbon Main.hs *Main> enableGUI >> main This is what I get instead of a working program: 2013-01-14 00:21:03.021 ghc[13403:1303] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-945.11/Misc.subproj/NSUndoManager.m:328 2013-01-14 00:21:03.022 ghc[13403:1303] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread. 2013-01-14 00:21:03.024 ghc[13403:1303] ( 0 CoreFoundation 0x00007fff8c8ea0a6 __exceptionPreprocess + 198 1 libobjc.A.dylib

How to refresh finder window?

喜你入骨 提交于 2019-12-05 04:33:21
问题 I want to refresh icon for particular file/folder in Finder application. FNNotifyByPath( (const UInt8 *)folderPath, kFNDirectoryModifiedMessage, kNilOptions ); FNNotifyByPath is not working for this. Now i am trying with appleScript +(void) refreshIconForItem : (NSString *)itemPath { NSString *source=[NSString stringWithFormat:@"tell application \"Finder\" to update \"%@\"",[NSString stringWithUTF8String:itemPath]]; NSAppleScript *update=[[NSAppleScript alloc] initWithSource:source];

Editing resource forks on the command line on Mac OS X

巧了我就是萌 提交于 2019-12-05 00:42:42
Mac OS X stores some files with resource forks. I need to create a file with a resource fork. The trouble is, I need to create this file on the command line. Is anyone aware of how you can create a file with a resource form on the command line in Mac OS X? You can directly access the resource fork of a file using path/to/file/..namedfork/rsrc. First, OS X doesn't really use resource forks... it supports named forks and HFS+ supports the resource forks, but that's mostly for backwards compatibility with OS 9 and old-style Carbon stuff... however, there are command line tools installed with the

Cocoa get Power Adapter Status

試著忘記壹切 提交于 2019-12-04 20:01:00
I'm currently working on a Backup Application, and I have received a lot of requests for features to be added recently, and the top one of them is adding a checkbox like "Back Up when on Battery Power" like Time Machine has. So, is there a way I can get the status of the Power Adapter (plugged in and plugged in)? I assume that if one had a Desktop Mac, like iMac, etc, I would probably just get Plugged In all the time. Therefore, I need means of detecting if the computer is a portable or not. I assume IOKit would be a library to look at, but I simply could not find anything in the docs, that