diff options
Diffstat (limited to 'src/newt')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java | 3 | ||||
-rw-r--r-- | src/newt/native/X11Window.c | 58 |
2 files changed, 2 insertions, 59 deletions
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/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); -} - |