diff options
Diffstat (limited to 'src/newt')
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java | 11 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java | 34 |
2 files changed, 35 insertions, 10 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java index 335da25ca..ea42c27af 100644 --- a/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java @@ -107,14 +107,23 @@ public class DisplayDriver extends DisplayImpl { defaultPointerIcon = null; } - if( DEBUG_POINTER_ICON ) { + if( DEBUG ) { System.err.println("Display.createNativeImpl: "+this); + } + if( DEBUG_POINTER_ICON ) { System.err.println("Display.createNativeImpl: defaultPointerIcon "+defaultPointerIcon); } } @Override protected void closeNativeImpl(final AbstractGraphicsDevice aDevice) { + if( DEBUG ) { + System.err.println("Display.closeNativeImpl: "+this); + } + if( null != defaultPointerIcon ) { + defaultPointerIcon.destroy(); + defaultPointerIcon = null; + } aDevice.close(); DRMLib.gbm_device_destroy(gbmHandle); gbmHandle = 0; diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java index 2e1b88c47..eb0b93f3e 100644 --- a/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java @@ -59,12 +59,24 @@ public class ScreenDriver extends ScreenImpl { if( DEBUG ) { drmMode.print(System.err); } - defaultPointerIcon = ((DisplayDriver)display).defaultPointerIcon; + synchronized(pointerIconSync) { + defaultPointerIcon = ((DisplayDriver)display).defaultPointerIcon; + } + if( DEBUG ) { + System.err.println("Screen.createNativeImpl: "+this); + } } @Override protected void closeNativeImpl() { - defaultPointerIcon = null; + if( DEBUG ) { + System.err.println("Screen.closeNativeImpl: "+this); + } + synchronized(pointerIconSync) { + defaultPointerIcon = null; + activePointerIcon = null; + activePointerIconVisible = false; + } drmMode.destroy(); drmMode = null; } @@ -119,12 +131,16 @@ public class ScreenDriver extends ScreenImpl { MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null); crtc_ids = new int[] { encoder[scridx].getCrtc_id() }; - if( null != defaultPointerIcon ) { - final LinuxMouseTracker lmt = LinuxMouseTracker.getSingleton(); - if( null != lmt ) { - setPointerIconActive(defaultPointerIcon, lmt.getLastX(), lmt.getLastY()); - } else { - setPointerIconActive(defaultPointerIcon, 0, 0); + + synchronized(pointerIconSync) { + // requires crtc_ids[] to be set! + if( null != defaultPointerIcon ) { + final LinuxMouseTracker lmt = LinuxMouseTracker.getSingleton(); + if( null != lmt ) { + setPointerIconActive(defaultPointerIcon, lmt.getLastX(), lmt.getLastY()); + } else { + setPointerIconActive(defaultPointerIcon, 0, 0); + } } } } @@ -209,8 +225,8 @@ public class ScreenDriver extends ScreenImpl { protected native void initNative(long drmHandle); protected int[] crtc_ids; + private final Object pointerIconSync = new Object(); private PointerIconImpl activePointerIcon; private boolean activePointerIconVisible; - private final Object pointerIconSync = new Object(); private PointerIconImpl defaultPointerIcon = null; } |