aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-09-10 21:33:20 +0200
committerMichael Bien <[email protected]>2010-09-10 21:33:20 +0200
commitd34722a23b384711079409e4963b46c9d4413d89 (patch)
treed47d2d4de3f4c6642d94fa4e03fd0dfb2ed702b8 /src/newt/native
parent82a88278a0360e0e5896c5c0f009c47f9ff2a83c (diff)
parent340b1ceb07907be113e33c54d084e53ddc93e368 (diff)
Merge branch 'master' of git://github.com/sgothel/jogl
Diffstat (limited to 'src/newt/native')
-rw-r--r--src/newt/native/BroadcomEGL.c1
-rw-r--r--src/newt/native/EventListener.h9
-rw-r--r--src/newt/native/IntelGDL.c1
-rw-r--r--src/newt/native/KDWindow.c1
-rw-r--r--src/newt/native/MacWindow.m1
-rw-r--r--src/newt/native/WindowsWindow.c19
-rw-r--r--src/newt/native/X11Window.c28
7 files changed, 32 insertions, 28 deletions
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 ) ;
}
/*