1 message in net.java.dev.jna.users[jna-users] Re: Mac OS X API library ...
FromSent OnAttachments
Timothy WallJan 9, 2009 11:27 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[jna-users] Re: Mac OS X API library definitions.Actions...
From:Timothy Wall (twal@dev.java.net)
Date:Jan 9, 2009 11:27:54 am
List:net.java.dev.jna.users

No, but you might check out Rococoa (rococoa.dev.java.net).

Others have certainly worked on such mappings.

On Jan 9, 2009, at 1:05 PM, Alan Snyder wrote:

Does JNA have a set of definitions for the Mac OS X API, like it does for Win32 API?

I've been working on a project, and end up using Pointer for many of the Mac definitions, but it isn't quite working yet. Does anyone have know a better set of definitions for some of the APIs mentioned below.

Also what would be a good approach to construct a library like below.

---------------------------------------------------------------------

public interface CGCarbon extends Library { CGCarbon INSTANCE = (CGCarbon) Native.loadLibrary("Carbon", CGCarbon.class);

/* CFMachPortRef CGEventTapCreate ( CGEventTapLocation tap, CGEventTapPlacement place, CGEventTapOptions options, CGEventMask eventsOfInterest, CGEventTapCallBack callback, void *refcon ); */ Pointer CGEventTapCreate(int tap, int place, int options, long eventsOfInterest, CGEventTapCallBack callback, Pointer refcon );

/* CGEventTapCallBack */ /* typedef CGEventRef (*CGEventTapCallBack) ( CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon ); */ public interface CGEventTapCallBack extends Callback { public Pointer callback(Pointer proxy, int type, Pointer event, Pointer refcon); }

/* CGEventGetIntegerValueField */ /* int64_t CGEventGetIntegerValueField ( CGEventRef event, CGEventField field ); */ long CGEventGetIntegerValueField(Pointer event,int field);

/* CFMackPortCreateRunLoopSource() */ /* CFRunLoopSourceRef CFMachPortCreateRunLoopSource( CFAllocatorRef allocator, CFMachPortRef port, CFIndex order ); */ Pointer CFMachPortCreateRunLoopSource( Pointer alwaysNull, Pointer machPortRef, int order);

/* CFRunLoopAddSource() */ /* void CFRunLoopAddSource( CFRunLoopRef rl, CFRunLoopSourceRef source, CFStringRef mode ); */ void CFRunLoopAddSource(Pointer rl, Pointer source, int mode);

/* CFRunLoopAddRemoveSource() */ /*void CFRunLoopRemoveSource ( CFRunLoopRef rl, CFRunLoopSourceRef source, CFStringRef mode ); */ void CFRunLoopRemoveSource(Pointer rl, Pointer source, int mode);

/* CFRunLoopGetCurrent */ /* CFRunLoopRef CFRunLoopGetCurrent() */ Pointer CFRunLoopGetCurrent();

final int kCGEventNull = 0; final int kCGEventLeftMouseDown = 1; final int kCGEventLeftMouseUp = 2; final int kCGEventRightMouseDown = 3; final int kCGEventRightMouseUp = 4; final int kCGEventMouseMoved = 5; final int kCGEventLeftMouseDragged = 6; final int kCGEventRightMouseDragged = 7;

final int kCGEventScrollWheel = 22;

//integer constants below here. final int kCGEventKeyDown = 10; final int kCGEventKeyUp = 11; final int kCGEventFlagsChanged = 12;