이 솔루션은 코코아 프레임 워크를 사용하고 있습니다. 코코아는 더 이상 사용되지 않으며 다른 대체 솔루션에 대해서는 알지 못합니다. 그러나 아래는 매력과 같습니다.
마지막으로 나는 Carbon
프레임 워크를 사용하여 해결책을 찾았습니다. 여기 내 MCarbon
인터페이스는 내가 필요한 호출을 정의합니다.
public interface MCarbon extends Library {
MCarbon INSTANCE = (MCarbon) Native.loadLibrary("Carbon", MCarbon.class);
Pointer GetCurrentEventQueue();
int SendEventToEventTarget(Pointer inEvent, Pointer intarget);
int RemoveEventFromQueue(Pointer inQueue, Pointer inEvent);
void ReleaseEvent(Pointer inEvent);
Pointer AcquireFirstMatchingEventInQueue(Pointer inQueue,NativeLong inNumTypes,EventTypeSpec[] inList, NativeLong inOptions);
//... so on
}
문제에 대한 해결책은 아래의 기능을 사용하여 해결된다 :
NativeLong ReceiveNextEvent(NativeLong inNumTypes, EventTypeSpec[] inList, double inTimeout, byte inPullEvent, Pointer outEvent);
이 작업을 수행합니다. 문서에 따라 - 또한
This routine tries to fetch the next event of a specified type.
If no events in the event queue match, this routine will run the
current event loop until an event that matches arrives, or the
timeout expires. Except for timers firing, your application is
blocked waiting for events to arrive when inside this function.
하지 ReceiveNextEvent
경우, MCarbon
클래스에서 언급 한 바와 같이 다음 다른 기능은 위 유용 할 것이다.
Carbon
프레임 워크 documentation은 문제를 해결하는 데 더 많은 통찰력과 유연성을 제공한다고 생각합니다. Carbon
외에도 공개 토론에서 사람들은 Cocoa
을 사용하여 해결에 대해 언급했지만 아무도 알고 있지 않습니다.
편집 : technomarge 덕분에, 자세한 내용은 당신은 아마 체크 아웃 할 것이다 here
GCEventRef, https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference .html –
유닉스를위한 JNA의 플랫폼 매핑의 대부분은 X11을위한 것이며, OS X에 대해서는 그다지 구체적이지 않습니다. [Rococoa] (http://code.google.com/p/rococoa/)는 훨씬 더 많은 것을 가지고 있습니다 OS X 매핑의 – technomage
@technomage 이제 코드를 다시 작성해야하기 때문에 Rococoa로 이동할 수 없습니다. Windows는 이미 잘 작동합니다. 메시지를 얻으려면 약간의 기술이 필요합니다. – Jatin