2013-03-19 3 views
0

Canon SDK를 사용하여 카메라에서 이벤트를 가져옵니다. SDK에서는 특정 이벤트가 발생할 때 호출되는 콜백 함수를 등록합니다. SDK와 통신하는 자바 래퍼를 만들었습니다.X11에서 이벤트 가져 오기

그러나 이벤트가 트리거되면 내 창이 이벤트를 직접 가져 오지 않습니다.

private static final User32 lib = User32.INSTANCE; 
boolean hasMessage = lib.PeekMessage(msg, null, 0, 0, 1); // peek and remove 
if(hasMessage){ 
lib.TranslateMessage(msg); 
lib.DispatchMessage(msg); //message gets dispatched and hence the callback function is  called 
} 

기본적으로 하나의 친구들을 윈도우가 진행 한 후 이벤트를 수신 여부 및 경우 : 나는 이벤트를 얻을 자신에 파견하는 방법 창에 가리키고,이입니다. Mac에서는 NSApplication을 사용하여 Cocoa을 사용하여 작업을 수행하고 WindowServer은 이벤트를 보낼 수 있습니다.

비슷한 대안을 찾고 있어요 X11. 모든 샘플 코드/링크로 충분합니다.

PS : 나는 당신을 가정 this.

답변

2

이 후속 질문 XPeekEvent 찾고 있습니다. Xlib를 아주 잘 문서화 및 XNextEvent에 대한 맨 페이지 (3)라고한다 : 기본 X 창 및 이벤트를 처리하기위한 메인 이벤트 루프를 표시하는

The XPeekEvent function returns the first event from the event queue, 
but it does not remove the event from the queue. If the queue is 
empty, XPeekEvent flushes the output buffer and blocks until an event 
is received. It then copies the event into the client-supplied XEvent 
structure without removing it from the event queue. 

예제 코드는 on wikibooks (예를 들어)에서 찾을 수 있습니다.

관련 문제