summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/windows/WindowsWindow.java4
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java9
-rw-r--r--src/newt/native/WindowsWindow.c44
-rw-r--r--src/newt/native/X11Window.c58
5 files changed, 12 insertions, 106 deletions
diff --git a/src/newt/classes/com/jogamp/newt/impl/windows/WindowsWindow.java b/src/newt/classes/com/jogamp/newt/impl/windows/WindowsWindow.java
index daa09b034..2c3ffc3cc 100644
--- a/src/newt/classes/com/jogamp/newt/impl/windows/WindowsWindow.java
+++ b/src/newt/classes/com/jogamp/newt/impl/windows/WindowsWindow.java
@@ -34,6 +34,7 @@
package com.jogamp.newt.impl.windows;
+import com.jogamp.nativewindow.impl.windows.GDI;
import javax.media.nativewindow.*;
import com.jogamp.newt.impl.WindowImpl;
import javax.media.nativewindow.util.Insets;
@@ -168,7 +169,7 @@ public class WindowsWindow extends WindowImpl {
}
protected Point getLocationOnScreenImpl(int x, int y) {
- return (Point) getRelativeLocation0( getWindowHandle(), 0 /*root win*/, x, y);
+ return GDI.GetRelativeLocation( getWindowHandle(), 0 /*root win*/, x, y);
}
//----------------------------------------------------------------------
@@ -190,7 +191,6 @@ public class WindowsWindow extends WindowImpl {
boolean parentChange, int fullScreenChange, int decorationChange);
private static native void setTitle0(long windowHandle, String title);
private native void requestFocus0(long windowHandle, boolean force);
- private native Object getRelativeLocation0(long src_win, long dest_win, int src_x, int src_y);
private void insetsChanged(int left, int top, int right, int bottom) {
if (left != -1 && top != -1 && right != -1 && bottom != -1) {
diff --git a/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java b/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java
index 06c7dfa99..91143923d 100644
--- a/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java
+++ b/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java
@@ -33,6 +33,7 @@
package com.jogamp.newt.impl.x11;
+import com.jogamp.nativewindow.impl.x11.X11Util;
import com.jogamp.newt.impl.WindowImpl;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
@@ -114,7 +115,7 @@ public class X11Window extends WindowImpl {
}
protected Point getLocationOnScreenImpl(int x, int y) {
- return (Point) getRelativeLocation0( getDisplayHandle(), getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y);
+ return X11Util.GetRelativeLocation( getDisplayHandle(), getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y);
}
//----------------------------------------------------------------------
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 54fcfe85e..967836cf6 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -60,7 +60,7 @@ import javax.media.nativewindow.util.Insets;
* via {@link #invoke(boolean, javax.media.opengl.GLRunnable)} to the OpenGL command stream.<br>
* <p>
*/
-public class GLWindow implements GLAutoDrawable, Window {
+public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer {
private WindowImpl window;
/**
@@ -687,6 +687,13 @@ public class GLWindow implements GLAutoDrawable, Window {
}
//----------------------------------------------------------------------
+ // NEWTEventConsumer
+ //
+ public boolean consumeEvent(NEWTEvent event) {
+ return window.consumeEvent(event);
+ }
+
+ //----------------------------------------------------------------------
// Window completion
//
public final void windowRepaint(int x, int y, int width, int height) {
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index 46d710eda..b282ec9b2 100644
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -118,13 +118,6 @@
#define STD_PRINT(...) fprintf(stderr, __VA_ARGS__); fflush(stderr)
-static const char * const ClazzNamePoint = "javax/media/nativewindow/util/Point";
-static const char * const ClazzAnyCstrName = "<init>";
-static const char * const ClazzNamePointCstrSignature = "(II)V";
-
-static jclass pointClz = NULL;
-static jmethodID pointCstr = NULL;
-
static jmethodID insetsChangedID = NULL;
static jmethodID sizeChangedID = NULL;
static jmethodID positionChangedID = NULL;
@@ -1333,23 +1326,6 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_initI
{
NewtCommon_init(env);
- if(NULL==pointClz) {
- jclass c = (*env)->FindClass(env, ClazzNamePoint);
- if(NULL==c) {
- NewtCommon_FatalError(env, "NEWT WindowsWindows: can't find %s", ClazzNamePoint);
- }
- pointClz = (jclass)(*env)->NewGlobalRef(env, c);
- (*env)->DeleteLocalRef(env, c);
- if(NULL==pointClz) {
- NewtCommon_FatalError(env, "NEWT WindowsWindows: can't use %s", ClazzNamePoint);
- }
- pointCstr = (*env)->GetMethodID(env, pointClz, ClazzAnyCstrName, ClazzNamePointCstrSignature);
- if(NULL==pointCstr) {
- NewtCommon_FatalError(env, "NEWT WindowsWindows: can't fetch %s.%s %s",
- ClazzNamePoint, ClazzAnyCstrName, ClazzNamePointCstrSignature);
- }
- }
-
insetsChangedID = (*env)->GetMethodID(env, clazz, "insetsChanged", "(IIII)V");
sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(IIZ)V");
positionChangedID = (*env)->GetMethodID(env, clazz, "positionChanged", "(II)V");
@@ -1708,24 +1684,4 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_requestFo
NewtWindows_requestFocus ( env, obj, (HWND) (intptr_t) window, force) ;
}
-/*
- * Class: com_jogamp_newt_impl_windows_WindowsWindows
- * Method: getRelativeLocation0
- * Signature: (JJII)Ljavax/media/nativewindow/util/Point;
- */
-JNIEXPORT jobject JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_getRelativeLocation0
- (JNIEnv *env, jobject obj, jlong jsrc_win, jlong jdest_win, jint src_x, jint src_y)
-{
- HWND src_win = (HWND) (intptr_t) jsrc_win;
- HWND dest_win = (HWND) (intptr_t) jdest_win;
- POINT dest = { src_x, src_y } ;
- int res;
-
- res = MapWindowPoints(src_win, dest_win, &dest, 1);
-
- DBG_PRINT("*** WindowsWindow: getRelativeLocation0: %p %d/%d -> %p %d/%d - ok: %d\n",
- (void*)src_win, src_x, src_y, (void*)dest_win, (int)dest.x, (int)dest.y, res);
-
- return (*env)->NewObject(env, pointClz, pointCstr, (jint)dest.x, (jint)dest.y);
-}
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index becfa7596..7a19cf202 100644
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -140,15 +140,8 @@ static jint X11KeySym2NewtVKey(KeySym keySym) {
static const char * const ClazzNameNewtWindow = "com/jogamp/newt/Window";
-static const char * const ClazzNamePoint = "javax/media/nativewindow/util/Point";
-static const char * const ClazzAnyCstrName = "<init>";
-static const char * const ClazzNamePointCstrSignature = "(II)V";
-
static jclass newtWindowClz=NULL;
-static jclass pointClz = NULL;
-static jmethodID pointCstr = NULL;
-
static jmethodID sizeChangedID = NULL;
static jmethodID positionChangedID = NULL;
static jmethodID focusChangedID = NULL;
@@ -233,22 +226,6 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_x11_X11Display_initIDs0
}
}
- if(NULL==pointClz) {
- c = (*env)->FindClass(env, ClazzNamePoint);
- if(NULL==c) {
- NewtCommon_FatalError(env, "NEWT X11Windows: can't find %s", ClazzNamePoint);
- }
- pointClz = (jclass)(*env)->NewGlobalRef(env, c);
- (*env)->DeleteLocalRef(env, c);
- if(NULL==pointClz) {
- NewtCommon_FatalError(env, "NEWT X11Windows: can't use %s", ClazzNamePoint);
- }
- pointCstr = (*env)->GetMethodID(env, pointClz, ClazzAnyCstrName, ClazzNamePointCstrSignature);
- if(NULL==pointCstr) {
- NewtCommon_FatalError(env, "NEWT X11Windows: can't fetch %s.%s %s",
- ClazzNamePoint, ClazzAnyCstrName, ClazzNamePointCstrSignature);
- }
- }
return JNI_TRUE;
}
@@ -1596,38 +1573,3 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Window_setTitle0
#endif
}
-
-
-/*
- * Class: com_jogamp_newt_impl_x11_X11Window
- * Method: getRelativeLocation0
- * Signature: (JIJJII)Ljavax/media/nativewindow/util/Point;
- */
-JNIEXPORT jobject JNICALL Java_com_jogamp_newt_impl_x11_X11Window_getRelativeLocation0
- (JNIEnv *env, jobject obj, jlong jdisplay, jint screen_index, jlong jsrc_win, jlong jdest_win, jint src_x, jint src_y)
-{
- Display * dpy = (Display *) (intptr_t) jdisplay;
- Screen * scrn = ScreenOfDisplay(dpy, (int)screen_index);
- Window root = XRootWindowOfScreen(scrn);
- Window src_win = (Window)jsrc_win;
- Window dest_win = (Window)jdest_win;
- int dest_x=-1;
- int dest_y=-1;
- Window child;
- Bool res;
-
- if( 0 == jdest_win ) { dest_win = root; }
- if( 0 == jsrc_win ) { src_win = root; }
-
- displayDispatchErrorHandlerEnable(1, env);
-
- res = XTranslateCoordinates(dpy, src_win, dest_win, src_x, src_y, &dest_x, &dest_y, &child);
-
- displayDispatchErrorHandlerEnable(0, env);
-
- DBG_PRINT( "X11: getRelativeLocation0: %p %d/%d -> %p %d/%d - ok: %d\n",
- (void*)src_win, src_x, src_y, (void*)dest_win, dest_x, dest_y, (int)res);
-
- return (*env)->NewObject(env, pointClz, pointCstr, (jint)dest_x, (jint)dest_y);
-}
-