diff options
author | Sven Gothel <sgothel@jausoft.com> | 2011-11-25 00:26:23 +0100 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2011-11-25 00:26:23 +0100 |
commit | 7ae0f2df39692e82d7955dbcd09c35c36382726c (patch) | |
tree | 03e61b228cbcef9e3ff04179dcc9e329594ef725 /src/nativewindow/classes/javax/media | |
parent | a94c1a2945a31aa5d93e354da3bc80f59f253ec4 (diff) |
NativeWindow X11GraphicsDevice: Pass 'owner' for close-display operation @ constructor
Diffstat (limited to 'src/nativewindow/classes/javax/media')
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java | 15 | ||||
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java | 4 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java index 317d3f3e9..b39fdb767 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java +++ b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java @@ -44,7 +44,7 @@ import javax.media.nativewindow.ToolkitLock; public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneable { public static final boolean DEBUG = Debug.debug("GraphicsDevice"); - boolean closeDisplay = false; + final boolean closeDisplay; /** Constructs a new X11GraphicsDevice corresponding to the given connection and default * {@link javax.media.nativewindow.ToolkitLock} via {@link NativeWindowFactory#getDefaultToolkitLock(String)}.<br> @@ -54,18 +54,20 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl */ public X11GraphicsDevice(String connection, int unitID) { super(NativeWindowFactory.TYPE_X11, connection, unitID); + closeDisplay = false; } /** Constructs a new X11GraphicsDevice corresponding to the given native display handle and default * {@link javax.media.nativewindow.ToolkitLock} via {@link NativeWindowFactory#createDefaultToolkitLock(String, long)}. * @see DefaultGraphicsDevice#DefaultGraphicsDevice(String, String, int, long) */ - public X11GraphicsDevice(long display, int unitID) { + public X11GraphicsDevice(long display, int unitID, boolean owner) { // FIXME: derive unitID from connection could be buggy, one DISPLAY for all screens for example.. super(NativeWindowFactory.TYPE_X11, X11Util.XDisplayString(display), unitID, display); if(0==display) { throw new NativeWindowException("null display"); } + closeDisplay = owner; } /** @@ -73,23 +75,18 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl * @param locker custom {@link javax.media.nativewindow.ToolkitLock}, eg to force null locking in NEWT * @see DefaultGraphicsDevice#DefaultGraphicsDevice(String, String, int, long, ToolkitLock) */ - public X11GraphicsDevice(long display, int unitID, ToolkitLock locker) { + public X11GraphicsDevice(long display, int unitID, ToolkitLock locker, boolean owner) { super(NativeWindowFactory.TYPE_X11, X11Util.XDisplayString(display), unitID, display, locker); if(0==display) { throw new NativeWindowException("null display"); } + closeDisplay = owner; } public Object clone() { return super.clone(); } - public void setCloseDisplay(boolean close) { - closeDisplay = close; - if(DEBUG && close) { - System.err.println(Thread.currentThread().getName() + " - X11GraphicsDevice.setCloseDisplay(true): "+this); - } - } public boolean close() { // FIXME: shall we respect the unitID ? if(closeDisplay && 0 != handle) { diff --git a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java index ffe84cb6d..62b202463 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java +++ b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java @@ -48,9 +48,9 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl super(device, fetchScreen(device, screen)); } - public static AbstractGraphicsScreen createScreenDevice(long display, int screenIdx) { + public static AbstractGraphicsScreen createScreenDevice(long display, int screenIdx, boolean owner) { if(0==display) throw new NativeWindowException("display is null"); - return new X11GraphicsScreen(new X11GraphicsDevice(display, AbstractGraphicsDevice.DEFAULT_UNIT), screenIdx); + return new X11GraphicsScreen(new X11GraphicsDevice(display, AbstractGraphicsDevice.DEFAULT_UNIT, owner), screenIdx); } public long getDefaultVisualID() { |