aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/classes/com/sun/javafx/newt/GLWindow.java8
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/NewtFactory.java11
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/Screen.java34
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/Window.java3
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/kd/KDScreen.java2
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/kd/KDWindow.java35
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/windows/WindowsWindow.java8
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/x11/X11Screen.java5
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/x11/X11Window.java16
-rwxr-xr-xsrc/native/newt/KDWindow.c92
-rwxr-xr-xsrc/native/newt/WindowsWindow.c2
-rwxr-xr-xsrc/native/newt/X11Window.c46
12 files changed, 139 insertions, 123 deletions
diff --git a/src/classes/com/sun/javafx/newt/GLWindow.java b/src/classes/com/sun/javafx/newt/GLWindow.java
index 89886c24f..10e1f1db5 100644
--- a/src/classes/com/sun/javafx/newt/GLWindow.java
+++ b/src/classes/com/sun/javafx/newt/GLWindow.java
@@ -153,14 +153,6 @@ public class GLWindow extends Window implements GLAutoDrawable {
window.close();
}
- public int getDisplayWidth() {
- return window.getDisplayWidth();
- }
-
- public int getDisplayHeight() {
- return window.getDisplayHeight();
- }
-
public boolean getPerfLogEnabled() { return perfLog; }
public void enablePerfLog(boolean v) {
diff --git a/src/classes/com/sun/javafx/newt/NewtFactory.java b/src/classes/com/sun/javafx/newt/NewtFactory.java
index d277fc65e..ffd530082 100755
--- a/src/classes/com/sun/javafx/newt/NewtFactory.java
+++ b/src/classes/com/sun/javafx/newt/NewtFactory.java
@@ -53,6 +53,17 @@ public abstract class NewtFactory {
/** Generic AWT wrapped window type, if available */
public static final String AWT = "AWT";
+ public static int getPropertyIntValue(String propname) {
+ int i=0;
+ String s = System.getProperty(propname);
+ if(null!=s) {
+ try {
+ i = Integer.valueOf(s).intValue();
+ } catch (NumberFormatException nfe) {}
+ }
+ return i;
+ }
+
/** Creates a Window of the default type for the current operating system. */
public static String getWindowType() {
String osName = System.getProperty("newt.ws.name");
diff --git a/src/classes/com/sun/javafx/newt/Screen.java b/src/classes/com/sun/javafx/newt/Screen.java
index 7a4209826..4cd8ee5c3 100755
--- a/src/classes/com/sun/javafx/newt/Screen.java
+++ b/src/classes/com/sun/javafx/newt/Screen.java
@@ -57,6 +57,11 @@ public abstract class Screen {
protected static Screen create(String type, Display display, int idx) {
try {
+ if(usrWidth<0 || usrHeight<0) {
+ usrWidth = NewtFactory.getPropertyIntValue("newt.ws.swidth");
+ usrHeight = NewtFactory.getPropertyIntValue("newt.ws.sheight");
+ System.out.println("User screen size "+usrWidth+"x"+usrHeight);
+ }
Class screenClass = getScreenClass(type);
Screen screen = (Screen) screenClass.newInstance();
screen.display = display;
@@ -96,8 +101,37 @@ public abstract class Screen {
return handle;
}
+ /**
+ * The actual implementation shall return the detected display value,
+ * if not we return 800.
+ * This can be overwritten with the user property 'newt.ws.swidth',
+ */
+ public int getWidth() {
+ return (usrWidth>0) ? usrWidth : (width>0) ? width : 480;
+ }
+
+ /**
+ * The actual implementation shall return the detected display value,
+ * if not we return 480.
+ * This can be overwritten with the user property 'newt.ws.sheight',
+ */
+ public int getHeight() {
+ return (usrHeight>0) ? usrHeight : (height>0) ? height : 480;
+ }
+
+ /**
+ * The actual implementation shall call this function
+ * to set the detected screen size
+ */
+ public void setScreenSize(int w, int h) {
+ System.out.println("Detected screen size "+w+"x"+h);
+ width=w; height=h;
+ }
+
protected Display display;
protected int index;
protected long handle;
+ protected int width=-1, height=-1; // detected values: set using setScreenSize
+ protected static int usrWidth=-1, usrHeight=-1; // property values: newt.ws.swidth and newt.ws.sheight
}
diff --git a/src/classes/com/sun/javafx/newt/Window.java b/src/classes/com/sun/javafx/newt/Window.java
index a2db7623b..6928c3397 100755
--- a/src/classes/com/sun/javafx/newt/Window.java
+++ b/src/classes/com/sun/javafx/newt/Window.java
@@ -128,9 +128,6 @@ public abstract class Window implements NativeWindow
return screen;
}
- public abstract int getDisplayWidth();
- public abstract int getDisplayHeight();
-
/**
* eventMask is a bitfield of EventListener event flags
*/
diff --git a/src/classes/com/sun/javafx/newt/kd/KDScreen.java b/src/classes/com/sun/javafx/newt/kd/KDScreen.java
index f635c8757..5d576356d 100755
--- a/src/classes/com/sun/javafx/newt/kd/KDScreen.java
+++ b/src/classes/com/sun/javafx/newt/kd/KDScreen.java
@@ -42,5 +42,7 @@ public class KDScreen extends Screen {
protected void createNative() {
handle = 0;
+ width=-1;
+ height=-1;
}
}
diff --git a/src/classes/com/sun/javafx/newt/kd/KDWindow.java b/src/classes/com/sun/javafx/newt/kd/KDWindow.java
index 3ac502111..ebd8edc36 100755
--- a/src/classes/com/sun/javafx/newt/kd/KDWindow.java
+++ b/src/classes/com/sun/javafx/newt/kd/KDWindow.java
@@ -42,10 +42,6 @@ import javax.media.opengl.NativeWindowException;
public class KDWindow extends Window {
private static final String WINDOW_CLASS_NAME = "NewtWindow";
- // fullscreen size
- // this will be correct _after_ setting fullscreen on,
- // but KD has no method to ask for the display size
- private int fs_width=800, fs_height=480;
// non fullscreen dimensions ..
private int nfs_width, nfs_height, nfs_x, nfs_y;
@@ -79,15 +75,17 @@ public class KDWindow extends Window {
chosenCaps = config.getCapabilities();
windowHandle = 0;
- eglWindowHandle = CreateWindow(getDisplayHandle(), visualID, eglRenderableType);
+ windowID = ++_windowID;
+ eglWindowHandle = CreateWindow(windowID, getDisplayHandle(), visualID, eglRenderableType);
if (eglWindowHandle == 0) {
throw new RuntimeException("Error creating egl window: "+eglWindowHandle);
}
setVisible0(eglWindowHandle, false);
+ /*
windowHandle = RealizeWindow(eglWindowHandle);
if (0 == windowHandle) {
throw new RuntimeException("Error native Window Handle is null");
- }
+ } */
windowHandleClose = eglWindowHandle;
}
@@ -101,6 +99,12 @@ public class KDWindow extends Window {
if(this.visible!=visible) {
this.visible=visible;
setVisible0(eglWindowHandle, visible);
+ if ( 0==windowHandle ) {
+ windowHandle = RealizeWindow(eglWindowHandle);
+ if (0 == windowHandle) {
+ throw new RuntimeException("Error native Window Handle is null");
+ }
+ }
clearEventMask();
}
}
@@ -127,16 +131,8 @@ public class KDWindow extends Window {
return true;
}
- public int getDisplayWidth() {
- return fs_width;
- }
-
- public int getDisplayHeight() {
- return fs_height;
- }
-
protected void dispatchMessages(int eventMask) {
- DispatchMessages(eglWindowHandle, eventMask);
+ DispatchMessages(windowID, eglWindowHandle, eventMask);
}
//----------------------------------------------------------------------
@@ -144,13 +140,13 @@ public class KDWindow extends Window {
//
private static native boolean initIDs();
- private native long CreateWindow(long displayHandle, long eglConfig, int eglRenderableType);
+ private native long CreateWindow(int owner, long displayHandle, long eglConfig, int eglRenderableType);
private native long RealizeWindow(long eglWindowHandle);
private native int CloseWindow(long eglWindowHandle);
private native void setVisible0(long eglWindowHandle, boolean visible);
private native void setSize0(long eglWindowHandle, int width, int height);
private native void setFullScreen0(long eglWindowHandle, boolean fullscreen);
- private native void DispatchMessages(long eglWindowHandle, int eventMask);
+ private native void DispatchMessages(int owner, long eglWindowHandle, int eventMask);
private void sizeChanged(int newWidth, int newHeight) {
width = newWidth;
@@ -159,8 +155,7 @@ public class KDWindow extends Window {
nfs_width=width;
nfs_height=height;
} else {
- fs_width = width;
- fs_height = width;
+ screen.setScreenSize(width, height);
}
sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED);
}
@@ -170,4 +165,6 @@ public class KDWindow extends Window {
private long eglWindowHandle;
private long windowHandleClose;
+ private int windowID;
+ private static int _windowID = 0;
}
diff --git a/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java b/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java
index e1a1255ff..bd60402d2 100755
--- a/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java
+++ b/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java
@@ -116,14 +116,6 @@ public class WindowsWindow extends Window {
return true;
}
- public int getDisplayWidth() {
- return 640; // FIXME
- }
-
- public int getDisplayHeight() {
- return 480; // FIXME
- }
-
protected void dispatchMessages(int eventMask) {
DispatchMessages(windowHandle, eventMask);
}
diff --git a/src/classes/com/sun/javafx/newt/x11/X11Screen.java b/src/classes/com/sun/javafx/newt/x11/X11Screen.java
index 5920d4997..9482c09c2 100755
--- a/src/classes/com/sun/javafx/newt/x11/X11Screen.java
+++ b/src/classes/com/sun/javafx/newt/x11/X11Screen.java
@@ -49,6 +49,8 @@ public class X11Screen extends Screen {
if (handle == 0 ) {
throw new RuntimeException("Error creating screen: "+index);
}
+ setScreenSize(getWidth0(display.getHandle(), index),
+ getHeight0(display.getHandle(), index));
}
//----------------------------------------------------------------------
@@ -56,4 +58,7 @@ public class X11Screen extends Screen {
//
private native long GetScreen(long dpy, int scrn_idx);
+ private native int getWidth0(long display, int scrn_idx);
+ private native int getHeight0(long display, int scrn_idx);
}
+
diff --git a/src/classes/com/sun/javafx/newt/x11/X11Window.java b/src/classes/com/sun/javafx/newt/x11/X11Window.java
index 311ba7dae..c77933f18 100755
--- a/src/classes/com/sun/javafx/newt/x11/X11Window.java
+++ b/src/classes/com/sun/javafx/newt/x11/X11Window.java
@@ -95,10 +95,10 @@ public class X11Window extends Window {
if(this.fullscreen!=fullscreen) {
int x,y,w,h;
this.fullscreen=fullscreen;
- if(this.fullscreen) {
+ if(fullscreen) {
x = 0; y = 0;
- w = getDisplayWidth0(getDisplayHandle(), getScreenIndex())/2;
- h = getDisplayHeight0(getDisplayHandle(), getScreenIndex())/2;
+ w = screen.getWidth();
+ h = screen.getHeight();
} else {
x = nfs_x;
y = nfs_y;
@@ -111,14 +111,6 @@ public class X11Window extends Window {
return true;
}
- public int getDisplayWidth() {
- return getDisplayWidth0(getDisplayHandle(), getScreenIndex());
- }
-
- public int getDisplayHeight() {
- return getDisplayHeight0(getDisplayHandle(), getScreenIndex());
- }
-
protected void dispatchMessages(int eventMask) {
DispatchMessages(getDisplayHandle(), windowHandle, eventMask);
}
@@ -135,8 +127,6 @@ public class X11Window extends Window {
private native void DispatchMessages(long display, long windowHandle, int eventMask);
private native void setSize0(long display, long windowHandle, int width, int height, int decorationToggle, boolean isVisible);
private native void setPosition0(long display, long windowHandle, int x, int y);
- private native int getDisplayWidth0(long display, int scrn_idx);
- private native int getDisplayHeight0(long display, int scrn_idx);
private void sizeChanged(int newWidth, int newHeight) {
width = newWidth;
diff --git a/src/native/newt/KDWindow.c b/src/native/newt/KDWindow.c
index cc51bdf1f..d5fe7bdf5 100755
--- a/src/native/newt/KDWindow.c
+++ b/src/native/newt/KDWindow.c
@@ -39,11 +39,6 @@
#include <stdio.h>
#include <string.h>
-#ifdef _WIN32_WCE
- #define STDOUT_FILE "\\Storage Card\\jogl_demos\\stdout.txt"
- #define STDERR_FILE "\\Storage Card\\jogl_demos\\stderr.txt"
-#endif
-
/* This typedef is apparently needed for Microsoft compilers before VC8,
and on Windows CE */
#if (_MSC_VER < 1400) || defined(UNDER_CE)
@@ -66,7 +61,7 @@
#include "MouseEvent.h"
#include "KeyEvent.h"
-#define VERBOSE_ON 1
+// #define VERBOSE_ON 1
#ifdef VERBOSE_ON
#define DBG_PRINT(...) fprintf(stderr, __VA_ARGS__)
@@ -74,6 +69,13 @@
#define DBG_PRINT(...)
#endif
+#ifdef VERBOSE_ON
+ #ifdef _WIN32_WCE
+ #define STDOUT_FILE "\\Storage Card\\jogl_demos\\stdout.txt"
+ #define STDERR_FILE "\\Storage Card\\jogl_demos\\stderr.txt"
+ #endif
+#endif
+
/**
* Window
*/
@@ -86,9 +88,11 @@ static jmethodID sendKeyEventID = NULL;
JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_kd_KDWindow_initIDs
(JNIEnv *env, jclass clazz)
{
-#ifdef _WIN32_WCE
- _wfreopen(TEXT(STDOUT_FILE),L"w",stdout);
- _wfreopen(TEXT(STDERR_FILE),L"w",stderr);
+#ifdef VERBOSE_ON
+ #ifdef _WIN32_WCE
+ _wfreopen(TEXT(STDOUT_FILE),L"w",stdout);
+ _wfreopen(TEXT(STDERR_FILE),L"w",stderr);
+ #endif
#endif
sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(II)V");
windowClosedID = (*env)->GetMethodID(env, clazz, "windowClosed", "()V");
@@ -106,7 +110,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_kd_KDWindow_initIDs
}
JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_kd_KDWindow_CreateWindow
- (JNIEnv *env, jobject obj, jlong display, jlong eglConfig, jint eglRenderableType)
+ (JNIEnv *env, jobject obj, jint owner, jlong display, jlong eglConfig, jint eglRenderableType)
{
EGLint configAttribs[] = {
EGL_RED_SIZE, 1,
@@ -124,6 +128,8 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_kd_KDWindow_CreateWindow
EGLConfig cfg = (EGLConfig)(intptr_t)eglConfig;
KDWindow *window = 0;
+ DBG_PRINT( "[CreateWindow]: owner %d\n", owner);
+
if(dpy==NULL) {
fprintf(stderr, "[CreateWindow] invalid display connection..\n");
return 0;
@@ -147,12 +153,12 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_kd_KDWindow_CreateWindow
configAttribs[i] = eglRenderableType;
/* passing the KDWindow instance for the eventuserptr */
- window = kdCreateWindow(dpy, configAttribs, (void *)(intptr_t)obj);
+ window = kdCreateWindow(dpy, configAttribs, (void *)(intptr_t)owner);
if(NULL==window) {
fprintf(stderr, "[CreateWindow] failed: 0x%X\n", kdGetError());
}
- DBG_PRINT( "[CreateWindow] ok: %p\n", window);
+ DBG_PRINT( "[CreateWindow] ok: %p, owner %d\n", window, (void *)(intptr_t)owner);
return (jlong) (intptr_t) window;
}
@@ -195,30 +201,25 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_setVisible0
DBG_PRINT( "[setVisible] v=%d\n", visible);
}
-/*
- * Class: com_sun_javafx_newt_kd_KDWindow
- * Method: DispatchMessages
- * Signature: (JJI)V
- */
JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_DispatchMessages
- (JNIEnv *env, jobject obj, jlong window, jint eventMask)
+ (JNIEnv *env, jobject obj, jint owner, jlong window, jint eventMask)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
+ const KDEvent * evt;
// Periodically take a break
- const KDEvent * evt;
while( NULL!=(evt=kdWaitEvent(0)) ) {
- jobject src_obj = (jobject)(intptr_t)evt->userptr;
- if(src_obj != obj) {
- DBG_PRINT( "event unrelated: src: %p, caller: %p\n", src_obj, obj);
+ jint src_owner = (jint)(intptr_t)evt->userptr;
+ if(src_owner != owner) {
+ DBG_PRINT( "event unrelated: src: %d, caller: %d, evt type: 0x%X\n", src_owner, owner, evt->type);
continue;
}
- DBG_PRINT( "[DispatchMessages]: caller %p, evt type: 0x%X\n", obj, evt->type);
+ DBG_PRINT( "[DispatchMessages]: caller %d, evt type: 0x%X\n", owner, evt->type);
switch(evt->type) {
case KD_EVENT_INPUT_POINTER:
if( ! ( eventMask & EVENT_MOUSE ) ) {
- DBG_PRINT( "event mouse ignored: src: %p\n", obj);
+ DBG_PRINT( "event mouse ignored: src: %d\n", owner);
continue;
}
break;
@@ -226,7 +227,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_DispatchMessages
case KeyPress:
case KeyRelease:
if( ! ( eventMask & EVENT_KEY ) ) {
- DBG_PRINT( "event key ignored: src: %p\n", obj);
+ DBG_PRINT( "event key ignored: src: %d\n", owner);
continue;
}
break;
@@ -236,7 +237,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_DispatchMessages
case KD_EVENT_WINDOWPROPERTY_CHANGE:
case KD_EVENT_WINDOW_REDRAW:
if( ! ( eventMask & EVENT_WINDOW ) ) {
- DBG_PRINT( "event window ignored: src: %p\n", obj);
+ DBG_PRINT( "event window ignored: src: %d\n", owner);
continue;
}
break;
@@ -249,13 +250,13 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_DispatchMessages
{
KDboolean hasFocus;
kdGetWindowPropertybv(w, KD_WINDOWPROPERTY_FOCUS, &hasFocus);
- DBG_PRINT( "event window focus : src: %p\n", obj);
+ DBG_PRINT( "event window focus : src: %d\n", owner);
}
break;
case KD_EVENT_WINDOW_CLOSE:
{
+ DBG_PRINT( "event window close : src: %d\n", owner);
(*env)->CallVoidMethod(env, obj, windowClosedID);
- DBG_PRINT( "event window close : src: %p\n", obj);
}
break;
case KD_EVENT_WINDOWPROPERTY_CHANGE:
@@ -266,21 +267,21 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_DispatchMessages
{
KDint32 v[2];
if(!kdGetWindowPropertyiv(w, KD_WINDOWPROPERTY_SIZE, v)) {
- DBG_PRINT( "event window size change : src: %p %dx%x\n", obj, v[0], v[1]);
+ DBG_PRINT( "event window size change : src: %d %dx%d\n", owner, v[0], v[1]);
(*env)->CallVoidMethod(env, obj, sizeChangedID, (jint) v[0], (jint) v[1]);
} else {
- DBG_PRINT( "event window size change error: src: %p\n", obj);
+ DBG_PRINT( "event window size change error: src: %d %dx%d\n", owner, v[0], v[1]);
}
}
break;
case KD_WINDOWPROPERTY_FOCUS:
- DBG_PRINT( "event window focus: src: %p\n", obj);
+ DBG_PRINT( "event window focus: src: %d\n", owner);
break;
case KD_WINDOWPROPERTY_VISIBILITY:
{
KDboolean visible;
kdGetWindowPropertybv(w, KD_WINDOWPROPERTY_VISIBILITY, &visible);
- DBG_PRINT( "event window visibility: src: %p, v:%d\n", obj, visible);
+ DBG_PRINT( "event window visibility: src: %d, v:%d\n", owner, visible);
}
break;
default:
@@ -294,21 +295,20 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_DispatchMessages
// button idx: evt->data.input.index
// pressed = ev->data.input.value.i
// time = ev->timestamp
- (*env)->CallVoidMethod(env, obj, sendMouseEventID,
- (ptr->select==0) ? (jint) EVENT_MOUSE_RELEASED : (jint) EVENT_MOUSE_PRESSED,
- (jint) 0,
- (jint) ptr->x, (jint) ptr->y, (jint) ptr->index);
- }
- break;
- /*
- case MotionNotify:
- if(evt.xmotion.window==w) {
- (*env)->CallVoidMethod(env, obj, sendMouseEventID, (jint) EVENT_MOUSE_MOVED,
- (jint) evt.xmotion.state,
- (jint) evt.xmotion.x, (jint) evt.xmotion.y, (jint) 0);
+ if(KD_INPUT_POINTER_SELECT==ptr->index) {
+ DBG_PRINT( "event mouse click: src: %d, s:%d, (%d,%d)\n", owner, ptr->select, ptr->x, ptr->y);
+ (*env)->CallVoidMethod(env, obj, sendMouseEventID,
+ (ptr->select==0) ? (jint) EVENT_MOUSE_RELEASED : (jint) EVENT_MOUSE_PRESSED,
+ (jint) 0,
+ (jint) ptr->x, (jint) ptr->y, 1);
+ } else {
+ DBG_PRINT( "event mouse: src: %d, s:%d, i:0x%X (%d,%d)\n", owner, ptr->select, ptr->index, ptr->x, ptr->y);
+ (*env)->CallVoidMethod(env, obj, sendMouseEventID, (jint) EVENT_MOUSE_MOVED,
+ 0,
+ (jint) ptr->x, (jint) ptr->y, 0);
+ }
}
break;
- */
}
}
}
@@ -319,7 +319,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_setFullScreen0
KDWindow *w = (KDWindow*) (intptr_t) window;
KDboolean v = fullscreen;
- int res = kdSetWindowPropertyiv(w, KD_WINDOWPROPERTY_FULLSCREEN_NV, &v);
+ int res = kdSetWindowPropertybv(w, KD_WINDOWPROPERTY_FULLSCREEN_NV, &v);
DBG_PRINT( "[setFullScreen] v=%d, res=%d\n", fullscreen, res);
}
diff --git a/src/native/newt/WindowsWindow.c b/src/native/newt/WindowsWindow.c
index 4abc40800..1e173372b 100755
--- a/src/native/newt/WindowsWindow.c
+++ b/src/native/newt/WindowsWindow.c
@@ -266,7 +266,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_RegisterW
(*env)->ReleaseStringUTFChars(env, appName, _appName);
#endif
if (!RegisterClass(wc)) {
- free(wc->lpszClassName);
+ free((void *)wc->lpszClassName);
free(wc);
return 0;
}
diff --git a/src/native/newt/X11Window.c b/src/native/newt/X11Window.c
index 328f97d4d..d5933838c 100755
--- a/src/native/newt/X11Window.c
+++ b/src/native/newt/X11Window.c
@@ -135,6 +135,21 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Screen_GetScreen
return (jlong) (intptr_t) scrn;
}
+JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_x11_X11Screen_getWidth0
+ (JNIEnv *env, jobject obj, jlong display, jint scrn_idx)
+{
+ Display * dpy = (Display *) (intptr_t) display;
+ return (jint) XDisplayWidth( dpy, scrn_idx);
+}
+
+JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_x11_X11Screen_getHeight0
+ (JNIEnv *env, jobject obj, jlong display, jint scrn_idx)
+{
+ Display * dpy = (Display *) (intptr_t) display;
+ return (jint) XDisplayHeight( dpy, scrn_idx);
+}
+
+
/**
* Window
*/
@@ -200,6 +215,8 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Window_CreateWindow
int n;
+ DBG_PRINT( "CreateWindow %x/%d %dx%d\n", x, y, width, height);
+
dpy = (Display *)(intptr_t)display;
if(dpy==NULL) {
fprintf(stderr, "[CreateWindow] invalid display connection..\n");
@@ -326,6 +343,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setVisible0
{
Display * dpy = (Display *) (intptr_t) display;
Window w = (Window)window;
+ DBG_PRINT( "setVisible0 vis %d\n", visible);
if(visible==JNI_TRUE) {
XMapRaised(dpy, w);
XSync(dpy, False);
@@ -503,6 +521,8 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setSize0
Display * dpy = (Display *) (intptr_t) display;
Window w = (Window)window;
+ DBG_PRINT( "setSize0 %dx%d, dec %d, vis %d\n", width, height, decorationToggle, isVisible);
+
if(0!=decorationToggle) {
XSetWindowAttributes xswa;
unsigned long attrMask=CWOverrideRedirect;
@@ -533,6 +553,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setSize0
xwc.width=width;
xwc.height=height;
XConfigureWindow(dpy, w, CWWidth|CWHeight, &xwc);
+ XSync(dpy, False);
DBG_PRINT( "setSize0 . sizeChangedID call\n");
(*env)->CallVoidMethod(env, obj, sizeChangedID, (jint) width, (jint) height);
@@ -558,28 +579,3 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setPosition0
// (*env)->CallVoidMethod(env, obj, positionChangedID, (jint) width, (jint) height);
}
-/*
- * Class: com_sun_javafx_newt_x11_X11Window
- * Method: getDisplayWidth0
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_x11_X11Window_getDisplayWidth0
- (JNIEnv *env, jobject obj, jlong display, jint scrn_idx)
-{
- Display * dpy = (Display *) (intptr_t) display;
- return (jint) XDisplayWidth( dpy, scrn_idx);
-}
-
-/*
- * Class: com_sun_javafx_newt_x11_X11Window
- * Method: getDisplayHeight0
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_x11_X11Window_getDisplayHeight0
- (JNIEnv *env, jobject obj, jlong display, jint scrn_idx)
-{
- Display * dpy = (Display *) (intptr_t) display;
- return (jint) XDisplayHeight( dpy, scrn_idx);
-}
-
-