diff options
Diffstat (limited to 'src/newt/classes/jogamp')
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) { |