macos-carbon

Which API can be used to _capture_ the mouse when moving OS X “Carbon” windows?

扶醉桌前 提交于 2019-12-11 04:03:21
问题 On request I have implemented support for moving an OS X window by dragging it using an area within the content part of the window, i.e replicating the drag and move functionality of the title bar but in another area. The problem I have yet to resolve is the fact that if the user drags the mouse quickly it can leave the window area and then no more mouse move events are received. On windows this type of problem can simply be fixed by calling the win32 method SetCapture(), what's the

No Carbon Human-Interface-Toolbox in OSX 64-bit binaries?

空扰寡人 提交于 2019-12-11 00:15:07
问题 I get the impression that Carbon Human Interface Toolbox does not work in 64-bit binaries. Apple's documentation says: The Carbon Help Manager is not available to 64-bit applications. ... The Control Manager is not available to 64-bit applications. ... The Data Browser is not available to 64-bit applications. ... I just want to verify that: There is no work-around around this. If this is simply the case. Why don't Apple's documentation simply state it as such? 回答1: I get the impression that

Qt Mac App Store application rejected

北城以北 提交于 2019-12-10 21:34:19
问题 My new Qt application submission has been rejected from Mac App Store. The reason is: Binary Rejected May 23, 2012 07:42 PM Reasons for Rejection: 2.5 Apps that use non-public APIs will be rejected 2.30 Apps that do not comply with the Mac OS X File System documentation will be rejected May 23, 2012 07:42 PM. From Apple. 2.5 The use of non-public APIs can lead to a poor user experience should these APIs change in the future, and is therefore not permitted. The following non-public APIs are

Programmatically select text range in TextEdit

最后都变了- 提交于 2019-12-10 19:56:00
问题 Is it possible to select (Highlight) a range of text in TextEdit (by AppleScript,Cocoa or Carbon)? I tryed this code but not work: set value of attribute "AXSelectedTextRange" to {selStart, selLen} It seems this attribute is readonly. Thanks. 回答1: Not sure how to do it with AppleScript (should be possible though), with the accessibility APIs, you could do something like this: AXUIElementRef systemWideElement = AXUIElementCreateSystemWide(); AXUIElementRef focussedElement = NULL; AXError error

Typedef redefinition of UInt32 in MacTypes.h, from definition in CFBase.h

淺唱寂寞╮ 提交于 2019-12-10 19:09:38
问题 I'm getting a typedef redefinition error on two lines in MacTypes.h, in the following chunk of code: #if __LP64__ typedef unsigned int UInt32; typedef signed int SInt32; #else typedef unsigned long UInt32; // error here typedef signed long SInt32; // error here #endif The Clang error points to the following previous definition, in CFBase.h (in CoreFoundation.framework): #if !defined(__MACTYPES__) #if !defined(_OS_OSTYPES_H) typedef unsigned char Boolean; typedef unsigned char UInt8; typedef

How to get current type of mouse cursor in Mac OS X?

狂风中的少年 提交于 2019-12-10 14:45:00
问题 How can I get the current type of mouse cursor on screen? (Not only on my app window, globally.) Or is it at least possible to detect whether the default cursor is currently displayed? Either Carbon or Cocoa is OK – or even other working APIs, preferably the official ones. This is what I have tried: NSCursor *sysCursor = [NSCursor currentSystemCursor]; if (sysCursor == nil) { NSLog(@"nil"); } if ([sysCursor isEqual: [NSCursor arrowCursor]] || [sysCursor isEqual: [NSCursor contextualMenuCursor

Monitor keyboard events inside process (Process Wide)

夙愿已清 提交于 2019-12-10 11:51:18
问题 I can install system wide keyboard monitor by the below instructions: CGEventRef eventCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *userData) { } CFMachPortRef eventTap = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, kCGEventKeyDown, &eventCallback, NULL); if(eventTap) { CFRunLoopSourceRef eventRunLoopSourceRef = CFMachPortCreateRunLoopSource(NULL, eventTap, 0); CFRelease(eventTap); CFRunLoopAddSource(CFRunLoopGetCurrent(),

Editing resource forks on the command line on Mac OS X

半城伤御伤魂 提交于 2019-12-10 01:46:01
问题 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? 回答1: You can directly access the resource fork of a file using path/to/file/..namedfork/rsrc. 回答2: First, OS X doesn't really use resource forks... it supports named forks and HFS+ supports the resource forks, but that's mostly for

Cocoa get Power Adapter Status

点点圈 提交于 2019-12-09 23:36:19
问题 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.

CGEventPostToPSN() not working for mouse clicking

自古美人都是妖i 提交于 2019-12-09 19:27:33
问题 I need to send mouse click events to an arbitrary process (not necessarily the front one) without bringing that process's window to the front. This code works for sending a mouse click and letting the window server send it to whatever process it decides has focus: #include <ApplicationServices/ApplicationServices.h> int main() { CGEventRef down, up; down = CGEventCreateMouseEvent( NULL, kCGEventLeftMouseDown, CGPointMake(16, 36), kCGMouseButtonLeft ); up = CGEventCreateMouseEvent( NULL,