diff options
author | Sven Gothel <sgothel@jausoft.com> | 2011-09-06 06:58:51 +0200 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2011-09-06 06:58:51 +0200 |
commit | 086ea0a1abeb625f900edbf8513e3f1358b72f8e (patch) | |
tree | 296418852dfaba0b85691ccabcd772892065b8e2 /src/newt/classes/jogamp | |
parent | 68f5a97ef165a39769040e36114c572c7d0f1abd (diff) |
NEWT/X11Screen::setCurrentScreenMode: Use device's 'user' Display connection instead of on-the-fly temp one
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/x11/X11Screen.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java b/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java index d9ffdc5ec..db24cd088 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java +++ b/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java @@ -32,12 +32,12 @@ */ package jogamp.newt.driver.x11; -import jogamp.nativewindow.x11.X11Util; import jogamp.newt.ScreenImpl; import com.jogamp.newt.ScreenMode; import com.jogamp.newt.util.ScreenModeUtil; import java.util.List; +import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.x11.*; public class X11Screen extends ScreenImpl { @@ -212,14 +212,15 @@ public class X11Screen extends ScreenImpl { throw new RuntimeException("Invalid resolution index: ! 0 < "+resIdx+" < "+resNumber+", screenMode["+screenModeIdx+"] "+screenMode); } - long dpy = X11Util.openDisplay(display.getName()); - if( 0 == dpy ) { - throw new RuntimeException("Error creating display: "+display.getName()); + final AbstractGraphicsDevice aDevice = display.getGraphicsDevice(); + if(null == aDevice) { + throw new RuntimeException("null device - not initialized: "+display); } - + aDevice.lock(); boolean done = false; long t0 = System.currentTimeMillis(); try { + long dpy = aDevice.getHandle(); int f = screenMode.getMonitorMode().getRefreshRate(); int r = screenMode.getRotation(); if( setCurrentScreenModeStart0(dpy, screen_idx, resIdx, f, r) ) { @@ -231,7 +232,7 @@ public class X11Screen extends ScreenImpl { } } } finally { - X11Util.closeDisplay(dpy); + aDevice.unlock(); } if(!done) { |