summaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-09-01 02:58:54 +0200
committerSven Gothel <[email protected]>2011-09-01 02:58:54 +0200
commit3f8eeeec5e9166588c0af32f67da6341b28a9e2d (patch)
tree60b9ec555a3997258e8715358796a731410f3348 /src/newt/classes
parentf8606b9415628ceac0a522c70d2109711a0db8d2 (diff)
NEWT/X11 Bug 502 regressions: WM_DELETE_ATOM, .. etc couldn't be catched, etc.
Use EDT X11 Display connection (DPY) for whole display/screen/window lifecycle, but the user utilization (OpenGL, ..). Only using the same DPY for creation and event dispatching allows catching WM_DELETE_ATOM 'ClientMessage's. Sync X11Window.c w/ commit 4dbb8731219212e27c9afb769a1c62b32bd230a6 - remove 'test' code .. use orig lines
Diffstat (limited to 'src/newt/classes')
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/X11Display.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/X11Screen.java34
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/X11Window.java25
3 files changed, 36 insertions, 29 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/x11/X11Display.java b/src/newt/classes/jogamp/newt/driver/x11/X11Display.java
index a48689097..b9a32c7de 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/X11Display.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/X11Display.java
@@ -122,15 +122,15 @@ public class X11Display extends DisplayImpl {
//
private static native boolean initIDs0();
- private native void CompleteDisplay0(long handleEDT);
+ private native void CompleteDisplay0(long handle);
private void displayCompleted(long javaObjectAtom, long windowDeleteAtom) {
this.javaObjectAtom=javaObjectAtom;
this.windowDeleteAtom=windowDeleteAtom;
}
- private native void DisplayRelease0(long handleEDT, long javaObjectAtom, long windowDeleteAtom);
+ private native void DisplayRelease0(long handle, long javaObjectAtom, long windowDeleteAtom);
- private native void DispatchMessages0(long displayEDT, long javaObjectAtom, long windowDeleteAtom);
+ private native void DispatchMessages0(long display, long javaObjectAtom, long windowDeleteAtom);
/**
* 2011/06/14 libX11 1.4.2 and libxcb 1.7 bug 20708 - Multithreading Issues w/ OpenGL, ..
diff --git a/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java b/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java
index 5655ef0c7..d9ffdc5ec 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java
@@ -50,13 +50,13 @@ public class X11Screen extends ScreenImpl {
}
protected void createNativeImpl() {
- long handle = GetScreen0(display.getHandle(), screen_idx);
+ long handle = GetScreen0(getDisplayEDTHandle(), screen_idx);
if (handle == 0) {
throw new RuntimeException("Error creating screen: " + screen_idx);
}
aScreen = new X11GraphicsScreen((X11GraphicsDevice) getDisplay().getGraphicsDevice(), screen_idx);
- setScreenSize(getWidth0(display.getHandle(), screen_idx),
- getHeight0(display.getHandle(), screen_idx));
+ setScreenSize(getWidth0(getDisplayEDTHandle(), screen_idx),
+ getHeight0(getDisplayEDTHandle(), screen_idx));
}
protected void closeNativeImpl() {
@@ -72,19 +72,19 @@ public class X11Screen extends ScreenImpl {
protected int[] getScreenModeFirstImpl() {
// initialize iterators and static data
- nrotations = getAvailableScreenModeRotations0(display.getHandle(), screen_idx);
+ nrotations = getAvailableScreenModeRotations0(getDisplayEDTHandle(), screen_idx);
if(null==nrotations || 0==nrotations.length) {
return null;
}
nrotation_index = 0;
- nres_number = getNumScreenModeResolutions0(display.getHandle(), screen_idx);
+ nres_number = getNumScreenModeResolutions0(getDisplayEDTHandle(), screen_idx);
if(0==nres_number) {
return null;
}
nres_index = 0;
- nrates = getScreenModeRates0(display.getHandle(), screen_idx, nres_index);
+ nrates = getScreenModeRates0(getDisplayEDTHandle(), screen_idx, nres_index);
if(null==nrates || 0==nrates.length) {
return null;
}
@@ -104,7 +104,7 @@ public class X11Screen extends ScreenImpl {
System.err.println("rate "+nrate_index);
System.err.println("res "+nres_index); */
- int[] res = getScreenModeResolution0(display.getHandle(), screen_idx, nres_index);
+ int[] res = getScreenModeResolution0(getDisplayEDTHandle(), screen_idx, nres_index);
if(null==res || 0==res.length) {
return null;
}
@@ -147,7 +147,7 @@ public class X11Screen extends ScreenImpl {
return null;
}
- nrates = getScreenModeRates0(display.getHandle(), screen_idx, nres_index);
+ nrates = getScreenModeRates0(getDisplayEDTHandle(), screen_idx, nres_index);
if(null==nrates || 0==nrates.length) {
return null;
}
@@ -159,29 +159,29 @@ public class X11Screen extends ScreenImpl {
}
protected ScreenMode getCurrentScreenModeImpl() {
- int resNumber = getNumScreenModeResolutions0(display.getHandle(), screen_idx);
+ int resNumber = getNumScreenModeResolutions0(getDisplayEDTHandle(), screen_idx);
if(0==resNumber) {
return null;
}
- int resIdx = getCurrentScreenResolutionIndex0(display.getHandle(), screen_idx);
+ int resIdx = getCurrentScreenResolutionIndex0(getDisplayEDTHandle(), screen_idx);
if(0>resIdx) {
return null;
}
if(resIdx>=resNumber) {
throw new RuntimeException("Invalid resolution index: ! "+resIdx+" < "+resNumber);
}
- int[] res = getScreenModeResolution0(display.getHandle(), screen_idx, resIdx);
+ int[] res = getScreenModeResolution0(getDisplayEDTHandle(), screen_idx, resIdx);
if(null==res || 0==res.length) {
return null;
}
if(0>=res[0] || 0>=res[1]) {
throw new InternalError("invalid resolution: "+res[0]+"x"+res[1]+" for res idx "+resIdx+"/"+resNumber);
}
- int rate = getCurrentScreenRate0(display.getHandle(), screen_idx);
+ int rate = getCurrentScreenRate0(getDisplayEDTHandle(), screen_idx);
if(0>rate) {
return null;
}
- int rot = getCurrentScreenRotation0(display.getHandle(), screen_idx);
+ int rot = getCurrentScreenRotation0(getDisplayEDTHandle(), screen_idx);
if(0>rot) {
return null;
}
@@ -201,12 +201,12 @@ public class X11Screen extends ScreenImpl {
}
protected boolean setCurrentScreenModeImpl(ScreenMode screenMode) {
- List screenModes = this.getScreenModesOrig();
+ List<ScreenMode> screenModes = this.getScreenModesOrig();
int screenModeIdx = screenModes.indexOf(screenMode);
if(0>screenModeIdx) {
throw new RuntimeException("ScreenMode not element of ScreenMode list: "+screenMode);
}
- int resNumber = getNumScreenModeResolutions0(display.getHandle(), screen_idx);
+ int resNumber = getNumScreenModeResolutions0(getDisplayEDTHandle(), screen_idx);
int resIdx = getScreenModesIdx2NativeIdx().get(screenModeIdx);
if(0>resIdx || resIdx>=resNumber) {
throw new RuntimeException("Invalid resolution index: ! 0 < "+resIdx+" < "+resNumber+", screenMode["+screenModeIdx+"] "+screenMode);
@@ -244,6 +244,10 @@ public class X11Screen extends ScreenImpl {
//----------------------------------------------------------------------
// Internals only
//
+ private final long getDisplayEDTHandle() {
+ return ((X11Display) display).getEDTHandle();
+ }
+
private static native long GetScreen0(long dpy, int scrn_idx);
private static native int getWidth0(long display, int scrn_idx);
diff --git a/src/newt/classes/jogamp/newt/driver/x11/X11Window.java b/src/newt/classes/jogamp/newt/driver/x11/X11Window.java
index 57abd0b2d..0efb32cc3 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/X11Window.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/X11Window.java
@@ -64,7 +64,7 @@ public class X11Window extends WindowImpl {
X11GraphicsConfiguration x11config = (X11GraphicsConfiguration) config;
long visualID = x11config.getVisualID();
long w = CreateWindow0(getParentWindowHandle(),
- display.getHandle(), display.getEDTHandle(), screen.getIndex(), visualID,
+ display.getEDTHandle(), screen.getIndex(), visualID,
display.getJavaObjectAtom(), display.getWindowDeleteAtom(),
x, y, width, height, isUndecorated());
if (w == 0) {
@@ -78,7 +78,7 @@ public class X11Window extends WindowImpl {
if(0!=windowHandleClose && null!=getScreen() ) {
X11Display display = (X11Display) getScreen().getDisplay();
try {
- CloseWindow0(display.getHandle(), display.getEDTHandle(), windowHandleClose,
+ CloseWindow0(display.getEDTHandle(), windowHandleClose,
display.getJavaObjectAtom(), display.getWindowDeleteAtom());
} catch (Throwable t) {
if(DEBUG_IMPLEMENTATION) {
@@ -92,7 +92,7 @@ public class X11Window extends WindowImpl {
}
protected void setVisibleImpl(boolean visible, int x, int y, int width, int height) {
- setVisible0(getDisplayHandle(), getWindowHandle(), visible, x, y, width, height);
+ setVisible0(getDisplayEDTHandle(), getWindowHandle(), visible, x, y, width, height);
}
protected boolean reconfigureWindowImpl(int x, int y, int width, int height,
@@ -101,40 +101,43 @@ public class X11Window extends WindowImpl {
reparentCount=0;
long reqNewParentHandle = ( fullScreenChange > 0 ) ? 0 : getParentWindowHandle() ;
- reconfigureWindow0( getDisplayHandle(), getScreenIndex(), reqNewParentHandle, getWindowHandle(),
+ reconfigureWindow0( getDisplayEDTHandle(), getScreenIndex(), reqNewParentHandle, getWindowHandle(),
x, y, width, height, isVisible(), parentChange, fullScreenChange, decorationChange);
return true;
}
protected void requestFocusImpl(boolean force) {
- final X11Display display = (X11Display) getScreen().getDisplay();
- requestFocus0(display.getHandle(), display.getEDTHandle(), getWindowHandle(), force);
+ requestFocus0(getDisplayEDTHandle(), getWindowHandle(), force);
}
@Override
protected void setTitleImpl(String title) {
- setTitle0(getDisplayHandle(), getWindowHandle(), title);
+ setTitle0(getDisplayEDTHandle(), getWindowHandle(), title);
}
protected Point getLocationOnScreenImpl(int x, int y) {
- return X11Util.GetRelativeLocation( getDisplayHandle(), getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y);
+ return X11Util.GetRelativeLocation( getDisplayEDTHandle(), getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y);
}
//----------------------------------------------------------------------
// Internals only
//
+
+ private final long getDisplayEDTHandle() {
+ return ((X11Display) getScreen().getDisplay()).getEDTHandle();
+ }
protected static native boolean initIDs0();
- private native long CreateWindow0(long parentWindowHandle, long display, long displayEDT, int screen_index,
+ private native long CreateWindow0(long parentWindowHandle, long display, int screen_index,
long visualID, long javaObjectAtom, long windowDeleteAtom,
int x, int y, int width, int height, boolean undecorated);
- private native void CloseWindow0(long display, long displayEDT, long windowHandle, long javaObjectAtom, long windowDeleteAtom);
+ private native void CloseWindow0(long display, long windowHandle, long javaObjectAtom, long windowDeleteAtom);
private native void setVisible0(long display, long windowHandle, boolean visible, int x, int y, int width, int height);
private native void reconfigureWindow0(long display, int screen_index, long parentWindowHandle, long windowHandle,
int x, int y, int width, int height, boolean isVisible,
boolean parentChange, int fullScreenChange, int decorationChange);
private native void setTitle0(long display, long windowHandle, String title);
- private native void requestFocus0(long display, long displayEDT, long windowHandle, boolean force);
+ private native void requestFocus0(long display, long windowHandle, boolean force);
private native Object getRelativeLocation0(long display, int screen_index, long src_win, long dest_win, int src_x, int src_y);
private void windowReparented(long gotParentHandle) {