diff options
author | Michael Bien <[email protected]> | 2010-09-10 21:33:20 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-09-10 21:33:20 +0200 |
commit | d34722a23b384711079409e4963b46c9d4413d89 (patch) | |
tree | d47d2d4de3f4c6642d94fa4e03fd0dfb2ed702b8 /src | |
parent | 82a88278a0360e0e5896c5c0f009c47f9ff2a83c (diff) | |
parent | 340b1ceb07907be113e33c54d084e53ddc93e368 (diff) |
Merge branch 'master' of git://github.com/sgothel/jogl
Diffstat (limited to 'src')
18 files changed, 98 insertions, 86 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java index e63f5a225..258445ce2 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java @@ -250,14 +250,14 @@ public abstract class GLContextImpl extends GLContext { * MakeCurrent functionality, which also issues the creation of the actual OpenGL context.<br> * The complete callgraph for general OpenGL context creation is:<br> * <ul> - * <li> {@link #makeCurrent} <i>GLContextImpl</i> - * <li> {@link #makeCurrentImpl} <i>Platform Implementation</i> - * <li> {@link #create} <i>Platform Implementation</i> + * <li> {@link #makeCurrent} <i>GLContextImpl</i></li> + * <li> {@link #makeCurrentImpl} <i>Platform Implementation</i></li> + * <li> {@link #create} <i>Platform Implementation</i></li> * <li> If <code>ARB_create_context</code> is supported: * <ul> - * <li> {@link #createContextARB} <i>GLContextImpl</i> - * <li> {@link #createContextARBImpl} <i>Platform Implementation</i> - * </ul> + * <li> {@link #createContextARB} <i>GLContextImpl</i></li> + * <li> {@link #createContextARBImpl} <i>Platform Implementation</i></li> + * </ul></li> * </ul><br> * * Once at startup, ie triggered by the singleton constructor of a {@link GLDrawableFactoryImpl} specialization, @@ -267,10 +267,10 @@ public abstract class GLContextImpl extends GLContext { * <ul> * <li> {@link #createContextARBMapVersionsAvailable} * <ul> - * <li> {@link #createContextARBVersions} - * </ul> - * <li> {@link #mapVersionAvailable} - * </ul> + * <li> {@link #createContextARBVersions}</li> + * </ul></li> + * <li> {@link #mapVersionAvailable}</li> + * </ul></li> * </ul><br> * * @see #makeCurrentImpl diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java index 0233a6aad..abd5b95ce 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java @@ -73,7 +73,6 @@ public class TestParenting01cAWT { static int width, height; static long durationPerTest = 800; - static long waitReparent = 0; static GLCapabilities glCaps; @BeforeClass @@ -232,8 +231,6 @@ public class TestParenting01cAWT { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); - } else if(args[i].equals("-wait")) { - waitReparent = atoi(args[++i]); } } String tstname = TestParenting01cAWT.class.getName(); diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java index 00abd8406..b9ef93572 100644 --- a/src/newt/classes/com/jogamp/newt/Display.java +++ b/src/newt/classes/com/jogamp/newt/Display.java @@ -181,7 +181,7 @@ public abstract class Display { } } - public boolean runCreateAndDestroyOnEDT() { + protected boolean getShallRunOnEDT() { return true; } @@ -232,7 +232,7 @@ public abstract class Display { public void runOnEDTIfAvail(boolean wait, final Runnable task) { EDTUtil _edtUtil = getEDTUtil(); - if(runCreateAndDestroyOnEDT() && null!=_edtUtil) { + if(getShallRunOnEDT() && null!=_edtUtil) { _edtUtil.invoke(wait, task); } else { task.run(); @@ -363,7 +363,7 @@ public abstract class Display { enqueueEvent(false, event); } } else { - throw new RuntimeException("Event source not a NEWT one: "+source.getClass().getName()+", "+source); + throw new RuntimeException("Event source not NEWT: "+source.getClass().getName()+", "+source); } eventTask.notifyIssuer(); } diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index 0ec8a109b..d002791ca 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -297,12 +297,21 @@ public abstract class Window implements NativeWindow, NEWTEventConsumer } public void requestFocus() { - if(0 != windowHandle) { - requestFocusImpl(); - } + enqueueRequestFocus(false); // FIXME: or shall we wait ? } protected void requestFocusImpl() {} + class RequestFocusAction implements Runnable { + public void run() { + Window.this.requestFocusImpl(); + } + } + RequestFocusAction requestFocusAction = new RequestFocusAction(); + + public void enqueueRequestFocus(boolean wait) { + runOnEDTIfAvail(wait, requestFocusAction); + } + /** * May set to a {@link FocusRunnable}, {@link FocusRunnable#run()} before Newt requests the native focus. * This allows notifying a covered window toolkit like AWT that the focus is requested, @@ -985,20 +994,19 @@ public abstract class Window implements NativeWindow, NEWTEventConsumer switch(e.getEventType()) { case WindowEvent.EVENT_WINDOW_REPAINT: if( windowIsLocked() ) { + // make sure only one repaint event is queued if(!repaintQueued) { repaintQueued=true; return false; - } else { - return true; } - } else { - if(DEBUG_IMPLEMENTATION) { + return true; + } + if(DEBUG_IMPLEMENTATION) { System.out.println("Window.windowRepaint: "+e); // Exception ee = new Exception("Window.windowRepaint: "+e); // ee.printStackTrace(); - } - repaintQueued=false; } + repaintQueued=false; // no repaint event queued break; default: break; @@ -1009,6 +1017,8 @@ public abstract class Window implements NativeWindow, NEWTEventConsumer getInnerWindow().consumeKeyEvent((KeyEvent)e); } else if(e instanceof MouseEvent) { getInnerWindow().consumeMouseEvent((MouseEvent)e); + } else { + throw new NativeWindowException("Unexpected NEWTEvent type " + e); } return true; } diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index 6fd924e66..57647df5c 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -96,7 +96,7 @@ public class NewtCanvasAWT extends java.awt.Canvas { if(DEBUG_IMPLEMENTATION) { System.out.println("FocusActionImpl.run() "+Window.getThreadName()); } - NewtCanvasAWT.this.requestFocusAWT(); + NewtCanvasAWT.this.requestFocusAWTParent(); } } FocusActionImpl focusActionImpl = new FocusActionImpl(); @@ -213,12 +213,11 @@ public class NewtCanvasAWT extends java.awt.Canvas { } } - void requestFocusAWT() { + final void requestFocusAWTParent() { super.requestFocus(); } - public void requestFocus() { - super.requestFocus(); + final void requestFocusNEWTChild() { if(null!=newtChild) { newtChild.setFocusAction(null); newtChild.requestFocus(); @@ -226,32 +225,31 @@ public class NewtCanvasAWT extends java.awt.Canvas { } } + public void requestFocus() { + requestFocusAWTParent(); + requestFocusNEWTChild(); + } + public boolean requestFocus(boolean temporary) { boolean res = super.requestFocus(temporary); - if(res && null!=newtChild) { - newtChild.setFocusAction(null); - newtChild.requestFocus(); - newtChild.setFocusAction(focusAction); + if(res) { + requestFocusNEWTChild(); } return res; } public boolean requestFocusInWindow() { boolean res = super.requestFocusInWindow(); - if(res && null!=newtChild) { - newtChild.setFocusAction(null); - newtChild.requestFocus(); - newtChild.setFocusAction(focusAction); + if(res) { + requestFocusNEWTChild(); } return res; } public boolean requestFocusInWindow(boolean temporary) { boolean res = super.requestFocusInWindow(temporary); - if(res && null!=newtChild) { - newtChild.setFocusAction(null); - newtChild.requestFocus(); - newtChild.setFocusAction(focusAction); + if(res) { + requestFocusNEWTChild(); } return res; } diff --git a/src/newt/classes/com/jogamp/newt/event/InputEvent.java b/src/newt/classes/com/jogamp/newt/event/InputEvent.java index 02fbe59ef..d014de7f3 100644 --- a/src/newt/classes/com/jogamp/newt/event/InputEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/InputEvent.java @@ -48,17 +48,9 @@ public abstract class InputEvent extends NEWTEvent protected InputEvent(int eventType, Object source, long when, int modifiers) { super(eventType, source, when); - this.consumed=false; this.modifiers=modifiers; } - public void consume() { - consumed=true; - } - - public boolean isConsumed() { - return consumed; - } public int getModifiers() { return modifiers; } @@ -94,6 +86,5 @@ public abstract class InputEvent extends NEWTEvent return "InputEvent[modifiers:"+modifiers+", "+super.toString()+"]"; } - private boolean consumed; private int modifiers; } diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java index 9afcb840c..c85fc5f64 100644 --- a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java @@ -40,6 +40,13 @@ import java.util.*; * NEWT events are provided for notification purposes ONLY;<br> * The NEWT will automatically handle the event semantics internally, regardless of whether a program is receiving these events or not.<br> * The actual event semantic is processed before the event is send.<br> + * + * Event type registry:<br> + * <ul> + * <li> WindowEvent <code>100..10x</code></li> + * <li> MouseEvent <code>200..20x</code></li> + * <li> KeyEvent <code>300..30x</code></li> + * </ul><br> */ public class NEWTEvent extends java.util.EventObject { private boolean isSystemEvent; @@ -61,6 +68,8 @@ public class NEWTEvent extends java.util.EventObject { // 2: com.jogamp.newt.Window // 2: com.jogamp.newt.event.awt.AWTNewtEventFactory // + // FIXME: verify the isSystemEvent evaluation + // static final String WindowClazzName = "com.jogamp.newt.Window" ; static final String AWTNewtEventFactoryClazzName = "com.jogamp.newt.event.awt.AWTNewtEventFactory" ; diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java index e37c820a1..d3d897f3b 100644 --- a/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java +++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java @@ -36,8 +36,8 @@ public interface NEWTEventConsumer { /** * Consume the event * - * @return true if the event can be consumed now, - * otherwise propagate it later. + * @return true if the event has been consumed, + * otherwise it returns false for later propagation. */ public boolean consumeEvent(NEWTEvent event); } diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java index 2a187f8c4..90d00383d 100644 --- a/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java +++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java @@ -37,10 +37,5 @@ import com.jogamp.newt.*; public interface NEWTEventListener extends java.util.EventListener { - public static final int WINDOW = 1 << 0; - public static final int MOUSE = 1 << 1; - public static final int KEY = 1 << 2; - public static final int SURFACE = 1 << 3; - } diff --git a/src/newt/classes/com/jogamp/newt/impl/awt/AWTDisplay.java b/src/newt/classes/com/jogamp/newt/impl/awt/AWTDisplay.java index e705d364a..92c4e53eb 100644 --- a/src/newt/classes/com/jogamp/newt/impl/awt/AWTDisplay.java +++ b/src/newt/classes/com/jogamp/newt/impl/awt/AWTDisplay.java @@ -54,7 +54,7 @@ public class AWTDisplay extends Display { protected void closeNative() { } - public boolean runCreateAndDestroyOnEDT() { + protected boolean getShallRunOnEDT() { return false; } protected void dispatchMessagesNative() { /* nop */ } diff --git a/src/newt/classes/com/jogamp/newt/impl/awt/AWTWindow.java b/src/newt/classes/com/jogamp/newt/impl/awt/AWTWindow.java index 56e5a4240..db55aee6f 100644 --- a/src/newt/classes/com/jogamp/newt/impl/awt/AWTWindow.java +++ b/src/newt/classes/com/jogamp/newt/impl/awt/AWTWindow.java @@ -84,6 +84,14 @@ public class AWTWindow extends Window { // non fullscreen dimensions .. private int nfs_width, nfs_height, nfs_x, nfs_y; + protected void requestFocusImpl() { + runOnEDT(true, new Runnable() { + public void run() { + container.requestFocus(); + } + }); + } + protected void setTitleImpl(final String title) { runOnEDT(true, new Runnable() { public void run() { diff --git a/src/newt/native/BroadcomEGL.c b/src/newt/native/BroadcomEGL.c index 7bb21cd3b..ddac0ef45 100644 --- a/src/newt/native/BroadcomEGL.c +++ b/src/newt/native/BroadcomEGL.c @@ -43,7 +43,6 @@ #include "com_jogamp_newt_impl_opengl_broadcom_egl_Window.h" -#include "EventListener.h" #include "MouseEvent.h" #include "KeyEvent.h" diff --git a/src/newt/native/EventListener.h b/src/newt/native/EventListener.h deleted file mode 100644 index 2e0e92323..000000000 --- a/src/newt/native/EventListener.h +++ /dev/null @@ -1,9 +0,0 @@ - -#ifndef _EVENT_LISTSENER_H -#define _EVENT_LISTSENER_H - -#define EVENT_WINDOW (1 << 0) -#define EVENT_MOUSE (1 << 1) -#define EVENT_KEY (1 << 2) - -#endif diff --git a/src/newt/native/IntelGDL.c b/src/newt/native/IntelGDL.c index 8a4d7172c..eb6becbbd 100644 --- a/src/newt/native/IntelGDL.c +++ b/src/newt/native/IntelGDL.c @@ -41,7 +41,6 @@ #include "com_jogamp_newt_impl_intel_gdl_Screen.h" #include "com_jogamp_newt_impl_intel_gdl_Window.h" -#include "EventListener.h" #include "MouseEvent.h" #include "KeyEvent.h" diff --git a/src/newt/native/KDWindow.c b/src/newt/native/KDWindow.c index b67b8dbd3..75a2fe1a1 100644 --- a/src/newt/native/KDWindow.c +++ b/src/newt/native/KDWindow.c @@ -66,7 +66,6 @@ #include "com_jogamp_newt_impl_opengl_kd_KDWindow.h" -#include "EventListener.h" #include "MouseEvent.h" #include "KeyEvent.h" diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m index 6e8599d92..950a26acc 100644 --- a/src/newt/native/MacWindow.m +++ b/src/newt/native/MacWindow.m @@ -36,7 +36,6 @@ #import "com_jogamp_newt_impl_macosx_MacWindow.h" #import "NewtMacWindow.h" -#import "EventListener.h" #import "MouseEvent.h" #import "KeyEvent.h" diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index cda6a4086..6b8f2b73f 100644 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -91,7 +91,6 @@ #include "com_jogamp_newt_impl_windows_WindowsWindow.h" -#include "EventListener.h" #include "MouseEvent.h" #include "InputEvent.h" #include "KeyEvent.h" @@ -117,9 +116,12 @@ static jmethodID visibleChangedID = NULL; static jmethodID windowDestroyNotifyID = NULL; static jmethodID windowDestroyedID = NULL; static jmethodID windowRepaintID = NULL; +static jmethodID enqueueMouseEventID = NULL; static jmethodID sendMouseEventID = NULL; +static jmethodID enqueueKeyEventID = NULL; static jmethodID sendKeyEventID = NULL; static jmethodID focusActionID = NULL; +static jmethodID enqueueRequestFocusID = NULL; static RECT* UpdateInsets(JNIEnv *env, HWND hwnd, jobject window); @@ -806,7 +808,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, case WM_LBUTTONDOWN: DBG_PRINT("*** WindowsWindow: LBUTTONDOWN\n"); - NewtWindows_requestFocus ( env, window, wnd, FALSE ); // request focus on this window, if not already .. + (*env)->CallVoidMethod(env, window, enqueueRequestFocusID, JNI_FALSE); (*env)->CallVoidMethod(env, window, sendMouseEventID, (jint) EVENT_MOUSE_PRESSED, GetModifiers(), @@ -826,7 +828,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, case WM_MBUTTONDOWN: DBG_PRINT("*** WindowsWindow: MBUTTONDOWN\n"); - NewtWindows_requestFocus ( env, window, wnd, FALSE ); // request focus on this window, if not already .. + (*env)->CallVoidMethod(env, window, enqueueRequestFocusID, JNI_FALSE); (*env)->CallVoidMethod(env, window, sendMouseEventID, (jint) EVENT_MOUSE_PRESSED, GetModifiers(), @@ -846,7 +848,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, case WM_RBUTTONDOWN: DBG_PRINT("*** WindowsWindow: RBUTTONDOWN\n"); - NewtWindows_requestFocus ( env, window, wnd, FALSE ); // request focus on this window, if not already .. + (*env)->CallVoidMethod(env, window, enqueueRequestFocusID, JNI_FALSE); (*env)->CallVoidMethod(env, window, sendMouseEventID, (jint) EVENT_MOUSE_PRESSED, GetModifiers(), @@ -1075,8 +1077,11 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_initI windowDestroyNotifyID = (*env)->GetMethodID(env, clazz, "windowDestroyNotify", "()V"); windowDestroyedID = (*env)->GetMethodID(env, clazz, "windowDestroyed", "()V"); windowRepaintID = (*env)->GetMethodID(env, clazz, "windowRepaint", "(IIII)V"); + enqueueMouseEventID = (*env)->GetMethodID(env, clazz, "enqueueMouseEvent", "(ZIIIIII)V"); sendMouseEventID = (*env)->GetMethodID(env, clazz, "sendMouseEvent", "(IIIIII)V"); + enqueueKeyEventID = (*env)->GetMethodID(env, clazz, "enqueueKeyEvent", "(ZIIIC)V"); sendKeyEventID = (*env)->GetMethodID(env, clazz, "sendKeyEvent", "(IIIC)V"); + enqueueRequestFocusID = (*env)->GetMethodID(env, clazz, "enqueueRequestFocus", "(Z)V"); focusActionID = (*env)->GetMethodID(env, clazz, "focusAction", "()Z"); if (insetsChangedID == NULL || @@ -1087,10 +1092,12 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_initI windowDestroyNotifyID == NULL || windowDestroyedID == NULL || windowRepaintID == NULL || + enqueueMouseEventID == NULL || sendMouseEventID == NULL || + enqueueKeyEventID == NULL || sendKeyEventID == NULL || - focusActionID == NULL) - { + focusActionID == NULL || + enqueueRequestFocusID == NULL) { return JNI_FALSE; } BuildDynamicKeyMapTable(); diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c index 11c11915d..61575c947 100644 --- a/src/newt/native/X11Window.c +++ b/src/newt/native/X11Window.c @@ -49,7 +49,6 @@ #include "com_jogamp_newt_impl_x11_X11Window.h" -#include "EventListener.h" #include "MouseEvent.h" #include "KeyEvent.h" #include "WindowEvent.h" @@ -160,9 +159,12 @@ static jmethodID windowDestroyNotifyID = NULL; static jmethodID windowDestroyedID = NULL; static jmethodID windowRepaintID = NULL; static jmethodID windowCreatedID = NULL; +static jmethodID enqueueMouseEventID = NULL; static jmethodID sendMouseEventID = NULL; +static jmethodID enqueueKeyEventID = NULL; static jmethodID sendKeyEventID = NULL; static jmethodID focusActionID = NULL; +static jmethodID enqueueRequestFocusID = NULL; static jmethodID displayCompletedID = NULL; @@ -391,11 +393,12 @@ static Window NewtWindows_getParent (Display *dpy, Window w) { return 0; } */ -static void NewtWindows_requestFocus0 (JNIEnv *env, jobject window, Display *dpy, Window w, XWindowAttributes *xwa) { +static void NewtWindows_requestFocus0 (JNIEnv *env, jobject window, Display *dpy, Window w, XWindowAttributes *xwa, + Bool reparented){ Window focus_return; int revert_to_return; XGetInputFocus(dpy, &focus_return, &revert_to_return); - if(focus_return!=w) { + if(reparented || focus_return!=w) { // Avoid 'BadMatch' errors from XSetInputFocus, ie if window is not viewable if( JNI_FALSE == (*env)->CallBooleanMethod(env, window, focusActionID) ) { if(xwa->map_state == IsViewable) { @@ -405,11 +408,12 @@ static void NewtWindows_requestFocus0 (JNIEnv *env, jobject window, Display *dpy } } -static void NewtWindows_requestFocus1 (JNIEnv *env, jobject window, Display *dpy, Window w) { +static void NewtWindows_requestFocus1 (JNIEnv *env, jobject window, Display *dpy, Window w, + Bool reparented) { XWindowAttributes xwa; XGetWindowAttributes(dpy, w, &xwa); - NewtWindows_requestFocus0 (env, window, dpy, w, &xwa); + NewtWindows_requestFocus0 (env, window, dpy, w, &xwa, reparented); XSync(dpy, False); } @@ -541,7 +545,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Display_DispatchMessages switch(evt.type) { case ButtonPress: - NewtWindows_requestFocus1 ( env, jwindow, dpy, evt.xany.window ); + (*env)->CallVoidMethod(env, jwindow, enqueueRequestFocusID, JNI_FALSE); (*env)->CallVoidMethod(env, jwindow, sendMouseEventID, (jint) EVENT_MOUSE_PRESSED, (jint) evt.xbutton.state, @@ -710,8 +714,11 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_x11_X11Window_initIDs0 windowDestroyedID = (*env)->GetMethodID(env, clazz, "windowDestroyed", "()V"); windowRepaintID = (*env)->GetMethodID(env, clazz, "windowRepaint", "(IIII)V"); windowCreatedID = (*env)->GetMethodID(env, clazz, "windowCreated", "(J)V"); + enqueueMouseEventID = (*env)->GetMethodID(env, clazz, "enqueueMouseEvent", "(ZIIIIII)V"); sendMouseEventID = (*env)->GetMethodID(env, clazz, "sendMouseEvent", "(IIIIII)V"); + enqueueKeyEventID = (*env)->GetMethodID(env, clazz, "enqueueKeyEvent", "(ZIIIC)V"); sendKeyEventID = (*env)->GetMethodID(env, clazz, "sendKeyEvent", "(IIIC)V"); + enqueueRequestFocusID = (*env)->GetMethodID(env, clazz, "enqueueRequestFocus", "(Z)V"); focusActionID = (*env)->GetMethodID(env, clazz, "focusAction", "()Z"); if (sizeChangedID == NULL || @@ -722,9 +729,12 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_x11_X11Window_initIDs0 windowDestroyedID == NULL || windowRepaintID == NULL || windowCreatedID == NULL || + enqueueMouseEventID == NULL || sendMouseEventID == NULL || + enqueueKeyEventID == NULL || sendKeyEventID == NULL || - focusActionID == NULL) { + focusActionID == NULL || + enqueueRequestFocusID == NULL) { return JNI_FALSE; } return JNI_TRUE; @@ -1019,7 +1029,7 @@ static void NewtWindows_reparentWindow XMapRaised(dpy, w); XSync(dpy, False); - NewtWindows_requestFocus0 ( env, obj, dpy, w, xwa ); + NewtWindows_requestFocus0 ( env, obj, dpy, w, xwa, True ); XSync(dpy, False); } @@ -1102,7 +1112,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Window_reparentWindow0 JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Window_requestFocus0 (JNIEnv *env, jobject obj, jlong display, jlong window) { - NewtWindows_requestFocus1 ( env, obj, (Display *) (intptr_t) display, (Window)window ) ; + NewtWindows_requestFocus1 ( env, obj, (Display *) (intptr_t) display, (Window)window, False ) ; } /* |