aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-18 08:11:19 +0200
committerSven Gothel <[email protected]>2013-10-18 08:11:19 +0200
commit1c51abc1872b3cb984800fd76941a82dacd9e7b1 (patch)
tree1b26b1536c8b139b802573ea2a37260c51ea17b1 /src/newt/classes/jogamp
parent47d73819a71b7d9c4d2182a4de5712435832c5a1 (diff)
parentf1ae8ddb87c88a57dce4593f006881ef6a7f0932 (diff)
Merge remote-tracking branch 'hharrison/master'
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/Debug.java19
-rw-r--r--src/newt/classes/jogamp/newt/DefaultEDTUtil.java36
-rw-r--r--src/newt/classes/jogamp/newt/DisplayImpl.java75
-rw-r--r--src/newt/classes/jogamp/newt/MonitorDeviceImpl.java28
-rw-r--r--src/newt/classes/jogamp/newt/MonitorModeProps.java44
-rw-r--r--src/newt/classes/jogamp/newt/NEWTJNILibLoader.java17
-rw-r--r--src/newt/classes/jogamp/newt/OffscreenWindow.java35
-rw-r--r--src/newt/classes/jogamp/newt/ScreenImpl.java98
-rw-r--r--src/newt/classes/jogamp/newt/ScreenMonitorState.java18
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java570
-rw-r--r--src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java16
-rw-r--r--src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java74
-rw-r--r--src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java31
-rw-r--r--src/newt/classes/jogamp/newt/driver/DriverClearFocus.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java8
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java44
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java33
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java20
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java31
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java56
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java15
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java24
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java28
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java13
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java25
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java36
-rw-r--r--src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java15
-rw-r--r--src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java26
-rw-r--r--src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java24
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java15
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java30
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java28
-rw-r--r--src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java16
-rw-r--r--src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java46
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java21
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java38
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java35
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java138
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java21
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java28
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java99
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java30
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/RandR.java22
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/RandR11.java66
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/RandR13.java60
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java73
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java100
-rw-r--r--src/newt/classes/jogamp/newt/event/NEWTEventTask.java10
-rw-r--r--src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java48
-rw-r--r--src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java48
50 files changed, 1299 insertions, 1138 deletions
diff --git a/src/newt/classes/jogamp/newt/Debug.java b/src/newt/classes/jogamp/newt/Debug.java
index 4b0a98216..7ef2d7ffc 100644
--- a/src/newt/classes/jogamp/newt/Debug.java
+++ b/src/newt/classes/jogamp/newt/Debug.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -51,14 +51,15 @@ public class Debug extends PropertyAccess {
// Some common properties
private static final boolean verbose;
private static final boolean debugAll;
-
+
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
PropertyAccess.addTrustedPrefix("newt.");
return null;
} } );
-
+
verbose = isPropertyDefined("newt.verbose", true);
debugAll = isPropertyDefined("newt.debug", true);
if (verbose) {
diff --git a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
index 3d1037ad5..f33b4744e 100644
--- a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -51,7 +51,7 @@ public class DefaultEDTUtil implements EDTUtil {
public static final boolean DEBUG = Debug.debug("EDT");
private final Object edtLock = new Object(); // locking the EDT start/stop state
- private /* final */ ThreadGroup threadGroup;
+ private /* final */ ThreadGroup threadGroup;
private final String name;
private final Runnable dispatchMessages;
private NEDT edt = null;
@@ -75,7 +75,7 @@ public class DefaultEDTUtil implements EDTUtil {
final public void setPollPeriod(long ms) {
pollPeriod = ms;
}
-
+
@Override
public final boolean start() throws IllegalStateException {
synchronized(edtLock) {
@@ -117,7 +117,7 @@ public class DefaultEDTUtil implements EDTUtil {
public final boolean isCurrentThreadEDT() {
return edt == Thread.currentThread(); // EDT == NEDT
}
-
+
@Override
public final boolean isCurrentThreadNEDT() {
return edt == Thread.currentThread(); // EDT == NEDT
@@ -126,8 +126,8 @@ public class DefaultEDTUtil implements EDTUtil {
@Override
public final boolean isCurrentThreadEDTorNEDT() {
return edt == Thread.currentThread(); // EDT == NEDT
- }
-
+ }
+
@Override
public final boolean isRunning() {
return edt.isRunning() ;
@@ -149,9 +149,9 @@ public class DefaultEDTUtil implements EDTUtil {
private static Runnable nullTask = new Runnable() {
@Override
- public void run() { }
+ public void run() { }
};
-
+
private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) {
Throwable throwable = null;
RunnableTask rTask = null;
@@ -201,7 +201,7 @@ public class DefaultEDTUtil implements EDTUtil {
synchronized(edt.tasks) {
rTask = new RunnableTask(task,
wait ? rTaskLock : null,
- true /* always catch and report Exceptions, don't disturb EDT */,
+ true /* always catch and report Exceptions, don't disturb EDT */,
wait ? null : System.err);
if(stop) {
rTask.setAttachment(new Boolean(true)); // mark final task, will imply shouldStop:=true
@@ -305,8 +305,8 @@ public class DefaultEDTUtil implements EDTUtil {
throw new InternalError("XXX");
}
}
-
- /**
+
+ /**
* Utilizing locking only on tasks and its execution,
* not for event dispatching.
*/
@@ -315,7 +315,7 @@ public class DefaultEDTUtil implements EDTUtil {
if(DEBUG) {
System.err.println(getName()+": Default-EDT run() START "+ getName());
}
- if(Lock.DEBUG) {
+ if(Lock.DEBUG) {
validateNoRecursiveLocksHold();
}
RuntimeException error = null;
@@ -368,7 +368,7 @@ public class DefaultEDTUtil implements EDTUtil {
} finally {
if(DEBUG) {
RunnableTask rt = ( tasks.size() > 0 ) ? tasks.get(0) : null ;
- System.err.println(getName()+": Default-EDT run() END "+ getName()+", tasks: "+tasks.size()+", "+rt+", "+error);
+ System.err.println(getName()+": Default-EDT run() END "+ getName()+", tasks: "+tasks.size()+", "+rt+", "+error);
}
synchronized(edtLock) {
isRunning = false;
diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java
index 0f47c87a0..0c29d772a 100644
--- a/src/newt/classes/jogamp/newt/DisplayImpl.java
+++ b/src/newt/classes/jogamp/newt/DisplayImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt;
@@ -53,6 +53,7 @@ public abstract class DisplayImpl extends Display {
static {
NativeWindowFactory.addCustomShutdownHook(true /* head */, new Runnable() {
+ @Override
public void run() {
WindowImpl.shutdownAll();
ScreenImpl.shutdownAll();
@@ -60,16 +61,16 @@ public abstract class DisplayImpl extends Display {
}
});
}
-
+
/** Ensure static init has been run. */
/* pp */static void initSingleton() { }
-
- private static Class<?> getDisplayClass(String type)
- throws ClassNotFoundException
+
+ private static Class<?> getDisplayClass(String type)
+ throws ClassNotFoundException
{
final Class<?> displayClass = NewtFactory.getCustomClass(type, "DisplayDriver");
if(null==displayClass) {
- throw new ClassNotFoundException("Failed to find NEWT Display Class <"+type+".DisplayDriver>");
+ throw new ClassNotFoundException("Failed to find NEWT Display Class <"+type+".DisplayDriver>");
}
return displayClass;
}
@@ -100,7 +101,7 @@ public abstract class DisplayImpl extends Display {
display.setEDTUtil( display.edtUtil ); // device's default if EDT is used, or null
Display.addDisplay2List(display);
}
-
+
if(DEBUG) {
System.err.println("Display.create() NEW: "+display+" "+getThreadName());
}
@@ -109,7 +110,7 @@ public abstract class DisplayImpl extends Display {
throw new RuntimeException(e);
}
}
-
+
@Override
public boolean equals(Object obj) {
if (obj == null) {
@@ -147,6 +148,7 @@ public abstract class DisplayImpl extends Display {
final DisplayImpl f_dpy = this;
try {
runOnEDTIfAvail(true, new Runnable() {
+ @Override
public void run() {
f_dpy.createNativeImpl();
}});
@@ -168,7 +170,7 @@ public abstract class DisplayImpl extends Display {
protected EDTUtil createEDTUtil() {
final EDTUtil def;
if(NewtFactory.useEDT()) {
- def = new DefaultEDTUtil(Thread.currentThread().getThreadGroup(), "Display-"+getFQName(), dispatchMessagesRunnable);
+ def = new DefaultEDTUtil(Thread.currentThread().getThreadGroup(), "Display-"+getFQName(), dispatchMessagesRunnable);
if(DEBUG) {
System.err.println("Display.createEDTUtil("+getFQName()+"): "+def.getClass().getName());
}
@@ -244,6 +246,7 @@ public abstract class DisplayImpl extends Display {
task.run();
}
+ @Override
public boolean validateEDTStopped() {
if( 0==refCount && null == aDevice ) {
final EDTUtil _edtUtil = edtUtil;
@@ -271,12 +274,13 @@ public abstract class DisplayImpl extends Display {
if(DEBUG) {
System.err.println("Display.destroy(): "+this+", active "+displaysActive+" "+getThreadName());
}
- }
+ }
final DisplayImpl f_dpy = this;
final AbstractGraphicsDevice f_aDevice = aDevice;
aDevice = null;
refCount=0;
stopEDT( edtUtil, new Runnable() { // blocks!
+ @Override
public void run() {
if ( null != f_aDevice ) {
f_dpy.closeNativeImpl(f_aDevice);
@@ -287,10 +291,10 @@ public abstract class DisplayImpl extends Display {
dumpDisplayList("Display.destroy("+getFQName()+") END");
}
}
-
+
/** May be utilized at a shutdown hook, impl. does not block. */
/* pp */ static final void shutdownAll() {
- final int dCount = displayList.size();
+ final int dCount = displayList.size();
if(DEBUG) {
dumpDisplayList("Display.shutdownAll "+dCount+" instances, on thread "+getThreadName());
}
@@ -306,8 +310,9 @@ public abstract class DisplayImpl extends Display {
final EDTUtil edtUtil = d.getEDTUtil();
final AbstractGraphicsDevice f_aDevice = d.aDevice;
d.aDevice = null;
- d.refCount=0;
+ d.refCount=0;
final Runnable closeNativeTask = new Runnable() {
+ @Override
public void run() {
if ( null != d.getGraphicsDevice() ) {
d.closeNativeImpl(f_aDevice);
@@ -329,6 +334,7 @@ public abstract class DisplayImpl extends Display {
}
}
+ @Override
public synchronized final int addReference() {
if(DEBUG) {
System.err.println("Display.addReference() ("+DisplayImpl.getThreadName()+"): "+refCount+" -> "+(refCount+1));
@@ -343,6 +349,7 @@ public abstract class DisplayImpl extends Display {
}
+ @Override
public synchronized final int removeReference() {
if(DEBUG) {
System.err.println("Display.removeReference() ("+DisplayImpl.getThreadName()+"): "+refCount+" -> "+(refCount-1));
@@ -355,6 +362,7 @@ public abstract class DisplayImpl extends Display {
return refCount;
}
+ @Override
public synchronized final int getReferenceCount() {
return refCount;
}
@@ -381,7 +389,7 @@ public abstract class DisplayImpl extends Display {
public final String getFQName() {
return fqname;
}
-
+
@Override
public final boolean isExclusive() {
return exclusive;
@@ -438,7 +446,7 @@ public abstract class DisplayImpl extends Display {
@Override
public String toString() {
final EDTUtil _edtUtil = edtUtil;
- final boolean _edtUtilRunning = ( null != _edtUtil ) ? _edtUtil.isRunning() : false;
+ final boolean _edtUtilRunning = ( null != _edtUtil ) ? _edtUtil.isRunning() : false;
return "NEWT-Display["+getFQName()+", excl "+exclusive+", refCount "+refCount+", hasEDT "+(null!=_edtUtil)+", edtRunning "+_edtUtilRunning+", "+aDevice+"]";
}
@@ -450,13 +458,14 @@ public abstract class DisplayImpl extends Display {
private volatile boolean haveEvents = false;
final protected Runnable dispatchMessagesRunnable = new Runnable() {
+ @Override
public void run() {
DisplayImpl.this.dispatchMessages();
} };
final void dispatchMessage(final NEWTEvent event) {
- try {
- final Object source = event.getSource();
+ try {
+ final Object source = event.getSource();
if(source instanceof NEWTEventConsumer) {
final NEWTEventConsumer consumer = (NEWTEventConsumer) source ;
if(!consumer.consumeEvent(event)) {
@@ -476,10 +485,10 @@ public abstract class DisplayImpl extends Display {
throw re;
}
}
-
+
final void dispatchMessage(final NEWTEventTask eventTask) {
final NEWTEvent event = eventTask.get();
- try {
+ try {
if(null == event) {
// Ooops ?
System.err.println("Warning: event of eventTask is NULL");
@@ -495,15 +504,15 @@ public abstract class DisplayImpl extends Display {
throw re;
}
}
- eventTask.notifyCaller();
+ eventTask.notifyCaller();
}
-
+
@Override
public void dispatchMessages() {
// System.err.println("Display.dispatchMessages() 0 "+this+" "+getThreadName());
- if(0==refCount || // no screens
+ if(0==refCount || // no screens
null==getGraphicsDevice() // no native device
- )
+ )
{
return;
}
@@ -541,13 +550,13 @@ public abstract class DisplayImpl extends Display {
}
return;
}
-
+
// can't wait if we are on EDT or NEDT -> consume right away
if(wait && _edtUtil.isCurrentThreadEDTorNEDT() ) {
dispatchMessage(e);
return;
}
-
+
final Object lock = new Object();
final NEWTEventTask eTask = new NEWTEventTask(e, wait?lock:null);
synchronized(lock) {
@@ -565,13 +574,13 @@ public abstract class DisplayImpl extends Display {
if( null != eTask.getException() ) {
throw eTask.getException();
}
- }
+ }
}
}
public interface DisplayRunnable<T> {
T run(long dpy);
- }
+ }
public static final <T> T runWithLockedDevice(AbstractGraphicsDevice device, DisplayRunnable<T> action) {
T res;
device.lock();
@@ -589,7 +598,7 @@ public abstract class DisplayImpl extends Display {
}
return runWithLockedDevice(device, action);
}
-
+
protected volatile EDTUtil edtUtil = null;
protected int id;
protected String name;
diff --git a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
index 43d558515..9e10879c4 100644
--- a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
+++ b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.newt;
import javax.media.nativewindow.util.DimensionImmutable;
@@ -41,7 +41,7 @@ public class MonitorDeviceImpl extends MonitorDevice {
public MonitorDeviceImpl(ScreenImpl screen, int nativeId, DimensionImmutable sizeMM, Rectangle viewport, MonitorMode currentMode, ArrayHashSet<MonitorMode> supportedModes) {
super(screen, nativeId, sizeMM, viewport, currentMode, supportedModes);
}
-
+
@Override
public final MonitorMode queryCurrentMode() {
final ScreenImpl screenImpl = (ScreenImpl)screen;
@@ -54,7 +54,7 @@ public class MonitorDeviceImpl extends MonitorDevice {
}
MonitorMode mmU = supportedModes.get(mm0); // unified instance
if( null == mmU ) {
- // add new mode avoiding exception!
+ // add new mode avoiding exception!
mmU = sms.getMonitorModes().getOrAdd(mm0);
mmU = supportedModes.getOrAdd(mmU);
if( Screen.DEBUG ) {
@@ -89,21 +89,21 @@ public class MonitorDeviceImpl extends MonitorDevice {
if( mmU.equals( mmC ) ) {
if(Screen.DEBUG) {
System.err.println("Screen.setCurrentMode: 0.0 is-current (skip) "+mmU+" == "+mmC);
- }
+ }
return true;
}
final long tStart;
if(Screen.DEBUG) {
- tStart = System.currentTimeMillis();
+ tStart = System.currentTimeMillis();
} else {
tStart = 0;
}
-
+
sms.fireMonitorModeChangeNotify(this, mmU);
if(Screen.DEBUG) {
System.err.println("Screen.setCurrentMode ("+(System.currentTimeMillis()-tStart)+"ms): fireModeChangeNotify() "+mmU);
}
-
+
boolean success = screenImpl.setCurrentMonitorModeImpl(this, mmU);
if(success) {
if(Screen.DEBUG) {
@@ -135,13 +135,13 @@ public class MonitorDeviceImpl extends MonitorDevice {
private final void setCurrentModeValue(MonitorMode currentMode) {
this.currentMode = currentMode;
}
-
+
/* pp */ final void setViewportValue(Rectangle viewport) {
this.viewport = viewport;
}
-
+
/* pp */ ArrayHashSet<MonitorMode> getSupportedModesImpl() {
return supportedModes;
}
-
+
}
diff --git a/src/newt/classes/jogamp/newt/MonitorModeProps.java b/src/newt/classes/jogamp/newt/MonitorModeProps.java
index 820807e15..9d8f4919c 100644
--- a/src/newt/classes/jogamp/newt/MonitorModeProps.java
+++ b/src/newt/classes/jogamp/newt/MonitorModeProps.java
@@ -54,12 +54,12 @@ public class MonitorModeProps {
* 1: bpp
*/
public static final int NUM_SURFACE_SIZE_PROPERTIES = 1;
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation
* 2: refresh-rate (Hz*100), flags
*/
public static final int NUM_SIZEANDRATE_PROPERTIES = 2;
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation
* 2: id, rotation
*/
@@ -69,7 +69,7 @@ public class MonitorModeProps {
* count + all the above
*/
public static final int NUM_MONITOR_MODE_PROPERTIES_ALL = 8;
-
+
public static final int IDX_MONITOR_MODE_BPP = 1 // count
+ MonitorModeProps.NUM_RESOLUTION_PROPERTIES
;
@@ -79,7 +79,7 @@ public class MonitorModeProps {
+ MonitorModeProps.NUM_SIZEANDRATE_PROPERTIES
+ 1 // id of MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES
;
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation
* 10: count + id, ScreenSizeMM[width, height], rotated Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+
*/
@@ -89,15 +89,15 @@ public class MonitorModeProps {
+ 1 // native mode
+ MonitorModeProps.NUM_RESOLUTION_PROPERTIES // sizeMM
;
-
+
public static class Cache {
public final ArrayHashSet<DimensionImmutable> resolutions = new ArrayHashSet<DimensionImmutable>();
public final ArrayHashSet<SurfaceSize> surfaceSizes = new ArrayHashSet<SurfaceSize>();
- public final ArrayHashSet<MonitorMode.SizeAndRRate> sizeAndRates = new ArrayHashSet<MonitorMode.SizeAndRRate>();
+ public final ArrayHashSet<MonitorMode.SizeAndRRate> sizeAndRates = new ArrayHashSet<MonitorMode.SizeAndRRate>();
public final ArrayHashSet<MonitorMode> monitorModes = new ArrayHashSet<MonitorMode>();
public final ArrayHashSet<MonitorDevice> monitorDevices = new ArrayHashSet<MonitorDevice>();
}
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation */
private static DimensionImmutable streamInResolution(int[] resolutionProperties, int offset) {
Dimension resolution = new Dimension(resolutionProperties[offset++], resolutionProperties[offset++]);
@@ -116,7 +116,7 @@ public class MonitorModeProps {
final int flags = sizeAndRRateProperties[offset++];
return new MonitorMode.SizeAndRRate(surfaceSize, refreshRate, flags);
}
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation */
private static MonitorMode streamInMonitorMode0(MonitorMode.SizeAndRRate sizeAndRate, int[] modeProperties, int offset) {
final int id = modeProperties[offset++];
@@ -161,7 +161,7 @@ public class MonitorModeProps {
if(null!=cache) {
sizeAndRate = cache.sizeAndRates.getOrAdd(sizeAndRate);
}
-
+
MonitorMode monitorMode = MonitorModeProps.streamInMonitorMode0(sizeAndRate, modeProperties, offset);
if(null!=cache) {
monitorMode = cache.monitorModes.getOrAdd(monitorMode);
@@ -193,12 +193,12 @@ public class MonitorModeProps {
}
return data;
}
-
- /**
+
+ /**
* WARNING: must be synchronized with ScreenMode.h, native implementation
* <p>
* Note: This variant only works for impl. w/ a unique mode key pair <i>modeId, rotation</i>.
- * </p>
+ * </p>
* @param mode_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}.
* @param cache hash arrays of unique {@link MonitorMode} components and {@link MonitorDevice}s, allowing to avoid duplicates
* @param modeProperties the input data
@@ -218,7 +218,7 @@ public class MonitorModeProps {
if(count > monitorProperties.length-offset) {
throw new RuntimeException("properties array too short (count), should be >= "+count+", is "+(monitorProperties.length-offset));
}
- final int limit = offset + count;
+ final int limit = offset + count;
offset++;
final List<MonitorMode> allMonitorModes = cache.monitorModes.getData();
final int id = monitorProperties[offset++];
@@ -252,7 +252,7 @@ public class MonitorModeProps {
monitor_idx[0] = _monitorIdx;
}
return monitorDevice;
- }
+ }
private static MonitorMode getByNativeIdAndRotation(List<MonitorMode> monitorModes, int modeId, int rotation) {
if( null!=monitorModes && monitorModes.size()>0 ) {
for (int i=0; i<monitorModes.size(); i++) {
@@ -264,12 +264,12 @@ public class MonitorModeProps {
}
return null;
}
-
- /**
+
+ /**
* WARNING: must be synchronized with ScreenMode.h, native implementation
* <p>
* This variant expects <code>count</code> to be <code>{@link MIN_MONITOR_DEVICE_PROPERTIES} - 1 - {@link NUM_MONITOR_MODE_PROPERTIES}</code>,
- * due to lack of supported mode and current mode.
+ * due to lack of supported mode and current mode.
* </p>
*
* @param mode_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}.
@@ -310,7 +310,7 @@ public class MonitorModeProps {
}
return monitorDevice;
}
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation */
public static int[] streamOutMonitorDevice (MonitorDevice monitorDevice) {
// min 11: count, id, ScreenSizeMM[width, height], Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+
@@ -339,7 +339,7 @@ public class MonitorModeProps {
}
return data;
}
-
+
public final void swapRotatePair(int rotation, int[] pairs, int offset, int numPairs) {
if( MonitorMode.ROTATE_0 == rotation || MonitorMode.ROTATE_180 == rotation ) {
// nop
@@ -347,9 +347,9 @@ public class MonitorModeProps {
}
for(int i=0; i<numPairs; i++, offset+=2) {
final int tmp = pairs[offset];
- pairs[offset] = pairs[offset+1];
+ pairs[offset] = pairs[offset+1];
pairs[offset+1] = tmp;
}
- }
-
+ }
+
}
diff --git a/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java b/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java
index bc12bf3ee..9364ada30 100644
--- a/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java
+++ b/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -48,9 +48,10 @@ import com.jogamp.common.jvm.JNILibLoaderBase;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.cache.TempJarCache;
-public class NEWTJNILibLoader extends JNILibLoaderBase {
+public class NEWTJNILibLoader extends JNILibLoaderBase {
public static boolean loadNEWT() {
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ @Override
public Boolean run() {
Platform.initSingleton();
final String libName = "newt";
diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java
index 0a302d76b..2478b1e5d 100644
--- a/src/newt/classes/jogamp/newt/OffscreenWindow.java
+++ b/src/newt/classes/jogamp/newt/OffscreenWindow.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt;
@@ -50,13 +50,14 @@ import com.jogamp.newt.MonitorDevice;
public class OffscreenWindow extends WindowImpl implements MutableSurface {
long surfaceHandle;
-
+
public OffscreenWindow() {
surfaceHandle = 0;
}
static long nextWindowHandle = 0x100; // start here - a marker
+ @Override
protected void createNativeImpl() {
if(capsRequested.isOnscreen()) {
throw new NativeWindowException("Capabilities is onscreen");
@@ -72,9 +73,10 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
synchronized(OffscreenWindow.class) {
setWindowHandle(nextWindowHandle++);
}
- visibleChanged(false, true);
+ visibleChanged(false, true);
}
+ @Override
protected void closeNativeImpl() {
// nop
}
@@ -85,6 +87,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
surfaceHandle = 0;
}
+ @Override
public void setSurfaceHandle(long handle) {
surfaceHandle = handle ;
}
@@ -92,8 +95,9 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
@Override
public long getSurfaceHandle() {
return surfaceHandle;
- }
+ }
+ @Override
protected void requestFocusImpl(boolean reparented) {
}
@@ -101,7 +105,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
public void setPosition(int x, int y) {
// nop
}
-
+
@Override
public boolean setFullscreen(boolean fullscreen) {
return false; // nop
@@ -112,7 +116,8 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
return false; // nop
}
-
+
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
sizeChanged(false, width, height, false);
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
@@ -137,13 +142,15 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
}
return new Point(0,0);
}
-
+
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
return new Point(x,y);
}
-
+
+ @Override
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
}
diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java
index 7068d7464..d7e6c641c 100644
--- a/src/newt/classes/jogamp/newt/ScreenImpl.java
+++ b/src/newt/classes/jogamp/newt/ScreenImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt;
@@ -56,7 +56,7 @@ import com.jogamp.newt.util.MonitorModeUtil;
public abstract class ScreenImpl extends Screen implements MonitorModeListener {
protected static final boolean DEBUG_TEST_SCREENMODE_DISABLED;
-
+
static {
Debug.initSingleton();
DEBUG_TEST_SCREENMODE_DISABLED = Debug.isPropertyDefined("newt.test.Screen.disableScreenMode", true);
@@ -67,14 +67,14 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
public static final int default_sm_heightmm = 324;
public static final int default_sm_rate = 60;
public static final int default_sm_rotation = 0;
-
+
static {
DisplayImpl.initSingleton();
}
-
+
/** Ensure static init has been run. */
/* pp */static void initSingleton() { }
-
+
protected DisplayImpl display;
protected int screen_idx;
protected String fqname;
@@ -85,14 +85,14 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
protected static Dimension usrSize = null; // property values: newt.ws.swidth and newt.ws.sheight
protected static volatile boolean usrSizeQueried = false;
private ArrayList<MonitorModeListener> refMonitorModeListener = new ArrayList<MonitorModeListener>();
-
+
private long tCreated; // creationTime
- private static Class<?> getScreenClass(String type) throws ClassNotFoundException
+ private static Class<?> getScreenClass(String type) throws ClassNotFoundException
{
final Class<?> screenClass = NewtFactory.getCustomClass(type, "ScreenDriver");
if(null==screenClass) {
- throw new ClassNotFoundException("Failed to find NEWT Screen Class <"+type+".ScreenDriver>");
+ throw new ClassNotFoundException("Failed to find NEWT Screen Class <"+type+".ScreenDriver>");
}
return screenClass;
}
@@ -104,7 +104,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
if(!usrSizeQueried) {
usrSizeQueried = true;
final int w = Debug.getIntProperty("newt.ws.swidth", true, 0);
- final int h = Debug.getIntProperty("newt.ws.sheight", true, 0);
+ final int h = Debug.getIntProperty("newt.ws.sheight", true, 0);
if(w>0 && h>0) {
usrSize = new Dimension(w, h);
System.err.println("User screen size "+usrSize);
@@ -135,7 +135,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
System.err.println("Screen.create() NEW: "+screen+" "+Display.getThreadName());
}
return screen;
- }
+ }
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -167,16 +167,16 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
@Override
public synchronized final void createNative()
throws NativeWindowException
- {
+ {
if(null == aScreen) {
if(DEBUG) {
tCreated = System.nanoTime();
System.err.println("Screen.createNative() START ("+DisplayImpl.getThreadName()+", "+this+")");
} else {
tCreated = 0;
- }
+ }
display.addReference();
-
+
createNativeImpl();
if(null == aScreen) {
throw new NativeWindowException("Screen.createNative() failed to instanciate an AbstractGraphicsScreen");
@@ -249,7 +249,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
protected abstract void createNativeImpl();
protected abstract void closeNativeImpl();
-
+
/**
* Returns the validated screen index, which is either the passed <code>idx</code>
* value or <code>0</code>.
@@ -258,23 +258,23 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
* </p>
*/
protected abstract int validateScreenIndex(int idx);
-
+
/**
* Stores the virtual origin and virtual <b>rotated</b> screen size.
* <p>
- * This method is called after the MonitorMode has been set or changed,
+ * This method is called after the MonitorMode has been set or changed,
* hence you may utilize it.
* </p>
* <p>
* Default implementation uses the union of all monitor's viewport,
- * calculated via {@link #unionOfMonitorViewportSize()}.
+ * calculated via {@link #unionOfMonitorViewportSize()}.
* </p>
* @param vOriginSize storage for result
*/
- protected void calcVirtualScreenOriginAndSize(final Rectangle vOriginSize) {
+ protected void calcVirtualScreenOriginAndSize(final Rectangle vOriginSize) {
unionOfMonitorViewportSize(vOriginSize);
}
-
+
@Override
public final String getFQName() {
return fqname;
@@ -335,15 +335,15 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
//
- // MonitorDevice and MonitorMode
+ // MonitorDevice and MonitorMode
//
-
+
/**
* To be implemented by the native specification.<br>
* Is called within a thread safe environment.<br>
* Is called only to collect the {@link MonitorMode}s and {@link MonitorDevice}s, usually at startup setting up modes.<br>
* <br>
- * <b>WARNING</b>: must be synchronized with
+ * <b>WARNING</b>: must be synchronized with
* <ul>
* <li>{@link MonitorModeProps#NUM_SCREEN_MODE_PROPERTIES} and </li>
* <li>{@link MonitorModeProps#MIN_MONITOR_DEVICE_PROPERTIES}</li>
@@ -356,19 +356,19 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
* @param cache memory pool caching the result
*/
protected abstract void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache);
-
+
protected Rectangle getNativeMonitorDeviceViewportImpl(MonitorDevice monitor) { return null; }
-
+
/**
* To be implemented by the native specification.<br>
* Is called within a thread safe environment.<br>
* <p>
- * Implementation shall not unify the result w/ monitor's supported modes or a locally
+ * Implementation shall not unify the result w/ monitor's supported modes or a locally
* saved {@link MonitorModeProps.Cache}, since caller will perform such tasks.
* </p>
*/
protected abstract MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor);
-
+
/**
* To be implemented by the native specification.<br>
* Is called within a thread safe environment.<br>
@@ -378,13 +378,13 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
@Override
public final List<MonitorMode> getMonitorModes() {
final ScreenMonitorState sms = getScreenMonitorStatus(false);
- return null != sms ? sms.getMonitorModes().getData() : null;
+ return null != sms ? sms.getMonitorModes().getData() : null;
}
-
+
@Override
public final List<MonitorDevice> getMonitorDevices() {
final ScreenMonitorState sms = getScreenMonitorStatus(false);
- return null != sms ? sms.getMonitorDevices().getData() : null;
+ return null != sms ? sms.getMonitorDevices().getData() : null;
}
final ScreenMonitorState getScreenMonitorStatus(boolean throwException) {
@@ -395,7 +395,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
return res;
}
-
+
@Override
public void monitorModeChangeNotify(MonitorEvent me) {
if(DEBUG) {
@@ -417,9 +417,9 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
if( null != newViewport ) {
monitor.setViewportValue(newViewport);
}
- }
+ }
}
-
+
@Override
public void monitorModeChanged(MonitorEvent me, boolean success) {
if(success) {
@@ -443,9 +443,9 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
public synchronized final void removeMonitorModeListener(MonitorModeListener sml) {
refMonitorModeListener.remove(sml);
}
-
+
/**
- *
+ *
* @param cache optional ..
* @param modeId
* @return
@@ -468,7 +468,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
/**
- *
+ *
* @param cache mandatory !
* @param monitorId
* @param currentMode
@@ -493,7 +493,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
return MonitorModeProps.streamInMonitorDevice(null, cache, this, props, 0);
}
-
+
/**
* Utilizes {@link #getCurrentMonitorModeImpl()}, if the latter returns null it uses
* the current screen size and dummy values.
@@ -530,7 +530,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
sms = ScreenMonitorState.getScreenMonitorState(this.getFQName());
if(null==sms) {
final MonitorModeProps.Cache cache = new MonitorModeProps.Cache();
- if( 0 >= collectNativeMonitorModes(cache) ) {
+ if( 0 >= collectNativeMonitorModes(cache) ) {
updateVirtualScreenOriginAndSize();
vScrnSizeUpdated = true;
final MonitorMode mode = getVirtualMonitorMode(cache, 0);
@@ -557,7 +557,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
System.err.println("["+i+"]["+j+"]: "+iMode.next());
}
}
- }
+ }
sms = new ScreenMonitorState(cache.monitorDevices, cache.monitorModes);
ScreenMonitorState.mapScreenMonitorState(this.getFQName(), sms);
}
@@ -580,7 +580,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
* Collects {@link MonitorDevice}s and {@link MonitorMode}s within the given cache.
* </p>
*/
- private final int collectNativeMonitorModes(MonitorModeProps.Cache cache) {
+ private final int collectNativeMonitorModes(MonitorModeProps.Cache cache) {
if(!DEBUG_TEST_SCREENMODE_DISABLED) {
collectNativeMonitorModesAndDevicesImpl(cache);
}
@@ -639,12 +639,12 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
} finally {
sms.unlock();
}
- }
+ }
} finally {
ScreenMonitorState.unlockScreenMonitorState();
}
}
-
+
private final void shutdown() {
ScreenMonitorState sms = ScreenMonitorState.getScreenMonitorStateUnlocked(getFQName());
if(null != sms) {
@@ -661,11 +661,11 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
}
ScreenMonitorState.unmapScreenMonitorStateUnlocked(getFQName());
- }
+ }
}
-
+
/** pp */ static final void shutdownAll() {
- final int sCount = screenList.size();
+ final int sCount = screenList.size();
if(DEBUG) {
System.err.println("Screen.shutdownAll "+sCount+" instances, on thread "+Display.getThreadName());
}
diff --git a/src/newt/classes/jogamp/newt/ScreenMonitorState.java b/src/newt/classes/jogamp/newt/ScreenMonitorState.java
index 66e75be16..01e6cfee9 100644
--- a/src/newt/classes/jogamp/newt/ScreenMonitorState.java
+++ b/src/newt/classes/jogamp/newt/ScreenMonitorState.java
@@ -42,7 +42,7 @@ import java.util.HashMap;
public class ScreenMonitorState {
private static boolean DEBUG = Screen.DEBUG;
-
+
private final RecursiveLock lock = LockFactory.createRecursiveLock();
private final ArrayHashSet<MonitorDevice> allMonitors;
private final ArrayHashSet<MonitorMode> allMonitorModes;
@@ -105,21 +105,21 @@ public class ScreenMonitorState {
protected static void unlockScreenMonitorState() {
screen2ScreenMonitorState.unlock();
}
-
+
public ScreenMonitorState(ArrayHashSet<MonitorDevice> allMonitors,
ArrayHashSet<MonitorMode> allMonitorModes) {
- this.allMonitors = allMonitors;
+ this.allMonitors = allMonitors;
this.allMonitorModes = allMonitorModes;
}
- protected ArrayHashSet<MonitorDevice> getMonitorDevices() {
+ protected ArrayHashSet<MonitorDevice> getMonitorDevices() {
return allMonitors;
}
-
- protected ArrayHashSet<MonitorMode> getMonitorModes() {
+
+ protected ArrayHashSet<MonitorMode> getMonitorModes() {
return allMonitorModes;
}
-
+
protected final int addListener(MonitorModeListener l) {
lock();
try {
@@ -151,14 +151,14 @@ public class ScreenMonitorState {
protected final MonitorDevice getMonitor(MonitorDevice monitor) {
return allMonitors.get(monitor);
}
-
+
protected final void validateMonitor(MonitorDevice monitor) {
final MonitorDevice md = allMonitors.get(monitor);
if( null == md ) {
throw new InternalError("Monitor unknown: "+monitor);
}
}
-
+
protected final void fireMonitorModeChangeNotify(MonitorDevice monitor, MonitorMode desiredMode) {
lock();
try {
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index a35d89408..5102fd26d 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt;
@@ -87,19 +87,19 @@ import jogamp.nativewindow.SurfaceUpdatedHelper;
public abstract class WindowImpl implements Window, NEWTEventConsumer
{
public static final boolean DEBUG_TEST_REPARENT_INCOMPATIBLE;
-
+
static {
Debug.initSingleton();
DEBUG_TEST_REPARENT_INCOMPATIBLE = Debug.isPropertyDefined("newt.test.Window.reparent.incompatible", true);
-
+
ScreenImpl.initSingleton();
}
-
- protected static final ArrayList<WeakReference<WindowImpl>> windowList = new ArrayList<WeakReference<WindowImpl>>();
-
+
+ protected static final ArrayList<WeakReference<WindowImpl>> windowList = new ArrayList<WeakReference<WindowImpl>>();
+
/** Maybe utilized at a shutdown hook, impl. does not block. */
public static final void shutdownAll() {
- final int wCount = windowList.size();
+ final int wCount = windowList.size();
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.shutdownAll "+wCount+" instances, on thread "+getThreadName());
}
@@ -132,25 +132,25 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
/** Timeout of queued events (repaint and resize) */
- static final long QUEUED_EVENT_TO = 1200; // ms
+ static final long QUEUED_EVENT_TO = 1200; // ms
private static final PointerType[] constMousePointerTypes = new PointerType[] { PointerType.Mouse };
-
+
//
// Volatile: Multithread Mutable Access
- //
+ //
private volatile long windowHandle = 0; // lifecycle critical
private volatile boolean visible = false; // lifecycle critical
- private volatile boolean hasFocus = false;
+ private volatile boolean hasFocus = false;
private volatile int width = 128, height = 128; // client-area size w/o insets, default: may be overwritten by user
private volatile int x = 64, y = 64; // client-area pos w/o insets
private volatile Insets insets = new Insets(); // insets of decoration (if top-level && decorated)
-
+
private RecursiveLock windowLock = LockFactory.createRecursiveLock(); // Window instance wide lock
private int surfaceLockCount = 0; // surface lock recursion count
-
+
private ScreenImpl screen; // never null after create - may change reference though (reparent)
private boolean screenReferenceAdded = false;
private NativeWindow parentWindow = null;
@@ -162,7 +162,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private List<MonitorDevice> fullscreenMonitors = null;
private boolean fullscreenUseMainMonitor = true;
private boolean autoPosition = true; // default: true (allow WM to choose top-level position, if not set by user)
-
+
private int nfs_width, nfs_height, nfs_x, nfs_y; // non fullscreen client-area size/pos w/o insets
private NativeWindow nfs_parent = null; // non fullscreen parent, in case explicit reparenting is performed (offscreen)
private String title = "Newt Window";
@@ -178,26 +178,26 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private KeyListener keyboardFocusHandler = null;
private SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper();
-
+
private Object childWindowsLock = new Object();
private ArrayList<NativeWindow> childWindows = new ArrayList<NativeWindow>();
private ArrayList<MouseListener> mouseListeners = new ArrayList<MouseListener>();
-
+
/** from event passing: {@link WindowImpl#consumePointerEvent(MouseEvent)}. */
private static class PointerState0 {
/** mouse entered window - is inside the window (may be synthetic) */
boolean insideWindow = false;
-
+
/** last time when a mouse button was pressed */
long lastButtonPressTime = 0;
-
+
void clearButton() {
lastButtonPressTime = 0;
}
}
private PointerState0 pState0 = new PointerState0();
-
+
/** from direct input: {@link WindowImpl#doPointerEvent(boolean, boolean, int[], short, int, int, boolean, short[], int[], int[], float[], float, float[], float)}. */
private static class PointerState1 extends PointerState0 {
/** current pressed mouse button number */
@@ -206,15 +206,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
int buttonPressedMask = 0;
/** last mouse button click count */
short lastButtonClickCount = (short)0;
-
+
+ @Override
final void clearButton() {
super.clearButton();
lastButtonPressTime = 0;
- lastButtonClickCount = (short)0;
+ lastButtonClickCount = (short)0;
buttonPressed = 0;
- buttonPressedMask = 0;
+ buttonPressedMask = 0;
}
-
+
/** last pointer-move position for 8 touch-down pointers */
final Point[] movePositions = new Point[] {
new Point(), new Point(), new Point(), new Point(),
@@ -227,16 +228,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
private PointerState1 pState1 = new PointerState1();
-
+
/** pointer names -> pointer ID (consecutive index, starting w/ 0) */
private final ArrayHashSet<Integer> pName2pID = new ArrayHashSet<Integer>();
-
+
private boolean defaultGestureHandlerEnabled = true;
private DoubleTapScrollGesture gesture2PtrTouchScroll = null;
private ArrayList<GestureHandler> pointerGestureHandler = new ArrayList<GestureHandler>();
-
+
private ArrayList<GestureHandler.GestureListener> gestureListeners = new ArrayList<GestureHandler.GestureListener>();
-
+
private ArrayList<KeyListener> keyListeners = new ArrayList<KeyListener>();
private ArrayList<WindowListener> windowListeners = new ArrayList<WindowListener>();
@@ -267,7 +268,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
{
final Class<?> windowClass = NewtFactory.getCustomClass(type, "WindowDriver");
if(null==windowClass) {
- throw new ClassNotFoundException("Failed to find NEWT Window Class <"+type+".WindowDriver>");
+ throw new ClassNotFoundException("Failed to find NEWT Window Class <"+type+".WindowDriver>");
}
return windowClass;
}
@@ -293,7 +294,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
throw new NativeWindowException(t);
}
}
-
+
public static WindowImpl create(Object[] cstrArguments, Screen screen, CapabilitiesImmutable caps) {
try {
Class<?> windowClass = getWindowClass(screen.getDisplay().getType());
@@ -329,11 +330,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
hasFocus = false;
parentWindowHandle = 0;
}
-
+
protected final void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg) {
config = cfg;
}
-
+
public static interface LifecycleHook {
/**
* Reset of internal state counter, ie totalFrames, etc.
@@ -341,8 +342,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
*/
public abstract void resetCounter();
- /**
- * Invoked after Window setVisible,
+ /**
+ * Invoked after Window setVisible,
* allows allocating resources depending on the native Window.
* Called from EDT while window is locked.
*/
@@ -354,9 +355,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @param value <code>true</code> to set the one-shot preservation if supported, otherwise clears it.
*/
void preserveGLStateAtDestroy(boolean value);
-
- /**
- * Invoked before Window destroy action,
+
+ /**
+ * Invoked before Window destroy action,
* allows releasing of resources depending on the native Window.<br>
* Surface not locked yet.<br>
* Called not necessarily from EDT.
@@ -388,12 +389,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @see #pauseRenderingAction()
*/
void resumeRenderingAction();
-
+
/**
* Shutdown rendering action (thread) abnormally.
* <p>
* Should be called only at shutdown, if necessary.
- * </p>
+ * </p>
*/
void shutdownRenderingAction();
}
@@ -406,14 +407,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
} else {
tStart = 0;
}
-
- if( null != parentWindow &&
+
+ if( null != parentWindow &&
NativeSurface.LOCK_SURFACE_NOT_READY >= parentWindow.lockSurface() ) {
throw new NativeWindowException("Parent surface lock: not ready: "+parentWindow);
}
-
+
// child window: position defaults to 0/0, no auto position, no negative position
- if( null != parentWindow && ( autoPosition || 0>getX() || 0>getY() ) ) {
+ if( null != parentWindow && ( autoPosition || 0>getX() || 0>getY() ) ) {
definePosition(0, 0);
}
boolean postParentlockFocus = false;
@@ -536,12 +537,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private Object closingListenerLock = new Object();
private WindowClosingMode defaultCloseOperation = WindowClosingMode.DISPOSE_ON_CLOSE;
+ @Override
public WindowClosingMode getDefaultCloseOperation() {
synchronized (closingListenerLock) {
return defaultCloseOperation;
}
}
+ @Override
public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
synchronized (closingListenerLock) {
WindowClosingMode _op = defaultCloseOperation;
@@ -556,28 +559,28 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/**
* Notifies the driver impl. that the instantiation is finished,
- * ie. instance created and all fields set.
+ * ie. instance created and all fields set.
*/
protected void instantiationFinished() {
// nop
}
-
+
protected boolean canCreateNativeImpl() {
return true; // default: always able to be created
}
-
- /**
+
+ /**
* The native implementation must set the native windowHandle.<br>
*
* <p>
* The implementation shall respect the states {@link #isAlwaysOnTop()}/{@link #FLAG_IS_ALWAYSONTOP} and
* {@link #isUndecorated()}/{@link #FLAG_IS_UNDECORATED}, ie. the created window shall reflect those settings.
* </p>
- *
+ *
* <p>
* The implementation should invoke the referenced java state callbacks
* to notify this Java object of state changes.</p>
- *
+ *
* @see #windowDestroyNotify(boolean)
* @see #focusChanged(boolean, boolean)
* @see #visibleChanged(boolean, boolean)
@@ -589,16 +592,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected abstract void closeNativeImpl();
- /**
+ /**
* Async request which shall be performed within {@link #TIMEOUT_NATIVEWINDOW}.
* <p>
- * If if <code>force == false</code> the native implementation
+ * If if <code>force == false</code> the native implementation
* may only request focus if not yet owner.</p>
* <p>
* {@link #focusChanged(boolean, boolean)} should be called
- * to notify about the focus traversal.
- * </p>
- *
+ * to notify about the focus traversal.
+ * </p>
+ *
* @param force if true, bypass {@link #focusChanged(boolean, boolean)} and force focus request
*/
protected abstract void requestFocusImpl(boolean force);
@@ -608,7 +611,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public static final int FLAG_CHANGE_FULLSCREEN = 1 << 2;
public static final int FLAG_CHANGE_ALWAYSONTOP = 1 << 3;
public static final int FLAG_CHANGE_VISIBILITY = 1 << 4;
-
+
public static final int FLAG_HAS_PARENT = 1 << 8;
public static final int FLAG_IS_UNDECORATED = 1 << 9;
public static final int FLAG_IS_FULLSCREEN = 1 << 10;
@@ -619,12 +622,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/**
* The native implementation should invoke the referenced java state callbacks
* to notify this Java object of state changes.
- *
+ *
* <p>
* Implementations shall set x/y to 0, in case it's negative. This could happen due
* to insets and positioning a decorated window to 0/0, which would place the frame
* outside of the screen.</p>
- *
+ *
* @param x client-area position, or <0 if unchanged
* @param y client-area position, or <0 if unchanged
* @param width client-area size, or <=0 if unchanged
@@ -635,12 +638,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @see #positionChanged(boolean,int, int)
*/
protected abstract boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags);
-
- /**
+
+ /**
* Tests whether a single reconfigure flag is supported by implementation.
* <p>
* Default is all but {@link #FLAG_IS_FULLSCREEN_SPAN}
- * </p>
+ * </p>
*/
protected boolean isReconfigureFlagSupported(int changeFlags) {
return 0 == ( changeFlags & FLAG_IS_FULLSCREEN_SPAN );
@@ -656,14 +659,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected static String getReconfigureFlagsAsString(StringBuilder sb, int flags) {
if(null == sb) { sb = new StringBuilder(); }
sb.append("[");
-
+
if( 0 != ( FLAG_CHANGE_PARENTING & flags) ) {
sb.append("*");
}
sb.append("PARENT_");
sb.append(0 != ( FLAG_HAS_PARENT & flags));
sb.append(", ");
-
+
if( 0 != ( FLAG_CHANGE_FULLSCREEN & flags) ) {
sb.append("*");
}
@@ -679,24 +682,24 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sb.append("UNDECOR_");
sb.append(0 != ( FLAG_IS_UNDECORATED & flags));
sb.append(", ");
-
+
if( 0 != ( FLAG_CHANGE_ALWAYSONTOP & flags) ) {
sb.append("*");
}
sb.append("ALWAYSONTOP_");
sb.append(0 != ( FLAG_IS_ALWAYSONTOP & flags));
sb.append(", ");
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
sb.append("*");
}
sb.append("VISIBLE_");
sb.append(0 != ( FLAG_IS_VISIBLE & flags));
-
+
sb.append("]");
return sb.toString();
}
-
+
protected void setTitleImpl(String title) {}
/**
@@ -713,11 +716,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @return if not null, the screen location of the given coordinates
*/
protected abstract Point getLocationOnScreenImpl(int x, int y);
-
+
/** Triggered by user via {@link #getInsets()}.<br>
- * Implementations may implement this hook to update the insets.<br>
+ * Implementations may implement this hook to update the insets.<br>
* However, they may prefer the event driven path via {@link #insetsChanged(boolean, int, int, int, int)}.
- *
+ *
* @see #getInsets()
* @see #insetsChanged(boolean, int, int, int, int)
*/
@@ -726,7 +729,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected boolean setPointerVisibleImpl(boolean pointerVisible) { return false; }
protected boolean confinePointerImpl(boolean confine) { return false; }
protected void warpPointerImpl(int x, int y) { }
-
+
//----------------------------------------------------------------------
// NativeSurface
//
@@ -791,7 +794,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final RecursiveLock getLock() {
return windowLock;
}
-
+
@Override
public long getSurfaceHandle() {
return windowHandle; // default: return window handle
@@ -810,7 +813,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public final long getDisplayHandle() {
return config.getNativeGraphicsConfiguration().getScreen().getDevice().getHandle();
- }
+ }
@Override
public final int getScreenIndex() {
@@ -879,19 +882,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final Screen getScreen() {
return screen;
}
-
+
@Override
public final MonitorDevice getMainMonitor() {
return screen.getMainMonitor(new Rectangle(getX(), getY(), getWidth(), getHeight()));
}
-
+
protected final void setVisibleImpl(boolean visible, int x, int y, int width, int height) {
- reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY, visible));
- }
+ reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY, visible));
+ }
final void setVisibleActionImpl(boolean visible) {
boolean nativeWindowCreated = false;
boolean madeVisible = false;
-
+
final RecursiveLock _lock = windowLock;
_lock.lock();
try {
@@ -911,7 +914,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
madeVisible = nativeWindowCreated;
}
// always flag visible, allowing a retry ..
- WindowImpl.this.visible = true;
+ WindowImpl.this.visible = true;
} else if(WindowImpl.this.visible != visible) {
if(isNativeValid()) {
setVisibleImpl(visible, getX(), getY(), getWidth(), getHeight());
@@ -956,6 +959,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.visible = visible;
}
+ @Override
public final void run() {
setVisibleActionImpl(visible);
}
@@ -965,14 +969,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window setVisible: START ("+getThreadName()+") "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow));
}
- runOnEDTIfAvail(wait, new VisibleAction(visible));
+ runOnEDTIfAvail(wait, new VisibleAction(visible));
}
@Override
public void setVisible(boolean visible) {
setVisible(true, visible);
}
-
+
private class SetSizeAction implements Runnable {
int width, height;
boolean disregardFS;
@@ -983,6 +987,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.disregardFS = disregardFS;
}
+ @Override
public final void run() {
final RecursiveLock _lock = windowLock;
_lock.lock();
@@ -1024,17 +1029,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private void setFullscreenSize(int width, int height) {
runOnEDTIfAvail(true, new SetSizeAction(width, height, true));
- }
+ }
@Override
public void setSize(int width, int height) {
runOnEDTIfAvail(true, new SetSizeAction(width, height, false));
- }
+ }
@Override
public void setTopLevelSize(int width, int height) {
setSize(width - getInsets().getTotalWidth(), height - getInsets().getTotalHeight());
}
private class DestroyAction implements Runnable {
+ @Override
public final void run() {
boolean animatorPaused = false;
if(null!=lifecycleHook) {
@@ -1049,10 +1055,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window DestroyAction() hasScreen "+(null != screen)+", isNativeValid "+isNativeValid()+" - "+getThreadName());
}
-
+
// send synced destroy-notify notification
sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
-
+
// Childs first ..
synchronized(childWindowsLock) {
if(childWindows.size()>0) {
@@ -1111,30 +1117,30 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(animatorPaused) {
lifecycleHook.resumeRenderingAction();
}
-
+
// these refs shall be kept alive - resurrection via setVisible(true)
/**
if(null!=parentWindow && parentWindow instanceof Window) {
((Window)parentWindow).removeChild(WindowImpl.this);
- }
+ }
childWindows = null;
surfaceUpdatedListeners = null;
mouseListeners = null;
keyListeners = null;
capsRequested = null;
lifecycleHook = null;
-
- screen = null;
+
+ screen = null;
windowListeners = null;
parentWindow = null;
- */
+ */
}
}
private final DestroyAction destroyAction = new DestroyAction();
@Override
public void destroy() {
- visible = false; // Immediately mark synchronized visibility flag, avoiding possible recreation
+ visible = false; // Immediately mark synchronized visibility flag, avoiding possible recreation
runOnEDTIfAvail(true, destroyAction);
}
@@ -1144,15 +1150,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
destroy();
}
-
+
/**
* @param cWin child window, must not be null
* @param pWin parent window, may be null
- * @return true if at least one of both window's configurations is offscreen
+ * @return true if at least one of both window's configurations is offscreen
*/
protected static boolean isOffscreenInstance(NativeWindow cWin, NativeWindow pWin) {
boolean ofs = false;
- final AbstractGraphicsConfiguration cWinCfg = cWin.getGraphicsConfiguration();
+ final AbstractGraphicsConfiguration cWinCfg = cWin.getGraphicsConfiguration();
if( null != cWinCfg ) {
ofs = !cWinCfg.getChosenCapabilities().isOnscreen();
}
@@ -1164,7 +1170,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return ofs;
}
-
+
private class ReparentAction implements Runnable {
final NativeWindow newParentWindow;
final int topLevelX, topLevelY;
@@ -1187,7 +1193,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
removeScreenReference();
screen = newScreen;
}
-
+
+ @Override
public final void run() {
boolean animatorPaused = false;
if(null!=lifecycleHook) {
@@ -1198,7 +1205,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
lifecycleHook.resumeRenderingAction();
}
}
-
+
private void reparent() {
// mirror pos/size so native change notification can get overwritten
final int oldX = getX();
@@ -1209,7 +1216,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
int width = oldWidth;
int height = oldHeight;
boolean wasVisible;
-
+
final RecursiveLock _lock = windowLock;
_lock.lock();
try {
@@ -1217,7 +1224,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// force recreation if offscreen, since it may become onscreen
forceDestroyCreate |= isOffscreenInstance(WindowImpl.this, newParentWindow);
}
-
+
wasVisible = isVisible();
Window newParentWindowNEWT = null;
@@ -1233,7 +1240,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(null!=newParentWindow) {
// REPARENT TO CHILD WINDOW
-
+
// reset position to 0/0 within parent space
x = 0;
y = 0;
@@ -1278,7 +1285,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
operation = ReparentOperation.ACTION_NATIVE_CREATION_PENDING;
}
} else if ( forceDestroyCreate || !NewtFactory.isScreenCompatible(newParentWindow, screen) ) {
- // Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources if becoming visible again.
+ // Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources if becoming visible again.
destroy( wasVisible );
if(null!=newParentWindowNEWT) {
setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() );
@@ -1333,11 +1340,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if ( ReparentOperation.ACTION_INVALID == operation ) {
throw new NativeWindowException("Internal Error: reparentAction not set");
}
-
+
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.reparent: ACTION ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" new parentWindowHandle "+toHexString(newParentWindowHandle)+", reparentAction "+operation+", pos/size "+x+"/"+y+" "+width+"x"+height+", visible "+wasVisible);
}
-
+
if( ReparentOperation.ACTION_NOP == operation ) {
return;
}
@@ -1401,18 +1408,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
if(ok) {
requestFocusInt( 0 == parentWindowHandle /* skipFocusAction if top-level */);
- display.dispatchMessagesNative(); // status up2date
+ display.dispatchMessagesNative(); // status up2date
}
}
}
if(!ok || !wasVisible) {
- // make size and position persistent manual,
+ // make size and position persistent manual,
// since we don't have a WM feedback (invisible or recreation)
definePosition(x, y);
defineSize(width, height);
}
-
+
if(!ok) {
// native reparent failed -> try creation, while trying to preserve resources if becoming visible again.
if(DEBUG_IMPLEMENTATION) {
@@ -1430,7 +1437,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
definePosition(x, y);
defineSize(width, height);
}
-
+
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.reparent: END-1 ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
}
@@ -1451,7 +1458,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// This may run on the new Display/Screen connection, hence a new EDT task
runOnEDTIfAvail(true, reparentActionRecreate);
break;
-
+
default:
}
}
@@ -1462,6 +1469,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
private class ReparentActionRecreate implements Runnable {
+ @Override
public final void run() {
final RecursiveLock _lock = windowLock;
_lock.lock();
@@ -1514,6 +1522,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.undecorated = undecorated;
}
+ @Override
public final void run() {
final RecursiveLock _lock = windowLock;
_lock.lock();
@@ -1559,6 +1568,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.alwaysOnTop = alwaysOnTop;
}
+ @Override
public final void run() {
final RecursiveLock _lock = windowLock;
_lock.lock();
@@ -1566,7 +1576,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(WindowImpl.this.alwaysOnTop != alwaysOnTop) {
// set current state
WindowImpl.this.alwaysOnTop = alwaysOnTop;
-
+
if( isNativeValid() ) {
// Mirror pos/size so native change notification can get overwritten
final int x = getX();
@@ -1591,12 +1601,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final void setAlwaysOnTop(boolean value) {
runOnEDTIfAvail(true, new AlwaysOnTopAction(value));
}
-
+
@Override
public final boolean isAlwaysOnTop() {
return alwaysOnTop;
}
-
+
@Override
public String getTitle() {
return title;
@@ -1624,7 +1634,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
setVal = setPointerVisibleImpl(pointerVisible);
}
if(setVal) {
- this.pointerVisible = pointerVisible;
+ this.pointerVisible = pointerVisible;
}
}
}
@@ -1632,7 +1642,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public boolean isPointerConfined() {
return pointerConfined;
}
-
+
@Override
public void confinePointer(boolean confine) {
if(this.pointerConfined != confine) {
@@ -1652,18 +1662,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
if(setVal) {
- this.pointerConfined = confine;
+ this.pointerConfined = confine;
}
- }
+ }
}
-
+
@Override
public void warpPointer(int x, int y) {
if(0 != getWindowHandle()) {
warpPointerImpl(x, y);
}
}
-
+
@Override
public final InsetsImmutable getInsets() {
if(isUndecorated()) {
@@ -1672,7 +1682,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
updateInsetsImpl(insets);
return insets;
}
-
+
@Override
public final int getWidth() {
return width;
@@ -1694,8 +1704,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
protected final boolean autoPosition() { return autoPosition; }
-
- /** Sets the position fields {@link #x} and {@link #y} to the given values and {@link #autoPosition} to false. */
+
+ /** Sets the position fields {@link #x} and {@link #y} to the given values and {@link #autoPosition} to false. */
protected final void definePosition(int x, int y) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("definePosition: "+this.x+"/"+this.y+" -> "+x+"/"+y);
@@ -1705,7 +1715,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.x = x; this.y = y;
}
- /** Sets the size fields {@link #width} and {@link #height} to the given values. */
+ /** Sets the size fields {@link #width} and {@link #height} to the given values. */
protected final void defineSize(int width, int height) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("defineSize: "+this.width+"x"+this.height+" -> "+width+"x"+height);
@@ -1713,7 +1723,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
this.width = width; this.height = height;
}
-
+
@Override
public final boolean isVisible() {
return visible;
@@ -1732,7 +1742,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final Window getDelegatedWindow() {
return this;
}
-
+
//----------------------------------------------------------------------
// WindowImpl
//
@@ -1755,8 +1765,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
return old;
}
- /**
- * If this Window actually wraps a {@link NativeSurface} from another instance or toolkit,
+ /**
+ * If this Window actually wraps a {@link NativeSurface} from another instance or toolkit,
* it will return such reference. Otherwise returns null.
*/
public NativeSurface getWrappedSurface() {
@@ -1768,13 +1778,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
windowDestroyNotifyAction = r;
}
- /**
- * Returns the non delegated {@link AbstractGraphicsConfiguration},
+ /**
+ * Returns the non delegated {@link AbstractGraphicsConfiguration},
* see {@link #getGraphicsConfiguration()}. */
public final AbstractGraphicsConfiguration getPrivateGraphicsConfiguration() {
return config;
}
-
+
protected final long getParentWindowHandle() {
return isFullscreen() ? 0 : parentWindowHandle;
}
@@ -1834,6 +1844,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
private final Runnable requestFocusAction = new Runnable() {
+ @Override
public final void run() {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.RequestFocusAction: force 0 - ("+getThreadName()+"): "+hasFocus+" -> true - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
@@ -1842,6 +1853,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
};
private final Runnable requestFocusActionForced = new Runnable() {
+ @Override
public final void run() {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.RequestFocusAction: force 1 - ("+getThreadName()+"): "+hasFocus+" -> true - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
@@ -1864,7 +1876,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public void requestFocus(boolean wait) {
requestFocus(wait /* wait */, false /* skipFocusAction */, brokenFocusChange /* force */);
}
-
+
private void requestFocus(boolean wait, boolean skipFocusAction, boolean force) {
if( isNativeValid() &&
( force || !hasFocus() ) &&
@@ -1872,7 +1884,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
runOnEDTIfAvail(wait, force ? requestFocusActionForced : requestFocusAction);
}
}
-
+
/** Internally forcing request focus on current thread */
private void requestFocusInt(boolean skipFocusAction) {
if( skipFocusAction || !focusAction() ) {
@@ -1880,14 +1892,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window.RequestFocusInt: forcing - ("+getThreadName()+"): skipFocusAction "+skipFocusAction+", focus "+hasFocus+" -> true - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
}
requestFocusImpl(true);
- }
+ }
}
-
+
@Override
public void setFocusAction(FocusRunnable focusAction) {
this.focusAction = focusAction;
}
-
+
private boolean focusAction() {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.focusAction() START - "+getThreadName()+", focusAction: "+focusAction+" - windowHandle "+toHexString(getWindowHandle()));
@@ -1903,16 +1915,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return res;
}
-
+
protected void setBrokenFocusChange(boolean v) {
brokenFocusChange = v;
}
-
+
@Override
public void setKeyboardFocusHandler(KeyListener l) {
keyboardFocusHandler = l;
}
-
+
private class SetPositionAction implements Runnable {
int x, y;
@@ -1921,6 +1933,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.y = y;
}
+ @Override
public final void run() {
final RecursiveLock _lock = windowLock;
_lock.lock();
@@ -1932,7 +1945,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(isNativeValid()) {
// this.x/this.y will be set by sizeChanged, triggered by windowing event system
reconfigureWindowImpl(x, y, getWidth(), getHeight(), getReconfigureFlags(0, isVisible()));
-
+
// Wait until custom position is reached within tolerances
waitForPosition(true, x, y, Window.TIMEOUT_NATIVEWINDOW);
} else {
@@ -1950,16 +1963,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
autoPosition = false;
runOnEDTIfAvail(true, new SetPositionAction(x, y));
}
-
+
@Override
public void setTopLevelPosition(int x, int y) {
setPosition(x + getInsets().getLeftWidth(), y + getInsets().getTopHeight());
}
-
+
private class FullScreenAction implements Runnable {
boolean fullscreen;
- private boolean init(boolean fullscreen) {
+ private boolean init(boolean fullscreen) {
if(isNativeValid()) {
this.fullscreen = fullscreen;
return isFullscreen() != fullscreen;
@@ -1967,9 +1980,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
WindowImpl.this.fullscreen = fullscreen; // set current state for createNative(..)
return false;
}
- }
+ }
public boolean fsOn() { return fullscreen; }
+ @Override
public final void run() {
final RecursiveLock _lock = windowLock;
_lock.lock();
@@ -1981,9 +1995,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final int oldY = getY();
final int oldWidth = getWidth();
final int oldHeight = getHeight();
-
+
int x,y,w,h;
-
+
final RectangleImmutable sviewport = screen.getViewport();
final RectangleImmutable viewport;
final int fs_span_flag;
@@ -2007,7 +2021,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
nfs_y = oldY;
nfs_width = oldWidth;
nfs_height = oldHeight;
- x = viewport.getX();
+ x = viewport.getX();
y = viewport.getY();
w = viewport.getWidth();
h = viewport.getHeight();
@@ -2020,12 +2034,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
y = nfs_y;
w = nfs_width;
h = nfs_height;
-
+
if(null!=parentWindow) {
// reset position to 0/0 within parent space
x = 0;
y = 0;
-
+
// refit if size is bigger than parent
if( w > parentWindow.getWidth() ) {
w = parentWindow.getWidth();
@@ -2044,7 +2058,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final DisplayImpl display = (DisplayImpl) screen.getDisplay();
display.dispatchMessagesNative(); // status up2date
final boolean wasVisible = isVisible();
-
+
// Lock parentWindow only during reparenting (attempt)
final NativeWindow parentWindowLocked;
if( null != parentWindow ) {
@@ -2065,8 +2079,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
parentWindowLocked = null;
}
try {
- reconfigureWindowImpl(x, y, w, h,
- getReconfigureFlags( ( ( null != parentWindowLocked ) ? FLAG_CHANGE_PARENTING : 0 ) |
+ reconfigureWindowImpl(x, y, w, h,
+ getReconfigureFlags( ( ( null != parentWindowLocked ) ? FLAG_CHANGE_PARENTING : 0 ) |
fs_span_flag | FLAG_CHANGE_FULLSCREEN | FLAG_CHANGE_DECORATION, isVisible()) );
} finally {
if(null!=parentWindowLocked) {
@@ -2074,7 +2088,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
display.dispatchMessagesNative(); // status up2date
-
+
if(wasVisible) {
setVisibleImpl(true, x, y, w, h);
boolean ok = 0 <= WindowImpl.this.waitForVisible(true, false);
@@ -2086,7 +2100,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
if(ok) {
requestFocusInt(fullscreen /* skipFocusAction if fullscreen */);
- display.dispatchMessagesNative(); // status up2date
+ display.dispatchMessagesNative(); // status up2date
}
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window fs done: ok " + ok + ", " + WindowImpl.this);
@@ -2098,24 +2112,24 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener
}
}
- private final FullScreenAction fullScreenAction = new FullScreenAction();
+ private final FullScreenAction fullScreenAction = new FullScreenAction();
@Override
public boolean setFullscreen(boolean fullscreen) {
return setFullscreenImpl(fullscreen, true, null);
}
-
+
@Override
public boolean setFullscreen(List<MonitorDevice> monitors) {
return setFullscreenImpl(true, false, monitors);
}
-
+
private boolean setFullscreenImpl(boolean fullscreen, boolean useMainMonitor, List<MonitorDevice> monitors) {
synchronized(fullScreenAction) {
fullscreenMonitors = monitors;
fullscreenUseMainMonitor = useMainMonitor;
if( fullScreenAction.init(fullscreen) ) {
- if(fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow)) {
+ if(fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow)) {
// enable fullscreen on offscreen instance
if(null != parentWindow) {
nfs_parent = parentWindow;
@@ -2124,19 +2138,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
throw new InternalError("Offscreen instance w/o parent unhandled");
}
}
-
+
runOnEDTIfAvail(true, fullScreenAction);
-
+
if(!fullScreenAction.fsOn() && null != nfs_parent) {
// disable fullscreen on offscreen instance
reparentWindow(nfs_parent, -1, -1, true /* forceDestroyCreate */);
nfs_parent = null;
}
}
- return this.fullscreen;
+ return this.fullscreen;
}
}
-
+
private class MonitorModeListenerImpl implements MonitorModeListener {
boolean animatorPaused = false;
boolean hadFocus = false;
@@ -2144,6 +2158,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
List<MonitorDevice> _fullscreenMonitors = null;
boolean _fullscreenUseMainMonitor = true;
+ @Override
public void monitorModeChangeNotify(MonitorEvent me) {
hadFocus = hasFocus();
if(DEBUG_IMPLEMENTATION) {
@@ -2164,6 +2179,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
+ @Override
public void monitorModeChanged(MonitorEvent me, boolean success) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.monitorModeChanged: hadFocus "+hadFocus+", "+me+", success: "+success+" @ "+Thread.currentThread().getName());
@@ -2226,7 +2242,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//----------------------------------------------------------------------
// Child Window Management
- //
+ //
@Override
public final boolean removeChild(NativeWindow win) {
@@ -2282,7 +2298,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.consumeEvent: REPAINT "+Thread.currentThread().getName()+" - queued "+e+", discard-to "+discardTO);
// Thread.dumpStack();
- }
+ }
return discardTO; // discardTO:=true -> consumed
}
return true;
@@ -2343,11 +2359,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
// MouseListener/Event Support
//
-
+
//
// Native MouseEvents pre-processed to be enqueued or consumed directly
//
-
+
public final void sendMouseEvent(short eventType, int modifiers,
int x, int y, short button, float rotation) {
doMouseEvent(false, false, eventType, modifiers, x, y, button, MouseEvent.getRotationXYZ(rotation, modifiers), 1f);
@@ -2369,11 +2385,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
int x, int y, short button, float[] rotationXYZ, float rotationScale) {
doMouseEvent(true, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale);
} */
-
+
/**
* Send mouse event (one-pointer) either to be directly consumed or to be enqueued
- *
- * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
+ *
+ * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
* otherwise {@link #consumeEvent(NEWTEvent) consumed} directly.
* @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}.
*/
@@ -2383,7 +2399,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
throw new NativeWindowException("Invalid mouse button number" + button);
}
doPointerEvent(enqueue, wait, constMousePointerTypes, eventType, modifiers,
- 0 /*actionIdx*/, new short[] { (short)(button-1) },
+ 0 /*actionIdx*/, new short[] { (short)(button-1) },
new int[]{x}, new int[]{y}, new float[]{0f} /*pressure*/,
1f /*maxPressure*/, rotationXYZ, rotationScale);
}
@@ -2396,11 +2412,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* </p>
* <p>
* The given pointer names, <code>pNames</code>, are mapped to consecutive pointer IDs starting w/ 0
- * using a hash-map if <code>normalPNames</code> is <code>false</code>.
- * Otherwise a simple <code>int</code> to <code>short</code> type cast is performed.
+ * using a hash-map if <code>normalPNames</code> is <code>false</code>.
+ * Otherwise a simple <code>int</code> to <code>short</code> type cast is performed.
* </p>
- *
- * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
+ *
+ * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
* otherwise {@link #consumeEvent(NEWTEvent) consumed} directly.
* @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}.
* @param pTypes {@link MouseEvent.PointerType} for each pointer (multiple pointer)
@@ -2410,14 +2426,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @param normalPNames see pName below.
* @param pNames Pointer name for each pointer (multiple pointer).
* We assume consecutive pointer names starting w/ 0 if <code>normalPIDs</code> is <code>true</code>.
- * Otherwise we hash-map the values during state pressed to retrieve the normal ID.
+ * Otherwise we hash-map the values during state pressed to retrieve the normal ID.
* @param pX X-axis for each pointer (multiple pointer)
* @param pY Y-axis for each pointer (multiple pointer)
* @param pPressure Pressure for each pointer (multiple pointer)
* @param maxPressure Maximum pointer pressure for all pointer
*/
public final void doPointerEvent(boolean enqueue, boolean wait,
- final PointerType[] pTypes, short eventType, int modifiers,
+ final PointerType[] pTypes, short eventType, int modifiers,
int actionIdx, boolean normalPNames, final int[] pNames,
final int[] pX, final int[] pY, float[] pPressure,
float maxPressure, final float[] rotationXYZ, final float rotationScale) {
@@ -2447,25 +2463,25 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
pIDs[i] = (short)pNames[i];
}
}
- doPointerEvent(enqueue, wait, pTypes, eventType, modifiers, actionIdx, pIDs,
+ doPointerEvent(enqueue, wait, pTypes, eventType, modifiers, actionIdx, pIDs,
pX, pY, pPressure, maxPressure, rotationXYZ, rotationScale);
}
-
+
/**
* Send multiple-pointer event either to be directly consumed or to be enqueued
* <p>
* The index for the element of multiple-pointer arrays represents the pointer which triggered the event
* is passed via <i>actionIdx</i>.
- * </p>
- *
- * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
+ * </p>
+ *
+ * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
* otherwise {@link #consumeEvent(NEWTEvent) consumed} directly.
* @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}.
* @param pTypes {@link MouseEvent.PointerType} for each pointer (multiple pointer)
* @param eventType
* @param modifiers
* @param pActionIdx index of multiple-pointer arrays representing the pointer which triggered the event
- * @param pID Pointer ID for each pointer (multiple pointer). We assume consecutive pointerIDs starting w/ 0.
+ * @param pID Pointer ID for each pointer (multiple pointer). We assume consecutive pointerIDs starting w/ 0.
* A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move.
* @param pX X-axis for each pointer (multiple pointer)
* @param pY Y-axis for each pointer (multiple pointer)
@@ -2473,14 +2489,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @param maxPressure Maximum pointer pressure for all pointer
*/
public final void doPointerEvent(boolean enqueue, boolean wait,
- final PointerType[] pTypes, short eventType, int modifiers,
+ final PointerType[] pTypes, short eventType, int modifiers,
int pActionIdx, final short[] pID, final int[] pX, final int[] pY, final float[] pPressure,
float maxPressure, final float[] rotationXYZ, float rotationScale) {
final long when = System.currentTimeMillis();
final int pCount = pTypes.length;
-
+
if( 0 > pActionIdx || pActionIdx >= pCount) {
- throw new IllegalArgumentException("actionIdx out of bounds [0.."+(pCount-1)+"]");
+ throw new IllegalArgumentException("actionIdx out of bounds [0.."+(pCount-1)+"]");
}
if( 0 < pActionIdx ) {
// swap values to make idx 0 the triggering pointer
@@ -2518,11 +2534,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
button = com.jogamp.newt.event.MouseEvent.BUTTON1;
}
}
-
+
//
// - Determine ENTERED/EXITED state
// - Remove redundant move/drag events
- // - Reset states if applicable
+ // - Reset states if applicable
//
int x = pX[0];
int y = pY[0];
@@ -2537,7 +2553,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
movePositionP0.set(0, 0);
}
// Fall through intended!
-
+
case MouseEvent.EVENT_MOUSE_ENTERED:
// clip coordinates to window dimension
x = Math.min(Math.max(x, 0), getWidth()-1);
@@ -2545,11 +2561,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
pState1.insideWindow = eventType == MouseEvent.EVENT_MOUSE_ENTERED;
pState1.clearButton();
break;
-
+
case MouseEvent.EVENT_MOUSE_MOVED:
case MouseEvent.EVENT_MOUSE_DRAGGED:
if( null != movePositionP0 ) {
- if( pState1.insideWindow && movePositionP0.getX() == x && movePositionP0.getY() == y ) {
+ if( pState1.insideWindow && movePositionP0.getX() == x && movePositionP0.getY() == y ) {
if(DEBUG_MOUSE_EVENT) {
System.err.println("doPointerEvent: skip "+MouseEvent.getEventTypeString(eventType)+" w/ same position: "+movePositionP0);
}
@@ -2557,16 +2573,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
movePositionP0.set(x, y);
}
-
+
// Fall through intended !
-
+
default:
if(!pState1.insideWindow) {
- pState1.insideWindow = true;
+ pState1.insideWindow = true;
pState1.clearButton();
}
}
-
+
if( x < 0 || y < 0 || x >= getWidth() || y >= getHeight() ) {
if(DEBUG_MOUSE_EVENT) {
System.err.println("doPointerEvent: drop: "+MouseEvent.getEventTypeString(eventType)+
@@ -2582,29 +2598,29 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final int buttonMask = InputEvent.getButtonMask(button);
modifiers |= buttonMask; // Always add current button to modifier mask (Bug 571)
modifiers |= pState1.buttonPressedMask; // Always add currently pressed mouse buttons to modifier mask
-
+
if( isPointerConfined() ) {
modifiers |= InputEvent.CONFINED_MASK;
}
if( !isPointerVisible() ) {
modifiers |= InputEvent.INVISIBLE_MASK;
}
-
+
pX[0] = x;
pY[0] = y;
-
+
//
// - Determine CLICK COUNT
// - Ignore sent CLICKED
// - Track buttonPressed incl. buttonPressedMask
// - Fix MOVED/DRAGGED event
//
- final MouseEvent e;
+ final MouseEvent e;
switch( eventType ) {
case MouseEvent.EVENT_MOUSE_CLICKED:
e = null;
break;
-
+
case MouseEvent.EVENT_MOUSE_PRESSED:
if( 0 >= pPressure[0] ) {
pPressure[0] = maxPressure;
@@ -2618,16 +2634,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
pState1.lastButtonPressTime = when;
pState1.buttonPressed = button;
- e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, pState1.lastButtonClickCount, rotationXYZ, rotationScale);
} else {
- e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, (short)1, rotationXYZ, rotationScale);
}
break;
case MouseEvent.EVENT_MOUSE_RELEASED:
if( 1 == pCount ) {
- e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, pState1.lastButtonClickCount, rotationXYZ, rotationScale);
if( when - pState1.lastButtonPressTime >= MouseEvent.getClickTimeout() ) {
pState1.lastButtonClickCount = (short)0;
@@ -2635,7 +2651,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
pState1.buttonPressed = 0;
} else {
- e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, (short)1, rotationXYZ, rotationScale);
}
pState1.buttonPressedMask &= ~buttonMask;
@@ -2645,10 +2661,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
break;
case MouseEvent.EVENT_MOUSE_MOVED:
if ( 0 != pState1.buttonPressedMask ) { // any button or pointer move -> drag
- e = new MouseEvent(MouseEvent.EVENT_MOUSE_DRAGGED, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(MouseEvent.EVENT_MOUSE_DRAGGED, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, pState1.buttonPressed, (short)1, rotationXYZ, rotationScale);
} else {
- e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, (short)0, rotationXYZ, rotationScale);
}
break;
@@ -2658,12 +2674,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
// Fall through intended!
default:
- e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, (short)0, rotationXYZ, rotationScale);
}
doEvent(enqueue, wait, e); // actual mouse event
}
-
+
@Override
public final void addMouseListener(MouseListener l) {
addMouseListener(-1, l);
@@ -2676,8 +2692,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@SuppressWarnings("unchecked")
ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone();
- if(0>index) {
- index = clonedListeners.size();
+ if(0>index) {
+ index = clonedListeners.size();
}
clonedListeners.add(index, l);
mouseListeners = clonedListeners;
@@ -2698,8 +2714,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final MouseListener getMouseListener(int index) {
@SuppressWarnings("unchecked")
ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone();
- if(0>index) {
- index = clonedListeners.size()-1;
+ if(0>index) {
+ index = clonedListeners.size()-1;
}
return clonedListeners.get(index);
}
@@ -2717,7 +2733,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final boolean areDefaultGesturesEnabled() {
return defaultGestureHandlerEnabled;
}
-
+
@Override
public final void addGestureHandler(GestureHandler gh) {
addGestureHandler(-1, gh);
@@ -2729,7 +2745,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@SuppressWarnings("unchecked")
ArrayList<GestureHandler> cloned = (ArrayList<GestureHandler>) pointerGestureHandler.clone();
- if(0>index) {
+ if(0>index) {
index = cloned.size();
}
cloned.add(index, gh);
@@ -2756,7 +2772,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@SuppressWarnings("unchecked")
ArrayList<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) gestureListeners.clone();
- if(0>index) {
+ if(0>index) {
index = cloned.size();
}
cloned.add(index, gl);
@@ -2772,11 +2788,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
cloned.remove(gl);
gestureListeners= cloned;
}
-
+
private static int step(int lower, int edge, int value) {
return value < edge ? lower : value;
}
-
+
/**
* Consume the {@link MouseEvent}, i.e.
* <pre>
@@ -2786,18 +2802,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* - dispatch event to listener
* </pre>
*/
- protected void consumePointerEvent(MouseEvent pe) {
+ protected void consumePointerEvent(MouseEvent pe) {
int x = pe.getX();
int y = pe.getY();
-
+
if(DEBUG_MOUSE_EVENT) {
System.err.println("consumePointerEvent.in: "+pe);
}
-
+
//
// - Determine ENTERED/EXITED state
// - Synthesize ENTERED event
- // - Reset states if applicable
+ // - Reset states if applicable
//
final long when = pe.getWhen();
int eventType = pe.getEventType();
@@ -2812,7 +2828,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
pState0.clearButton();
eEntered = null;
break;
-
+
default:
if(!pState0.insideWindow) {
pState0.insideWindow = true;
@@ -2833,12 +2849,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return; // .. invalid ..
}
-
+
//
// Handle Default Gestures
//
if( defaultGestureHandlerEnabled &&
- pe.getPointerType(0).getPointerClass() == MouseEvent.PointerClass.Onscreen )
+ pe.getPointerType(0).getPointerClass() == MouseEvent.PointerClass.Onscreen )
{
if( null == gesture2PtrTouchScroll ) {
final int scaledScrollSlop;
@@ -2849,16 +2865,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final float pixWPerMM = (float)monitor.getCurrentMode().getRotatedWidth() / (float)mm.getWidth();
final float pixHPerMM = (float)monitor.getCurrentMode().getRotatedHeight() / (float)mm.getHeight();
final float pixPerMM = Math.min(pixHPerMM, pixWPerMM);
- scaledScrollSlop = Math.round(DoubleTapScrollGesture.SCROLL_SLOP_MM * pixPerMM);
- scaledDoubleTapSlop = Math.round(DoubleTapScrollGesture.DOUBLE_TAP_SLOP_MM * pixPerMM);
+ scaledScrollSlop = Math.round(DoubleTapScrollGesture.SCROLL_SLOP_MM * pixPerMM);
+ scaledDoubleTapSlop = Math.round(DoubleTapScrollGesture.DOUBLE_TAP_SLOP_MM * pixPerMM);
if(DEBUG_MOUSE_EVENT) {
System.err.println("consumePointerEvent.gscroll: scrollSlop "+scaledScrollSlop+", doubleTapSlop "+scaledDoubleTapSlop+", pixPerMM "+pixPerMM+", "+monitor);
}
} else {
scaledScrollSlop = DoubleTapScrollGesture.SCROLL_SLOP_PIXEL;
- scaledDoubleTapSlop = DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL;
+ scaledDoubleTapSlop = DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL;
}
- gesture2PtrTouchScroll = new DoubleTapScrollGesture(step(DoubleTapScrollGesture.SCROLL_SLOP_PIXEL, DoubleTapScrollGesture.SCROLL_SLOP_PIXEL/2, scaledScrollSlop),
+ gesture2PtrTouchScroll = new DoubleTapScrollGesture(step(DoubleTapScrollGesture.SCROLL_SLOP_PIXEL, DoubleTapScrollGesture.SCROLL_SLOP_PIXEL/2, scaledScrollSlop),
step(DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL, DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL/2, scaledDoubleTapSlop));
}
if( gesture2PtrTouchScroll.process(pe) ) {
@@ -2903,11 +2919,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
//
// - Synthesize mouse CLICKED
// - Ignore sent CLICKED
- //
+ //
final MouseEvent eClicked;
switch( eventType ) {
case MouseEvent.EVENT_MOUSE_PRESSED:
@@ -2921,7 +2937,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
eClicked = pe.createVariant(MouseEvent.EVENT_MOUSE_CLICKED);
} else {
eClicked = null;
- pState0.lastButtonPressTime = 0;
+ pState0.lastButtonPressTime = 0;
}
break;
case MouseEvent.EVENT_MOUSE_CLICKED:
@@ -2935,7 +2951,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
default:
eClicked = null;
}
-
+
if( null != pe ) {
if(DEBUG_MOUSE_EVENT) {
System.err.println("consumePointerEvent.send.1: "+pe);
@@ -2949,7 +2965,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
dispatchMouseEvent(eClicked);
}
}
-
+
private final void dispatchMouseEvent(MouseEvent e) {
for(int i = 0; !e.isConsumed() && i < mouseListeners.size(); i++ ) {
MouseListener l = mouseListeners.get(i);
@@ -2989,15 +3005,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
private static final int keyTrackingRange = 255;
private final IntBitfield keyPressedState = new IntBitfield( keyTrackingRange + 1 );
-
+
protected final boolean isKeyCodeTracked(final short keyCode) {
return ( 0xFFFF & (int)keyCode ) <= keyTrackingRange;
}
-
+
/**
* @param keyCode the keyCode to set pressed state
* @param pressed true if pressed, otherwise false
- * @return the previus pressed value
+ * @return the previus pressed value
*/
protected final boolean setKeyPressed(short keyCode, boolean pressed) {
final int v = 0xFFFF & (int)keyCode;
@@ -3008,7 +3024,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
/**
* @param keyCode the keyCode to test pressed state
- * @return true if pressed, otherwise false
+ * @return true if pressed, otherwise false
*/
protected final boolean isKeyPressed(short keyCode) {
final int v = 0xFFFF & (int)keyCode;
@@ -3017,7 +3033,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return false;
}
-
+
public void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
// Always add currently pressed mouse buttons to modifier mask
consumeKeyEvent( KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | pState1.buttonPressedMask, keyCode, keySym, keyChar) );
@@ -3027,12 +3043,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Always add currently pressed mouse buttons to modifier mask
enqueueEvent(wait, KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | pState1.buttonPressedMask, keyCode, keySym, keyChar) );
}
-
+
@Override
public final void setKeyboardVisible(boolean visible) {
if(isNativeValid()) {
// We don't skip the impl. if it seems that there is no state change,
- // since we cannot assume the impl. reliably gives us it's current state.
+ // since we cannot assume the impl. reliably gives us it's current state.
final boolean ok = setKeyboardVisibleImpl(visible);
if(DEBUG_IMPLEMENTATION || DEBUG_KEY_EVENT) {
System.err.println("setKeyboardVisible(native): visible "+keyboardVisible+" -- op[visible:"+visible +", ok "+ok+"] -> "+(visible && ok));
@@ -3046,13 +3062,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final boolean isKeyboardVisible() {
return keyboardVisible;
}
- /**
+ /**
* Returns <code>true</code> if operation was successful, otherwise <code>false</code>.
* <p>
* We assume that a failed invisible operation is due to an already invisible keyboard,
- * hence even if an invisible operation failed, the keyboard is considered invisible!
- * </p>
- */
+ * hence even if an invisible operation failed, the keyboard is considered invisible!
+ * </p>
+ */
protected boolean setKeyboardVisibleImpl(boolean visible) {
return false; // nop
}
@@ -3066,7 +3082,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
protected boolean keyboardVisible = false;
-
+
@Override
public void addKeyListener(KeyListener l) {
addKeyListener(-1, l);
@@ -3079,7 +3095,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@SuppressWarnings("unchecked")
ArrayList<KeyListener> clonedListeners = (ArrayList<KeyListener>) keyListeners.clone();
- if(0>index) {
+ if(0>index) {
index = clonedListeners.size();
}
clonedListeners.add(index, l);
@@ -3101,7 +3117,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public KeyListener getKeyListener(int index) {
@SuppressWarnings("unchecked")
ArrayList<KeyListener> clonedListeners = (ArrayList<KeyListener>) keyListeners.clone();
- if(0>index) {
+ if(0>index) {
index = clonedListeners.size()-1;
}
return clonedListeners.get(index);
@@ -3125,7 +3141,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return e.isConsumed();
}
-
+
protected void consumeKeyEvent(KeyEvent e) {
boolean consumedE = false;
if( null != keyboardFocusHandler && !e.isAutoRepeat() ) {
@@ -3164,7 +3180,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@Override
- public void addWindowListener(int index, WindowListener l)
+ public void addWindowListener(int index, WindowListener l)
throws IndexOutOfBoundsException
{
if(l == null) {
@@ -3172,8 +3188,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@SuppressWarnings("unchecked")
ArrayList<WindowListener> clonedListeners = (ArrayList<WindowListener>) windowListeners.clone();
- if(0>index) {
- index = clonedListeners.size();
+ if(0>index) {
+ index = clonedListeners.size();
}
clonedListeners.add(index, l);
windowListeners = clonedListeners;
@@ -3194,8 +3210,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public WindowListener getWindowListener(int index) {
@SuppressWarnings("unchecked")
ArrayList<WindowListener> clonedListeners = (ArrayList<WindowListener>) windowListeners.clone();
- if(0>index) {
- index = clonedListeners.size()-1;
+ if(0>index) {
+ index = clonedListeners.size()-1;
}
return clonedListeners.get(index);
}
@@ -3234,7 +3250,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
l.windowRepaint((WindowUpdateEvent)e);
break;
default:
- throw
+ throw
new NativeWindowException("Unexpected window event type "
+ e.getEventType());
}
@@ -3248,7 +3264,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window.focusChanged: ("+getThreadName()+"): (defer: "+defer+") "+this.hasFocus+" -> "+focusGained+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
}
hasFocus = focusGained;
- final int evt = focusGained ? WindowEvent.EVENT_WINDOW_GAINED_FOCUS : WindowEvent.EVENT_WINDOW_LOST_FOCUS ;
+ final int evt = focusGained ? WindowEvent.EVENT_WINDOW_GAINED_FOCUS : WindowEvent.EVENT_WINDOW_LOST_FOCUS ;
if(!defer) {
sendWindowEvent(evt);
} else {
@@ -3256,7 +3272,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
/** Triggered by implementation's WM events to update the visibility state. */
protected void visibleChanged(boolean defer, boolean visible) {
if(this.visible != visible) {
@@ -3282,7 +3298,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
display.dispatchMessagesNative(); // status up2date
}
if(this.visible != visible) {
- final String msg = "Visibility not reached as requested within "+timeOut+"ms : requested "+visible+", is "+this.visible;
+ final String msg = "Visibility not reached as requested within "+timeOut+"ms : requested "+visible+", is "+this.visible;
if(failFast) {
throw new NativeWindowException(msg);
} else if (DEBUG_IMPLEMENTATION) {
@@ -3297,7 +3313,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
- /** Triggered by implementation's WM events to update the client-area size w/o insets/decorations. */
+ /** Triggered by implementation's WM events to update the client-area size w/o insets/decorations. */
protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) {
if(force || getWidth() != newWidth || getHeight() != newHeight) {
if(DEBUG_IMPLEMENTATION) {
@@ -3316,7 +3332,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
private boolean waitForSize(int w, int h, boolean failFast, long timeOut) {
final DisplayImpl display = (DisplayImpl) screen.getDisplay();
display.dispatchMessagesNative(); // status up2date
@@ -3338,8 +3354,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
return true;
}
}
-
- /** Triggered by implementation's WM events to update the position. */
+
+ /** Triggered by implementation's WM events to update the position. */
protected void positionChanged(boolean defer, int newX, int newY) {
if ( getX() != newX || getY() != newY ) {
if(DEBUG_IMPLEMENTATION) {
@@ -3352,7 +3368,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
enqueueWindowEvent(false, WindowEvent.EVENT_WINDOW_MOVED);
}
} else {
- autoPosition = false; // ensure it's off even w/ same position
+ autoPosition = false; // ensure it's off even w/ same position
}
}
@@ -3396,10 +3412,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return ok;
}
-
+
/**
- * Triggered by implementation's WM events to update the insets.
- *
+ * Triggered by implementation's WM events to update the insets.
+ *
* @see #getInsets()
* @see #updateInsetsImpl(Insets)
*/
@@ -3409,7 +3425,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.insetsChanged: skip insets change for undecoration mode");
}
- } else if ( (left != insets.getLeftWidth() || right != insets.getRightWidth() ||
+ } else if ( (left != insets.getLeftWidth() || right != insets.getRightWidth() ||
top != insets.getTopHeight() || bottom != insets.getBottomHeight() )
) {
insets.set(left, right, top, bottom);
@@ -3419,10 +3435,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
/**
* Triggered by implementation's WM events or programmatic while respecting {@link #getDefaultCloseOperation()}.
- *
+ *
* @param force if true, overrides {@link #setDefaultCloseOperation(WindowClosingMode)} with {@link WindowClosingProtocol#DISPOSE_ON_CLOSE}
* and hence force destruction. Otherwise is follows the user settings.
* @return true if this window is no more valid and hence has been destroyed, otherwise false.
@@ -3434,9 +3450,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window.windowDestroyNotify(isNativeValid: "+isNativeValid()+", force: "+force+", mode "+defMode+" -> "+mode+") "+getThreadName()+": "+this);
// Thread.dumpStack();
}
-
+
final boolean destroyed;
-
+
if( isNativeValid() ) {
if( WindowClosingMode.DISPOSE_ON_CLOSE == mode ) {
if(force) {
@@ -3457,7 +3473,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// send synced destroy notifications
sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
}
-
+
destroyed = !isNativeValid();
} else {
destroyed = true;
@@ -3465,19 +3481,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.windowDestroyNotify(isNativeValid: "+isNativeValid()+", force: "+force+", mode "+mode+") END "+getThreadName()+": destroyed "+destroyed+", "+this);
- }
-
+ }
+
return destroyed;
}
@Override
public void windowRepaint(int x, int y, int width, int height) {
- windowRepaint(false, x, y, width, height);
+ windowRepaint(false, x, y, width, height);
}
-
+
/**
* Triggered by implementation's WM events to update the content
- */
+ */
protected void windowRepaint(boolean defer, int x, int y, int width, int height) {
width = ( 0 >= width ) ? getWidth() : width;
height = ( 0 >= height ) ? getHeight() : height;
@@ -3542,7 +3558,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected final void shouldNotCallThis() {
throw new NativeWindowException("Should not call this");
}
-
+
public static String getThreadName() {
return Display.getThreadName();
}
diff --git a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
index 861a6d6be..2ba5b3460 100644
--- a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
+++ b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.newt.awt;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
@@ -76,12 +76,12 @@ public class NewtFactoryAWT extends NewtFactory {
}
return (JAWTWindow)nw;
}
-
+
public static void destroyNativeWindow(JAWTWindow jawtWindow) {
final AbstractGraphicsConfiguration config = jawtWindow.getGraphicsConfiguration();
jawtWindow.destroy();
- config.getScreen().getDevice().close();
+ config.getScreen().getDevice().close();
}
-
+
}
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
index d71ad175b..0ee3cc0cd 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,26 +20,26 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.newt.awt.event;
import com.jogamp.newt.event.MouseEvent;
/**
*
- * <a name="AWTEventModifierMapping"><h5>AWT Event Modifier Mapping</h5></a>
+ * <a name="AWTEventModifierMapping"><h5>AWT Event Modifier Mapping</h5></a>
* <pre>
Modifier AWT Constant AWT Bit AWT Ex NEWT Constant NEWT Bit
------------- ------------------------------- ------- ------ ------------------------- --------
- Shift Event.SHIFT_MASK 0
- Ctrl Event.CTRL_MASK 1
- Meta Event.META_MASK 2
- Alt Event.ALT_MASK 3
+ Shift Event.SHIFT_MASK 0
+ Ctrl Event.CTRL_MASK 1
+ Meta Event.META_MASK 2
+ Alt Event.ALT_MASK 3
Button1 InputEvent.BUTTON1_MASK 4
Button2 InputEvent.BUTTON2_MASK 3
Button3 InputEvent.BUTTON3_MASK 2
@@ -88,10 +88,10 @@ public class AWTNewtEventFactory {
Method _getMaskForButtonMethod = null;
try {
_getMaskForButtonMethod = ReflectionUtil.getMethod(java.awt.event.InputEvent.class, "getMaskForButton", int.class);
- } catch(Throwable t) {}
+ } catch(Throwable t) {}
getMaskForButtonMethod = _getMaskForButtonMethod;
} */
-
+
awtButtonDownMasks = new int[com.jogamp.newt.event.MouseEvent.BUTTON_COUNT] ; // java.awt.MouseInfo.getNumberOfButtons() ;
for (int n = 0 ; n < awtButtonDownMasks.length ; ++n) {
awtButtonDownMasks[n] = getAWTButtonDownMaskImpl(n+1);
@@ -112,12 +112,12 @@ public class AWTNewtEventFactory {
case java.awt.event.WindowEvent.WINDOW_LOST_FOCUS: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_LOST_FOCUS;
case java.awt.event.FocusEvent.FOCUS_LOST: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_LOST_FOCUS;
// n/a case java.awt.event.WindowEvent.WINDOW_STATE_CHANGED: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_STATE_CHANGED;
-
+
case java.awt.event.ComponentEvent.COMPONENT_MOVED: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_MOVED;
case java.awt.event.ComponentEvent.COMPONENT_RESIZED: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_RESIZED;
// n/a case java.awt.event.ComponentEvent.COMPONENT_SHOWN: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_SHOWN;
// n/a case java.awt.event.ComponentEvent.COMPONENT_HIDDEN: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_HIDDEN;
-
+
case java.awt.event.MouseEvent.MOUSE_CLICKED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED;
case java.awt.event.MouseEvent.MOUSE_PRESSED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_PRESSED;
case java.awt.event.MouseEvent.MOUSE_RELEASED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_RELEASED;
@@ -126,17 +126,17 @@ public class AWTNewtEventFactory {
case java.awt.event.MouseEvent.MOUSE_EXITED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_EXITED;
case java.awt.event.MouseEvent.MOUSE_DRAGGED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED;
case java.awt.event.MouseEvent.MOUSE_WHEEL: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_WHEEL_MOVED;
-
+
case java.awt.event.KeyEvent.KEY_PRESSED: return com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED;
case java.awt.event.KeyEvent.KEY_RELEASED: return com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED;
}
return (short)0;
}
-
+
private static int getAWTButtonDownMaskImpl(int button) {
/**
* java.awt.event.InputEvent.getMaskForButton(button);
- *
+ *
if(null != getMaskForButtonMethod) {
Object r=null;
try {
@@ -157,16 +157,16 @@ public class AWTNewtEventFactory {
m = 1 << ( 10 + button ) ; // b4 = 1<<14, b5 = 1<<15, etc
} else {
m = 0;
- }
+ }
}
return m;
}
-
+
/**
* <p>
* See <a href="#AWTEventModifierMapping"> AWT event modifier mapping details</a>.
* </p>
- *
+ *
* @param button
* @return
*/
@@ -175,9 +175,9 @@ public class AWTNewtEventFactory {
return awtButtonDownMasks[button-1];
} else {
return 0;
- }
+ }
}
-
+
public static final short awtButton2Newt(int awtButton) {
if( 0 < awtButton && awtButton <= com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ) {
return (short)awtButton;
@@ -185,32 +185,32 @@ public class AWTNewtEventFactory {
return (short)0;
}
}
-
+
/**
* Converts the specified set of AWT event modifiers and extended event
* modifiers to the equivalent NEWT event modifiers.
- *
+ *
* <p>
* See <a href="#AWTEventModifierMapping"> AWT event modifier mapping details</a>.
* </p>
- *
+ *
* @param awtMods
* The AWT event modifiers.
- *
+ *
* @param awtModsEx
* The AWT extended event modifiers.
* AWT passes mouse button specific bits here and are the preferred way check the mouse button state.
*/
public static final int awtModifiers2Newt(final int awtMods, final int awtModsEx) {
int newtMods = 0;
-
+
/** Redundant old modifiers ..
if ((awtMods & java.awt.event.InputEvent.SHIFT_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.SHIFT_MASK;
if ((awtMods & java.awt.event.InputEvent.CTRL_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.CTRL_MASK;
if ((awtMods & java.awt.event.InputEvent.META_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.META_MASK;
if ((awtMods & java.awt.event.InputEvent.ALT_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.ALT_MASK;
if ((awtMods & java.awt.event.InputEvent.ALT_GRAPH_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.ALT_GRAPH_MASK; */
-
+
if ((awtModsEx & java.awt.event.InputEvent.SHIFT_DOWN_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.SHIFT_MASK;
if ((awtModsEx & java.awt.event.InputEvent.CTRL_DOWN_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.CTRL_MASK;
if ((awtModsEx & java.awt.event.InputEvent.META_DOWN_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.META_MASK;
@@ -221,7 +221,7 @@ public class AWTNewtEventFactory {
// being ignored intentionally. The AWT docs say that the
// BUTTON1_DOWN_MASK etc bits in the extended modifiers are
// the preferred place to check current button state.
-
+
if( 0 != awtModsEx ) {
for (int n = 0 ; n < awtButtonDownMasks.length ; ++n) {
if ( (awtModsEx & awtButtonDownMasks[n]) != 0 ) {
@@ -232,7 +232,7 @@ public class AWTNewtEventFactory {
return newtMods;
}
-
+
public static short awtKeyCode2NewtKeyCode(final int awtKeyCode) {
final short defNEWTKeyCode = (short)awtKeyCode;
switch (awtKeyCode) {
@@ -371,7 +371,7 @@ public class AWTNewtEventFactory {
case java.awt.event.KeyEvent.VK_MULTIPLY : return com.jogamp.newt.event.KeyEvent.VK_MULTIPLY;
case java.awt.event.KeyEvent.VK_DIVIDE : return com.jogamp.newt.event.KeyEvent.VK_DIVIDE;
case java.awt.event.KeyEvent.VK_NUM_LOCK : return com.jogamp.newt.event.KeyEvent.VK_NUM_LOCK;
- case java.awt.event.KeyEvent.VK_KP_LEFT : /** Fall through intended .. */
+ case java.awt.event.KeyEvent.VK_KP_LEFT : /** Fall through intended .. */
case java.awt.event.KeyEvent.VK_LEFT : return com.jogamp.newt.event.KeyEvent.VK_LEFT;
case java.awt.event.KeyEvent.VK_KP_UP : /** Fall through intended .. */
case java.awt.event.KeyEvent.VK_UP : return com.jogamp.newt.event.KeyEvent.VK_UP;
@@ -381,7 +381,7 @@ public class AWTNewtEventFactory {
case java.awt.event.KeyEvent.VK_DOWN : return com.jogamp.newt.event.KeyEvent.VK_DOWN;
case java.awt.event.KeyEvent.VK_CONTEXT_MENU : return com.jogamp.newt.event.KeyEvent.VK_CONTEXT_MENU;
case java.awt.event.KeyEvent.VK_WINDOWS : return com.jogamp.newt.event.KeyEvent.VK_WINDOWS;
- case java.awt.event.KeyEvent.VK_META : return com.jogamp.newt.event.KeyEvent.VK_META;
+ case java.awt.event.KeyEvent.VK_META : return com.jogamp.newt.event.KeyEvent.VK_META;
case java.awt.event.KeyEvent.VK_HELP : return com.jogamp.newt.event.KeyEvent.VK_HELP;
case java.awt.event.KeyEvent.VK_COMPOSE : return com.jogamp.newt.event.KeyEvent.VK_COMPOSE;
case java.awt.event.KeyEvent.VK_BEGIN : return com.jogamp.newt.event.KeyEvent.VK_BEGIN;
@@ -558,7 +558,7 @@ public class AWTNewtEventFactory {
case com.jogamp.newt.event.KeyEvent.VK_DOWN : return java.awt.event.KeyEvent.VK_DOWN;
case com.jogamp.newt.event.KeyEvent.VK_CONTEXT_MENU : return java.awt.event.KeyEvent.VK_CONTEXT_MENU;
case com.jogamp.newt.event.KeyEvent.VK_WINDOWS : return java.awt.event.KeyEvent.VK_WINDOWS;
- case com.jogamp.newt.event.KeyEvent.VK_META : return java.awt.event.KeyEvent.VK_META;
+ case com.jogamp.newt.event.KeyEvent.VK_META : return java.awt.event.KeyEvent.VK_META;
case com.jogamp.newt.event.KeyEvent.VK_HELP : return java.awt.event.KeyEvent.VK_HELP;
case com.jogamp.newt.event.KeyEvent.VK_COMPOSE : return java.awt.event.KeyEvent.VK_COMPOSE;
case com.jogamp.newt.event.KeyEvent.VK_BEGIN : return java.awt.event.KeyEvent.VK_BEGIN;
@@ -636,7 +636,7 @@ public class AWTNewtEventFactory {
}
return new com.jogamp.newt.event.MouseEvent(
newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
- mods, event.getX(), event.getY(), (short)event.getClickCount(),
+ mods, event.getX(), event.getY(), (short)event.getClickCount(),
newtButton, MouseEvent.getRotationXYZ(rotation, mods), 1f);
}
return null; // no mapping ..
@@ -650,11 +650,11 @@ public class AWTNewtEventFactory {
if( (short)0 != newtType ) {
final short newtKeyCode = awtKeyCode2NewtKeyCode( event.getKeyCode() );
return com.jogamp.newt.event.KeyEvent.create(
- newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
- awtModifiers2Newt(event.getModifiers(), event.getModifiersEx()),
+ newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
+ awtModifiers2Newt(event.getModifiers(), event.getModifiersEx()),
newtKeyCode, newtKeyCode, event.getKeyChar());
}
return null; // no mapping ..
}
-
+
}
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
index fa494adca..4bcb0fc82 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.newt.awt.event;
import java.awt.KeyboardFocusManager;
@@ -45,22 +45,25 @@ import com.jogamp.newt.event.awt.AWTWindowAdapter;
public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt.event.HierarchyListener
{
NativeWindow downstreamParent;
-
+
public AWTParentWindowAdapter(NativeWindow downstreamParent, com.jogamp.newt.Window downstream) {
super(downstream);
this.downstreamParent = downstreamParent;
}
+ @Override
public AWTAdapter addTo(java.awt.Component awtComponent) {
awtComponent.addHierarchyListener(this);
return super.addTo(awtComponent);
}
+ @Override
public AWTAdapter removeFrom(java.awt.Component awtComponent) {
awtComponent.removeHierarchyListener(this);
return super.removeFrom(awtComponent);
}
+ @Override
public void focusGained(java.awt.event.FocusEvent e) {
// forward focus to NEWT child
final com.jogamp.newt.Window newtChild = getNewtWindow();
@@ -78,12 +81,14 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt
}
}
+ @Override
public void focusLost(java.awt.event.FocusEvent e) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: focusLost: "+ e);
}
}
+ @Override
public void componentResized(java.awt.event.ComponentEvent e) {
// Need to resize the NEWT child window
// the resized event will be send via the native window feedback.
@@ -93,6 +98,7 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt
}
final Window newtWindow = getNewtWindow();
newtWindow.runOnEDTIfAvail(false, new Runnable() {
+ @Override
public void run() {
int cw = comp.getWidth();
int ch = comp.getHeight();
@@ -109,40 +115,45 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt
}});
}
+ @Override
public void componentMoved(java.awt.event.ComponentEvent e) {
if(DEBUG_IMPLEMENTATION) {
- System.err.println("AWT: componentMoved: "+e);
+ System.err.println("AWT: componentMoved: "+e);
}
final Window newtWindow = getNewtWindow();
if(newtWindow.getDelegatedWindow() instanceof DriverUpdatePosition) {
((DriverUpdatePosition)newtWindow.getDelegatedWindow()).updatePosition(0, 0);
- }
+ }
}
+ @Override
public void windowActivated(java.awt.event.WindowEvent e) {
// no propagation to NEWT child window
}
+ @Override
public void windowDeactivated(java.awt.event.WindowEvent e) {
// no propagation to NEWT child window
}
+ @Override
public void hierarchyChanged(java.awt.event.HierarchyEvent e) {
if( null == getNewtEventListener() ) {
long bits = e.getChangeFlags();
- final java.awt.Component changed = e.getChanged();
+ final java.awt.Component changed = e.getChanged();
if( 0 != ( java.awt.event.HierarchyEvent.SHOWING_CHANGED & bits ) ) {
final boolean showing = changed.isShowing();
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: hierarchyChanged SHOWING_CHANGED: showing "+showing+", "+changed+", source "+e.getComponent());
}
getNewtWindow().runOnEDTIfAvail(false, new Runnable() {
+ @Override
public void run() {
if(getNewtWindow().isVisible() != showing) {
getNewtWindow().setVisible(showing);
}
}});
- }
+ }
if(DEBUG_IMPLEMENTATION) {
if( 0 != ( java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED & bits ) ) {
final boolean displayability = changed.isDisplayable();
diff --git a/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java b/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java
index 0a824e83b..0ff86fe93 100644
--- a/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java
+++ b/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java
@@ -1,10 +1,10 @@
package jogamp.newt.driver;
-/**
+/**
* Interface tagging driver requirement of clearing the focus.
* <p>
- * Some drivers require a programmatic {@link #clearFocus()} when traversing the focus.
- * </p>
+ * Some drivers require a programmatic {@link #clearFocus()} when traversing the focus.
+ * </p>
*/
public interface DriverClearFocus {
/** Programmatic clear the focus */
diff --git a/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java b/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java
index 2ec327187..e5f9b6a68 100644
--- a/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java
+++ b/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java
@@ -1,14 +1,14 @@
package jogamp.newt.driver;
-/**
+/**
* Interface tagging driver requirement of absolute positioning, ie. depend on parent position.
*/
public interface DriverUpdatePosition {
- /**
+ /**
* Programmatic update the top-left corner
* of the client area relative to it's parent.
- *
- * @param x x-component
+ *
+ * @param x x-component
* @param y y-component
**/
void updatePosition(int x, int y);
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
index 9a1632130..f7722c91c 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.awt;
@@ -100,13 +100,14 @@ public class AWTCanvas extends Canvas {
@Override
public void paint(Graphics g) {
}
-
+
public boolean hasDeviceChanged() {
boolean res = displayConfigChanged;
displayConfigChanged=false;
return res;
}
+ @Override
public void addNotify() {
/**
@@ -154,12 +155,13 @@ public class AWTCanvas extends Canvas {
public NativeWindow getNativeWindow() {
final JAWTWindow _jawtWindow = jawtWindow;
return (null != _jawtWindow) ? _jawtWindow : null;
- }
-
+ }
+
public boolean isOffscreenLayerSurfaceEnabled() {
- return null != jawtWindow ? jawtWindow.isOffscreenLayerSurfaceEnabled() : false;
+ return null != jawtWindow ? jawtWindow.isOffscreenLayerSurfaceEnabled() : false;
}
-
+
+ @Override
public void removeNotify() {
try {
dispose();
@@ -188,19 +190,20 @@ public class AWTCanvas extends Canvas {
}
}
}
-
+
private String getThreadName() { return Thread.currentThread().getName(); }
/**
* Overridden to choose a GraphicsConfiguration on a parent container's
* GraphicsDevice because both devices
*/
+ @Override
public GraphicsConfiguration getGraphicsConfiguration() {
/*
* Workaround for problems with Xinerama and java.awt.Component.checkGD
* when adding to a container on a different graphics device than the
* one that this Canvas is associated with.
- *
+ *
* GC will be null unless:
* - A native peer has assigned it. This means we have a native
* peer, and are already comitted to a graphics configuration.
@@ -214,7 +217,7 @@ public class AWTCanvas extends Canvas {
* chosen is only non-null on platforms where the GLDrawableFactory
* returns a non-null GraphicsConfiguration (in the GLCanvas
* constructor).
- *
+ *
* if gc is from this Canvas' native peer then it should equal chosen,
* otherwise it is from an ancestor component that this Canvas is being
* added to, and we go into this block.
@@ -224,21 +227,21 @@ public class AWTCanvas extends Canvas {
* Check for compatibility with gc. If they differ by only the
* device then return a new GCconfig with the super-class' GDevice
* (and presumably the same visual ID in Xinerama).
- *
+ *
*/
if (!chosen.getDevice().getIDstring().equals(gc.getDevice().getIDstring())) {
/*
* Here we select a GraphicsConfiguration on the alternate
* device that is presumably identical to the chosen
* configuration, but on the other device.
- *
+ *
* Should really check to ensure that we select a configuration
* with the same X visual ID for Xinerama screens, otherwise the
* GLDrawable may have the wrong visual ID (I don't think this
* ever gets updated). May need to add a method to
* X11GLDrawableFactory to do this in a platform specific
* manner.
- *
+ *
* However, on platforms where we can actually get into this
* block, both devices should have the same visual list, and the
* same configuration should be selected here.
@@ -265,7 +268,7 @@ public class AWTCanvas extends Canvas {
chosen = compatible;
if( !config.getChosenCapabilities().equals(awtConfig.getChosenCapabilities())) {
displayConfigChanged=true;
- }
+ }
awtConfig = config;
}
}
@@ -275,7 +278,7 @@ public class AWTCanvas extends Canvas {
* return the GC that was selected in the constructor (and might
* cause an exception in Component.checkGD when adding to a
* container, but in this case that would be the desired behavior).
- *
+ *
*/
return chosen;
} else if (gc == null) {
@@ -299,7 +302,7 @@ public class AWTCanvas extends Canvas {
CapabilitiesImmutable capsRequested,
CapabilitiesChooser chooser,
GraphicsDevice device) {
- final AbstractGraphicsScreen aScreen = null != device ?
+ final AbstractGraphicsScreen aScreen = null != device ?
AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT):
AWTGraphicsScreen.createDefault();
AWTGraphicsConfiguration config = (AWTGraphicsConfiguration)
@@ -324,6 +327,7 @@ public class AWTCanvas extends Canvas {
if (!disableBackgroundEraseInitialized) {
try {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
try {
Class<?> clazz = getToolkit().getClass();
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
index 02f4be0cd..4a7193306 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
@@ -40,9 +40,9 @@ import jogamp.newt.Debug;
public class AWTEDTUtil implements EDTUtil {
public static final boolean DEBUG = Debug.debug("EDT");
-
+
private final Object edtLock = new Object(); // locking the EDT start/stop state
- private final ThreadGroup threadGroup;
+ private final ThreadGroup threadGroup;
private final String name;
private final Runnable dispatchMessages;
private NEDT nedt = null;
@@ -66,7 +66,7 @@ public class AWTEDTUtil implements EDTUtil {
final public void setPollPeriod(long ms) {
pollPeriod = ms;
}
-
+
@Override
public final boolean start() throws IllegalStateException {
synchronized(edtLock) {
@@ -107,12 +107,12 @@ public class AWTEDTUtil implements EDTUtil {
public final boolean isCurrentThreadNEDT() {
return nedt == Thread.currentThread();
}
-
+
@Override
public final boolean isCurrentThreadEDTorNEDT() {
- return EventQueue.isDispatchThread() || nedt == Thread.currentThread();
+ return EventQueue.isDispatchThread() || nedt == Thread.currentThread();
}
-
+
@Override
final public boolean isRunning() {
return nedt.isRunning() ;
@@ -127,12 +127,12 @@ public class AWTEDTUtil implements EDTUtil {
public final boolean invoke(boolean wait, Runnable task) {
return invokeImpl(wait, task, false);
}
-
+
private static Runnable nullTask = new Runnable() {
@Override
- public void run() { }
+ public void run() { }
};
-
+
private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) {
Throwable throwable = null;
RunnableTask rTask = null;
@@ -145,7 +145,7 @@ public class AWTEDTUtil implements EDTUtil {
if(DEBUG) {
Thread.dumpStack();
}
- return false;
+ return false;
}
if( isCurrentThreadEDT() ) {
if(null != task) {
@@ -181,7 +181,7 @@ public class AWTEDTUtil implements EDTUtil {
if(null != task) {
rTask = new RunnableTask(task,
wait ? rTaskLock : null,
- true /* always catch and report Exceptions, don't disturb EDT */,
+ true /* always catch and report Exceptions, don't disturb EDT */,
wait ? null : System.err);
AWTEDTExecutor.singleton.invoke(false, rTask);
}
@@ -205,7 +205,7 @@ public class AWTEDTUtil implements EDTUtil {
}
return true;
}
- }
+ }
@Override
final public boolean waitUntilIdle() {
@@ -218,6 +218,7 @@ public class AWTEDTUtil implements EDTUtil {
}
try {
AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ @Override
public void run() { }
});
} catch (Exception e) { }
@@ -241,7 +242,7 @@ public class AWTEDTUtil implements EDTUtil {
}
}
}
-
+
class NEDT extends Thread {
volatile boolean shouldStop = false;
volatile boolean isRunning = false;
@@ -261,7 +262,7 @@ public class AWTEDTUtil implements EDTUtil {
super.start();
}
- /**
+ /**
* Utilizing locking only on tasks and its execution,
* not for event dispatching.
*/
@@ -302,7 +303,7 @@ public class AWTEDTUtil implements EDTUtil {
}
} finally {
if(DEBUG) {
- System.err.println(getName()+": AWT-EDT run() END "+ getName()+", "+error);
+ System.err.println(getName()+": AWT-EDT run() END "+ getName()+", "+error);
}
synchronized(edtLock) {
isRunning = false;
@@ -317,7 +318,7 @@ public class AWTEDTUtil implements EDTUtil {
} // finally
} // run()
} // EventDispatchThread
-
+
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
index 30449f9bc..d9a4a48e5 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.awt;
@@ -46,6 +46,7 @@ public class DisplayDriver extends DisplayImpl {
public DisplayDriver() {
}
+ @Override
protected void createNativeImpl() {
aDevice = AWTGraphicsDevice.createDefault();
}
@@ -54,10 +55,11 @@ public class DisplayDriver extends DisplayImpl {
aDevice = d;
}
+ @Override
protected EDTUtil createEDTUtil() {
final EDTUtil def;
if(NewtFactory.useEDT()) {
- def = new AWTEDTUtil(Thread.currentThread().getThreadGroup(), "AWTDisplay-"+getFQName(), dispatchMessagesRunnable);
+ def = new AWTEDTUtil(Thread.currentThread().getThreadGroup(), "AWTDisplay-"+getFQName(), dispatchMessagesRunnable);
if(DEBUG) {
System.err.println("Display.createNative("+getFQName()+") Create EDTUtil: "+def.getClass().getName());
}
@@ -67,10 +69,12 @@ public class DisplayDriver extends DisplayImpl {
return def;
}
- protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
+ @Override
+ protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
aDevice.close();
}
+ @Override
protected void dispatchMessagesNative() { /* nop */ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
index 126143e1e..a4356707e 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,7 +28,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.awt;
@@ -49,6 +49,7 @@ public class ScreenDriver extends ScreenImpl {
public ScreenDriver() {
}
+ @Override
protected void createNativeImpl() {
aScreen = new AWTGraphicsScreen((AWTGraphicsDevice)display.getGraphicsDevice());
}
@@ -65,11 +66,13 @@ public class ScreenDriver extends ScreenImpl {
super.updateVirtualScreenOriginAndSize();
}
+ @Override
protected void closeNativeImpl() { }
-
+
+ @Override
protected int validateScreenIndex(int idx) {
- return idx; // pass through ...
- }
+ return idx; // pass through ...
+ }
private static MonitorMode getModeProps(Cache cache, DisplayMode mode) {
int rate = mode.getRefreshRate();
@@ -90,16 +93,16 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // flags
props[i++] = 0; // mode_idx
props[i++] = 0; // rotation
- return MonitorModeProps.streamInMonitorMode(null, cache, props, 0);
+ return MonitorModeProps.streamInMonitorMode(null, cache, props, 0);
}
-
+
@Override
protected void collectNativeMonitorModesAndDevicesImpl(Cache cache) {
final GraphicsDevice awtGD = ((AWTGraphicsDevice)getDisplay().getGraphicsDevice()).getGraphicsDevice();
final DisplayMode[] awtModes = awtGD.getDisplayModes();
for(int i=0; i<awtModes.length; i++) {
getModeProps(cache, awtModes[i]);
- }
+ }
final MonitorMode currentMode = getModeProps(cache, awtGD.getDisplayMode());
int[] props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES];
@@ -116,7 +119,7 @@ public class ScreenDriver extends ScreenImpl {
}
@Override
- protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) {
+ protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) {
return null;
}
@@ -124,5 +127,5 @@ public class ScreenDriver extends ScreenImpl {
protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) {
return false;
}
-
+
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
index 77daa556f..9854524d9 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.awt;
@@ -86,6 +86,7 @@ public class WindowDriver extends WindowImpl {
private Frame awtFrame = null;
private AWTCanvas awtCanvas;
+ @Override
protected void requestFocusImpl(boolean reparented) {
awtContainer.requestFocus();
}
@@ -97,6 +98,7 @@ public class WindowDriver extends WindowImpl {
}
}
+ @Override
protected void createNativeImpl() {
if(0!=getParentWindowHandle()) {
throw new RuntimeException("Window parenting not supported in AWT, use AWTWindow(Frame) cstr for wrapping instead");
@@ -109,37 +111,38 @@ public class WindowDriver extends WindowImpl {
} else {
owningFrame=false;
defineSize(awtContainer.getWidth(), awtContainer.getHeight());
- definePosition(awtContainer.getX(), awtContainer.getY());
+ definePosition(awtContainer.getX(), awtContainer.getY());
}
if(null!=awtFrame) {
awtFrame.setTitle(getTitle());
}
awtContainer.setLayout(new BorderLayout());
-
+
if( null == awtCanvas ) {
awtCanvas = new AWTCanvas(capsRequested, WindowDriver.this.capabilitiesChooser);
// canvas.addComponentListener(listener);
awtContainer.add(awtCanvas, BorderLayout.CENTER);
-
+
// via EDT ..
new AWTMouseAdapter(this).addTo(awtCanvas); // fwd all AWT Mouse events to here
new AWTKeyAdapter(this).addTo(awtCanvas); // fwd all AWT Key events to here
-
+
// direct w/o EDT
new AWTWindowAdapter(new LocalWindowListener(), this).addTo(awtCanvas); // fwd all AWT Window events to here
}
reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY | FLAG_CHANGE_DECORATION, true));
// throws exception if failed ..
-
+
final NativeWindow nw = awtCanvas.getNativeWindow();
if( null != nw ) {
- setGraphicsConfiguration( awtCanvas.getAWTGraphicsConfiguration() );
+ setGraphicsConfiguration( awtCanvas.getAWTGraphicsConfiguration() );
setWindowHandle( nw.getWindowHandle() );
}
}
+ @Override
protected void closeNativeImpl() {
setWindowHandle(0);
if(null!=awtContainer) {
@@ -153,7 +156,7 @@ public class WindowDriver extends WindowImpl {
owningFrame=false;
}
awtCanvas = null;
- awtFrame = null;
+ awtFrame = null;
awtContainer = null;
}
@@ -166,16 +169,17 @@ public class WindowDriver extends WindowImpl {
throw new NativeWindowException("Error Device change null GraphicsConfiguration: "+this);
}
setGraphicsConfiguration(cfg);
-
+
// propagate new info ..
((ScreenDriver)getScreen()).setAWTGraphicsScreen((AWTGraphicsScreen)cfg.getScreen());
((DisplayDriver)getScreen().getDisplay()).setAWTGraphicsDevice((AWTGraphicsDevice)cfg.getScreen().getDevice());
-
+
((ScreenDriver)getScreen()).updateVirtualScreenOriginAndSize();
}
return res;
}
+ @Override
protected void updateInsetsImpl(javax.media.nativewindow.util.Insets insets) {
final Insets contInsets = awtContainer.getInsets();
insets.set(contInsets.left, contInsets.right, contInsets.top, contInsets.bottom);
@@ -213,7 +217,8 @@ public class WindowDriver extends WindowImpl {
awtCanvas.invalidate();
awtContainer.validate();
}
-
+
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWTWindow reconfig: "+x+"/"+y+" "+width+"x"+height+", "+
@@ -228,7 +233,7 @@ public class WindowDriver extends WindowImpl {
}
}
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
if( 0 != ( FLAG_IS_VISIBLE & flags) ) {
setCanvasSizeImpl(width, height);
@@ -244,15 +249,15 @@ public class WindowDriver extends WindowImpl {
}
}
defineSize(width, height); // we are on AWT-EDT .. change values immediately
-
+
if( awtContainer.getX() != x || awtContainer.getY() != y ) {
awtContainer.setLocation(x, y);
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
if( 0 != ( FLAG_IS_VISIBLE & flags ) ) {
if( !hasDeviceChanged() ) {
- // oops ??
+ // oops ??
final AWTGraphicsConfiguration cfg = awtCanvas.getAWTGraphicsConfiguration();
if(null == cfg) {
throw new NativeWindowException("Error: !hasDeviceChanged && null == GraphicsConfiguration: "+this);
@@ -262,22 +267,23 @@ public class WindowDriver extends WindowImpl {
}
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
return true;
}
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
java.awt.Point ap = awtCanvas.getLocationOnScreen();
ap.translate(x, y);
return new Point((int)(ap.getX()+0.5),(int)(ap.getY()+0.5));
}
-
+
@Override
public NativeSurface getWrappedSurface() {
return ( null != awtCanvas ) ? awtCanvas.getNativeWindow() : null;
}
- class LocalWindowListener implements com.jogamp.newt.event.WindowListener {
+ class LocalWindowListener implements com.jogamp.newt.event.WindowListener {
@Override
public void windowMoved(com.jogamp.newt.event.WindowEvent e) {
if(null!=awtContainer) {
@@ -304,11 +310,11 @@ public class WindowDriver extends WindowImpl {
}
@Override
public void windowGainedFocus(WindowEvent e) {
- WindowDriver.this.focusChanged(false, true);
+ WindowDriver.this.focusChanged(false, true);
}
@Override
public void windowLostFocus(WindowEvent e) {
- WindowDriver.this.focusChanged(false, false);
+ WindowDriver.this.focusChanged(false, false);
}
@Override
public void windowRepaint(WindowUpdateEvent e) {
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java
index 112be2b04..9da671d37 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.bcm.egl;
@@ -61,6 +61,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl {
public DisplayDriver() {
}
+ @Override
protected void createNativeImpl() {
final long handle = CreateDisplay(ScreenDriver.fixedWidth, ScreenDriver.fixedHeight);
if (handle == EGL.EGL_NO_DISPLAY) {
@@ -69,6 +70,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl {
aDevice = new EGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, handle, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT, null);
}
+ @Override
protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
if (aDevice.getHandle() != EGL.EGL_NO_DISPLAY) {
DestroyDisplay(aDevice.getHandle());
@@ -76,6 +78,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl {
aDevice.close();
}
+ @Override
protected void dispatchMessagesNative() {
// n/a .. DispatchMessages();
}
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java
index abe2908b0..d3231557f 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.bcm.egl;
@@ -53,16 +53,19 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
public ScreenDriver() {
}
+ @Override
protected void createNativeImpl() {
aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), screen_idx);
}
+ @Override
protected void closeNativeImpl() { }
+ @Override
protected int validateScreenIndex(int idx) {
- return 0; // only one screen available
+ return 0; // only one screen available
}
-
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ];
@@ -99,11 +102,12 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
return false;
}
-
+
+ @Override
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
vOriginSize.set(0, 0, fixedWidth, fixedHeight); // FIXME
}
-
+
//----------------------------------------------------------------------
// Internals only
//
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
index 49d3d98ba..39f168e0f 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.bcm.egl;
@@ -52,11 +52,12 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
public WindowDriver() {
}
+ @Override
protected void createNativeImpl() {
if(0!=getParentWindowHandle()) {
throw new RuntimeException("Window parenting not supported (yet)");
}
- // query a good configuration, however chose the final one by the native queried egl-cfg-id
+ // query a good configuration, however chose the final one by the native queried egl-cfg-id
// after creation at {@link #windowCreated(int, int, int)}.
final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration(
capsRequested, capsRequested, capabilitiesChooser, getScreen().getGraphicsScreen(), VisualIDHolder.VID_UNDEFINED);
@@ -72,12 +73,14 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
}
+ @Override
protected void closeNativeImpl() {
if(0!=windowHandleClose) {
CloseWindow(getDisplayHandle(), windowHandleClose);
}
}
+ @Override
protected void requestFocusImpl(boolean reparented) { }
protected void setSizeImpl(int width, int height) {
@@ -89,8 +92,9 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
}
- protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
- if(0!=getWindowHandle()) {
+ @Override
+ protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
+ if(0!=getWindowHandle()) {
if(0 != ( FLAG_CHANGE_FULLSCREEN & flags)) {
if( 0 != ( FLAG_IS_FULLSCREEN & flags) ) {
// n/a in BroadcomEGL
@@ -110,19 +114,21 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
if(x>=0 || y>=0) {
System.err.println("BCEGL Window.setPositionImpl n/a in BroadcomEGL");
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
return true;
}
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
return new Point(x,y);
}
+ @Override
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
index 4872a9071..d8d93f123 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -59,20 +59,23 @@ public class DisplayDriver extends DisplayImpl {
public DisplayDriver() {
}
+ @Override
protected void createNativeImpl() {
// FIXME: map name to EGL_*_DISPLAY
aDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
}
+ @Override
protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
aDevice.close();
}
+ @Override
protected void dispatchMessagesNative() {
DispatchMessages();
}
- protected static native boolean initIDs();
+ protected static native boolean initIDs();
private native void DispatchMessages();
}
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java
index be99052d7..dc2a8459a 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -45,17 +45,20 @@ public class ScreenDriver extends ScreenImpl {
public ScreenDriver() {
}
+ @Override
protected void createNativeImpl() {
aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), screen_idx);
initNative();
}
+ @Override
protected void closeNativeImpl() { }
+ @Override
protected int validateScreenIndex(int idx) {
- return 0; // only one screen available
- }
-
+ return 0; // only one screen available
+ }
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ];
@@ -92,20 +95,20 @@ public class ScreenDriver extends ScreenImpl {
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
return false;
}
-
+
@Override
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
vOriginSize.set(0, 0, cachedWidth, cachedHeight);
}
-
+
/** Called from {@link #initNative()}. */
protected void setScreenSize(int width, int height) {
cachedWidth = width;
cachedHeight = height;
}
-
+
private static int cachedWidth = 0;
- private static int cachedHeight = 0;
+ private static int cachedHeight = 0;
protected static native boolean initIDs();
protected native void initNative();
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
index e820439d0..4d4977776 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -55,6 +55,7 @@ public class WindowDriver extends WindowImpl {
public WindowDriver() {
}
+ @Override
protected void createNativeImpl() {
if(0!=getParentWindowHandle()) {
throw new RuntimeException("Window parenting not supported (yet)");
@@ -65,7 +66,7 @@ public class WindowDriver extends WindowImpl {
final EGLGraphicsDevice aDevice = (EGLGraphicsDevice) aScreen.getDevice();
final EGLGraphicsDevice eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(aDevice.getNativeDisplayID(), aDevice.getConnection(), aDevice.getUnitID());
final DefaultGraphicsScreen eglScreen = new DefaultGraphicsScreen(eglDevice, aScreen.getIndex());
-
+
final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration(
capsRequested, capsRequested, capabilitiesChooser, eglScreen, VisualIDHolder.VID_UNDEFINED);
if (null == cfg) {
@@ -89,33 +90,36 @@ public class WindowDriver extends WindowImpl {
windowHandleClose = nativeWindowHandle;
addWindowListener(LinuxMouseTracker.getSingleton());
addWindowListener(LinuxEventDeviceTracker.getSingleton());
- focusChanged(false, true);
+ focusChanged(false, true);
}
+ @Override
protected void closeNativeImpl() {
final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) getGraphicsConfiguration().getScreen().getDevice();
-
+
removeWindowListener(LinuxMouseTracker.getSingleton());
removeWindowListener(LinuxEventDeviceTracker.getSingleton());
-
+
if(0!=windowHandleClose) {
CloseWindow(windowHandleClose, windowUserData);
windowUserData=0;
}
-
+
eglDevice.close();
}
- protected void requestFocusImpl(boolean reparented) {
+ @Override
+ protected void requestFocusImpl(boolean reparented) {
focusChanged(false, true);
}
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
setVisible0(nativeWindowHandle, 0 != ( FLAG_IS_VISIBLE & flags));
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
if(0!=nativeWindowHandle) {
if(0 != ( FLAG_CHANGE_FULLSCREEN & flags)) {
final boolean fs = 0 != ( FLAG_IS_FULLSCREEN & flags) ;
@@ -135,22 +139,24 @@ public class WindowDriver extends WindowImpl {
System.err.println("setPosition n/a in KD");
}
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
return true;
}
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
return new Point(x,y);
}
+ @Override
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
-
+
//----------------------------------------------------------------------
// Internals only
//
diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java
index ee93eb932..cc435540f 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.intel.gdl;
@@ -59,6 +59,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl {
public DisplayDriver() {
}
+ @Override
protected void createNativeImpl() {
synchronized(DisplayDriver.class) {
if(0==initCounter) {
@@ -72,6 +73,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl {
aDevice = new DefaultGraphicsDevice(NativeWindowFactory.TYPE_DEFAULT, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT, displayHandle);
}
+ @Override
protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
if(0==displayHandle) {
throw new NativeWindowException("displayHandle null; initCnt "+initCounter);
@@ -87,6 +89,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl {
aDevice.close();
}
+ @Override
protected void dispatchMessagesNative() {
if(0!=displayHandle) {
DispatchMessages(displayHandle, focusedWindow);
diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
index 27b776562..44802e348 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.intel.gdl;
@@ -53,18 +53,21 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
public ScreenDriver() {
}
+ @Override
protected void createNativeImpl() {
AbstractGraphicsDevice adevice = getDisplay().getGraphicsDevice();
GetScreenInfo(adevice.getHandle(), screen_idx);
aScreen = new DefaultGraphicsScreen(adevice, screen_idx);
}
+ @Override
protected void closeNativeImpl() { }
+ @Override
protected int validateScreenIndex(int idx) {
- return 0; // only one screen available
+ return 0; // only one screen available
}
-
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ];
@@ -101,11 +104,12 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
return false;
}
-
+
+ @Override
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
vOriginSize.set(0, 0, cachedWidth, cachedHeight);
}
-
+
//----------------------------------------------------------------------
// Internals only
//
@@ -118,7 +122,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
cachedWidth = width;
cachedHeight = height;
}
-
+
private static int cachedWidth = 0;
private static int cachedHeight = 0;
}
diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
index 98335f192..0e96c65d0 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.intel.gdl;
@@ -48,6 +48,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
static long nextWindowHandle = 1;
+ @Override
protected void createNativeImpl() {
if(0!=getParentWindowHandle()) {
throw new NativeWindowException("GDL Window does not support window parenting");
@@ -72,6 +73,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
}
+ @Override
protected void closeNativeImpl() {
if(0!=surfaceHandle) {
synchronized(WindowDriver.class) {
@@ -82,6 +84,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
}
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
ScreenDriver screen = (ScreenDriver) getScreen();
@@ -108,10 +111,11 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
return true;
}
+ @Override
protected void requestFocusImpl(boolean reparented) {
((DisplayDriver)getScreen().getDisplay()).setFocus(this);
}
@@ -121,14 +125,16 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
return surfaceHandle;
}
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
return new Point(x,y);
}
+ @Override
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
-
+
//----------------------------------------------------------------------
// Internals only
//
diff --git a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java
index 3cd72e971..929688b11 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.kd;
@@ -59,15 +59,18 @@ public class DisplayDriver extends DisplayImpl {
public DisplayDriver() {
}
+ @Override
protected void createNativeImpl() {
// FIXME: map name to EGL_*_DISPLAY
aDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
}
+ @Override
protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
aDevice.close();
}
+ @Override
protected void dispatchMessagesNative() {
DispatchMessages();
}
diff --git a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
index f893275ca..9ebe2629a 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.kd;
@@ -51,16 +51,19 @@ public class ScreenDriver extends ScreenImpl {
public ScreenDriver() {
}
+ @Override
protected void createNativeImpl() {
aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), screen_idx);
}
+ @Override
protected void closeNativeImpl() { }
+ @Override
protected int validateScreenIndex(int idx) {
- return 0; // only one screen available
- }
-
+ return 0; // only one screen available
+ }
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ];
@@ -97,16 +100,17 @@ public class ScreenDriver extends ScreenImpl {
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
return false;
}
-
+
+ @Override
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
vOriginSize.set(0, 0, cachedWidth, cachedHeight);
}
-
+
protected void sizeChanged(int w, int h) {
cachedWidth = w;
cachedHeight = h;
}
-
+
private static int cachedWidth = 0;
- private static int cachedHeight = 0;
+ private static int cachedHeight = 0;
}
diff --git a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
index c733a3e94..158e6ab2f 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.kd;
@@ -56,6 +56,7 @@ public class WindowDriver extends WindowImpl {
public WindowDriver() {
}
+ @Override
protected void createNativeImpl() {
if(0!=getParentWindowHandle()) {
throw new RuntimeException("Window parenting not supported (yet)");
@@ -83,6 +84,7 @@ public class WindowDriver extends WindowImpl {
windowHandleClose = eglWindowHandle;
}
+ @Override
protected void closeNativeImpl() {
if(0!=windowHandleClose) {
CloseWindow(windowHandleClose, windowUserData);
@@ -90,14 +92,16 @@ public class WindowDriver extends WindowImpl {
}
}
+ @Override
protected void requestFocusImpl(boolean reparented) { }
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
setVisible0(eglWindowHandle, 0 != ( FLAG_IS_VISIBLE & flags));
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
if(0!=eglWindowHandle) {
if(0 != ( FLAG_CHANGE_FULLSCREEN & flags)) {
final boolean fs = 0 != ( FLAG_IS_FULLSCREEN & flags) ;
@@ -117,22 +121,24 @@ public class WindowDriver extends WindowImpl {
System.err.println("setPosition n/a in KD");
}
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
return true;
}
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
return new Point(x,y);
}
+ @Override
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
-
+
//----------------------------------------------------------------------
// Internals only
//
diff --git a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java
index e68b91d82..b7c86a26d 100644
--- a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java
+++ b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -126,7 +126,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
try {
while(true) {
Thread.sleep(1000);
- }
+ }
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -186,7 +186,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
/**
* The Linux input event interface.
* http://www.kernel.org/doc/Documentation/input/input.txt
- *
+ *
* struct input_event {
* struct timeval time;
* unsigned short type;
@@ -262,7 +262,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
break;
case 1: // EV_KEY
keyCode = LinuxEVKey2NewtVKey(code); // The device independent code.
- keyChar = NewtVKey2Unicode(keyCode, modifiers); // The printable character w/ key modifiers.
+ keyChar = NewtVKey2Unicode(keyCode, modifiers); // The printable character w/ key modifiers.
if(Window.DEBUG_KEY_EVENT) {
System.out.println("[EV_KEY: [time "+timeSeconds+":"+timeSecondFraction+"] type "+type+" / code "+code+" = value "+value);
}
@@ -946,7 +946,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
case 248: // mic mute
break; // FIXME
- default:
+ default:
}
if(Window.DEBUG_KEY_EVENT) {
diff --git a/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java b/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java
index 0d6278bfb..1e314b7f4 100644
--- a/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java
+++ b/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -48,16 +48,16 @@ import com.jogamp.newt.event.WindowUpdateEvent;
* within it's own polling thread.
*/
public class LinuxMouseTracker implements WindowListener {
-
+
private static final LinuxMouseTracker lmt;
-
+
static {
lmt = new LinuxMouseTracker();
final Thread t = new Thread(lmt.mouseDevicePoller, "NEWT-LinuxMouseTracker");
t.setDaemon(true);
t.start();
}
-
+
public static LinuxMouseTracker getSingleton() {
return lmt;
}
@@ -71,7 +71,7 @@ public class LinuxMouseTracker implements WindowListener {
private short old_buttonDown = 0;
private WindowImpl focusedWindow = null;
private MouseDevicePoller mouseDevicePoller = new MouseDevicePoller();
-
+
@Override
public void windowResized(WindowEvent e) { }
@@ -107,7 +107,7 @@ public class LinuxMouseTracker implements WindowListener {
@Override
public void windowRepaint(WindowUpdateEvent e) { }
-
+
class MouseDevicePoller implements Runnable {
@Override
public void run() {
@@ -150,17 +150,17 @@ public class LinuxMouseTracker implements WindowListener {
yo=(b[0]&128)>0;
xd=b[1];
yd=b[2];
-
+
x+=xd;
y-=yd;
-
+
if(x<0) {
x=0;
}
if(y<0) {
y=0;
}
-
+
buttonDown = 0;
if(lb) {
buttonDown = MouseEvent.BUTTON1;
@@ -171,7 +171,7 @@ public class LinuxMouseTracker implements WindowListener {
if(rb) {
buttonDown = MouseEvent.BUTTON3;
}
-
+
if(null != focusedWindow) {
if( x >= focusedWindow.getScreen().getWidth() ) {
x = focusedWindow.getScreen().getWidth() - 1;
@@ -179,31 +179,31 @@ public class LinuxMouseTracker implements WindowListener {
if( y >= focusedWindow.getScreen().getHeight() ) {
y = focusedWindow.getScreen().getHeight() - 1;
}
- int wx = x - focusedWindow.getX(), wy = y - focusedWindow.getY();
-
+ int wx = x - focusedWindow.getX(), wy = y - focusedWindow.getY();
+
if(old_x != x || old_y != y) {
// mouse moved
- focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_MOVED, 0, wx, wy, (short)0, 0 );
+ focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_MOVED, 0, wx, wy, (short)0, 0 );
}
-
+
if(old_buttonDown != buttonDown) {
// press/release
if( 0 != buttonDown ) {
- focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_PRESSED, 0, wx, wy, buttonDown, 0 );
+ focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_PRESSED, 0, wx, wy, buttonDown, 0 );
} else {
- focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_RELEASED, 0, wx, wy, old_buttonDown, 0 );
+ focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_RELEASED, 0, wx, wy, old_buttonDown, 0 );
}
- }
+ }
} else {
if(Window.DEBUG_MOUSE_EVENT) {
System.out.println(x+"/"+y+", hs="+hs+",vs="+vs+",lb="+lb+",rb="+rb+",mb="+mb+",xo="+xo+",yo="+yo+"xd="+xd+",yd="+yd);
}
}
-
+
old_x = x;
old_y = y;
old_buttonDown = buttonDown;
-
+
}
if(null != fis) {
try {
@@ -214,5 +214,5 @@ public class LinuxMouseTracker implements WindowListener {
}
}
}
- }
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java
index a99bc4f23..c44685dc8 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.macosx;
@@ -60,19 +60,22 @@ public class DisplayDriver extends DisplayImpl {
public static void initSingleton() {
// just exist to ensure static init has been run
}
-
+
public DisplayDriver() {
}
+ @Override
protected void dispatchMessagesNative() {
// nop
}
-
+
+ @Override
protected void createNativeImpl() {
aDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
}
- protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
+ @Override
+ protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
aDevice.close();
}
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java b/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java
index baa94facd..a89150d7c 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -30,7 +30,7 @@ package jogamp.newt.driver.macosx;
import com.jogamp.newt.event.KeyEvent;
public class MacKeyUtil {
-
+
//
// KeyCodes (Layout Dependent)
//
@@ -64,17 +64,17 @@ public class MacKeyUtil {
private static final short kVK_ANSI_8 = 0x1C;
private static final short kVK_ANSI_0 = 0x1D;
private static final short kVK_ANSI_RightBracket = 0x1E;
- private static final short kVK_ANSI_O = 0x1F;
+ private static final short kVK_ANSI_O = 0x1F;
private static final short kVK_ANSI_U = 0x20;
private static final short kVK_ANSI_LeftBracket = 0x21;
private static final short kVK_ANSI_I = 0x22;
private static final short kVK_ANSI_P = 0x23;
private static final short kVK_ANSI_L = 0x25;
private static final short kVK_ANSI_J = 0x26;
- private static final short kVK_ANSI_Quote = 0x27;
+ private static final short kVK_ANSI_Quote = 0x27;
private static final short kVK_ANSI_K = 0x28;
private static final short kVK_ANSI_Semicolon = 0x29;
- private static final short kVK_ANSI_Backslash = 0x2A;
+ private static final short kVK_ANSI_Backslash = 0x2A;
private static final short kVK_ANSI_Comma = 0x2B;
private static final short kVK_ANSI_Slash = 0x2C;
private static final short kVK_ANSI_N = 0x2D;
@@ -99,7 +99,7 @@ public class MacKeyUtil {
private static final short kVK_ANSI_Keypad7 = 0x59;
private static final short kVK_ANSI_Keypad8 = 0x5B;
private static final short kVK_ANSI_Keypad9 = 0x5C;
-
+
//
// KeyCodes (Layout Independent)
//
@@ -150,7 +150,7 @@ public class MacKeyUtil {
private static final short kVK_RightArrow = 0x7C;
private static final short kVK_DownArrow = 0x7D;
private static final short kVK_UpArrow = 0x7E;
-
+
//
// Key constants handled differently on Mac OS X than other platforms
//
@@ -230,8 +230,8 @@ public class MacKeyUtil {
private static final char NSHelpFunctionKey = 0xF746;
private static final char NSModeSwitchFunctionKey = 0xF747;
*/
-
- static short validateKeyCode(short keyCode, char keyChar) {
+
+ static short validateKeyCode(short keyCode, char keyChar) {
// OS X Virtual Keycodes
switch(keyCode) {
//
@@ -267,17 +267,17 @@ public class MacKeyUtil {
case kVK_ANSI_8: return KeyEvent.VK_8;
case kVK_ANSI_0: return KeyEvent.VK_0;
case kVK_ANSI_RightBracket: return KeyEvent.VK_CLOSE_BRACKET;
- case kVK_ANSI_O: return KeyEvent.VK_O;
+ case kVK_ANSI_O: return KeyEvent.VK_O;
case kVK_ANSI_U: return KeyEvent.VK_U;
case kVK_ANSI_LeftBracket: return KeyEvent.VK_OPEN_BRACKET;
case kVK_ANSI_I: return KeyEvent.VK_I;
case kVK_ANSI_P: return KeyEvent.VK_P;
case kVK_ANSI_L: return KeyEvent.VK_L;
case kVK_ANSI_J: return KeyEvent.VK_J;
- case kVK_ANSI_Quote: return KeyEvent.VK_QUOTE;
+ case kVK_ANSI_Quote: return KeyEvent.VK_QUOTE;
case kVK_ANSI_K: return KeyEvent.VK_K;
case kVK_ANSI_Semicolon: return KeyEvent.VK_SEMICOLON;
- case kVK_ANSI_Backslash: return KeyEvent.VK_BACK_SLASH;
+ case kVK_ANSI_Backslash: return KeyEvent.VK_BACK_SLASH;
case kVK_ANSI_Comma: return KeyEvent.VK_COMMA;
case kVK_ANSI_Slash: return KeyEvent.VK_SLASH;
case kVK_ANSI_N: return KeyEvent.VK_N;
@@ -302,7 +302,7 @@ public class MacKeyUtil {
case kVK_ANSI_Keypad7: return KeyEvent.VK_7;
case kVK_ANSI_Keypad8: return KeyEvent.VK_8;
case kVK_ANSI_Keypad9: return KeyEvent.VK_9;
-
+
//
// KeyCodes (Layout Independent)
//
@@ -321,7 +321,7 @@ public class MacKeyUtil {
case kVK_RightControl: return KeyEvent.VK_CONTROL;
// case kVK_Function: return KeyEvent.VK_F;
case kVK_F17: return KeyEvent.VK_F17;
- // case kVK_VolumeUp:
+ // case kVK_VolumeUp:
// case kVK_VolumeDown:
// case kVK_Mute:
case kVK_F18: return KeyEvent.VK_F18;
@@ -354,7 +354,7 @@ public class MacKeyUtil {
case kVK_DownArrow: return KeyEvent.VK_DOWN;
case kVK_UpArrow: return KeyEvent.VK_UP;
}
-
+
switch (keyChar) {
case NSUpArrowFunctionKey: return KeyEvent.VK_UP;
case NSDownArrowFunctionKey: return KeyEvent.VK_DOWN;
@@ -422,5 +422,5 @@ public class MacKeyUtil {
}
return (short) keyChar; // let's hope for the best (compatibility of keyChar/keyCode's)
- }
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
index a3bb26731..4f3cc691b 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2011 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.macosx;
@@ -44,7 +44,7 @@ import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
public class ScreenDriver extends ScreenImpl {
-
+
static {
DisplayDriver.initSingleton();
}
@@ -52,10 +52,12 @@ public class ScreenDriver extends ScreenImpl {
public ScreenDriver() {
}
+ @Override
protected void createNativeImpl() {
aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), screen_idx);
}
+ @Override
protected void closeNativeImpl() { }
private MonitorMode getMonitorModeImpl(MonitorModeProps.Cache cache, int crt_idx, int mode_idx) {
@@ -68,7 +70,7 @@ public class ScreenDriver extends ScreenImpl {
}
return res;
}
-
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int crtIdx = 0;
@@ -85,16 +87,16 @@ public class ScreenDriver extends ScreenImpl {
final MonitorMode currentMode = getMonitorModeImpl(cache, crtIdx, -1);
if ( null == currentMode ) {
throw new InternalError("Could not gather current mode of device "+crtIdx+", but gathered "+modeIdx+" modes");
- }
+ }
final int[] monitorProps = getMonitorProps0(crtIdx);
if ( null == monitorProps ) {
throw new InternalError("Could not gather device "+crtIdx+", but gathered "+modeIdx+" modes");
- }
+ }
// merge monitor-props + supported modes
MonitorModeProps.streamInMonitorDevice(null, cache, this, supportedModes, currentMode, monitorProps, 0);
-
+
// next monitor, 1st mode
- supportedModes= new ArrayHashSet<MonitorMode>();
+ supportedModes= new ArrayHashSet<MonitorMode>();
crtIdx++;
modeIdx=0;
} else {
@@ -108,16 +110,17 @@ public class ScreenDriver extends ScreenImpl {
protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) {
return getMonitorModeImpl(null, monitor.getId(), -1);
}
-
+
@Override
protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) {
return setMonitorMode0(monitor.getId(), mode.getId(), mode.getRotation());
}
-
+
+ @Override
protected int validateScreenIndex(int idx) {
- return 0; // big-desktop w/ multiple monitor attached, only one screen available
+ return 0; // big-desktop w/ multiple monitor attached, only one screen available
}
-
+
private native int[] getMonitorProps0(int crt_idx);
private native int[] getMonitorMode0(int crt_index, int mode_idx);
private native boolean setMonitorMode0(int crt_index, int nativeId, int rot);
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index 08638d868..7db3e2aab 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.macosx;
@@ -53,14 +53,14 @@ import com.jogamp.newt.event.InputEvent;
import com.jogamp.newt.event.KeyEvent;
public class WindowDriver extends WindowImpl implements MutableSurface, DriverClearFocus, DriverUpdatePosition {
-
+
static {
DisplayDriver.initSingleton();
}
public WindowDriver() {
}
-
+
@Override
protected void createNativeImpl() {
final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration(
@@ -69,7 +69,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
setGraphicsConfiguration(cfg);
- reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true));
+ reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true));
if (0 == getWindowHandle()) {
throw new NativeWindowException("Error creating window");
}
@@ -79,7 +79,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
protected void closeNativeImpl() {
try {
if(DEBUG_IMPLEMENTATION) { System.err.println("MacWindow.CloseAction "+Thread.currentThread().getName()); }
- final long handle = getWindowHandle();
+ final long handle = getWindowHandle();
visibleChanged(true, false);
setWindowHandle(0);
surfaceHandle = 0;
@@ -87,21 +87,22 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
isOffscreenInstance = false;
if (0 != handle) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
close0( handle );
} } );
}
} catch (Throwable t) {
- if(DEBUG_IMPLEMENTATION) {
+ if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Warning: closeNative failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
}
}
-
+
@Override
protected int lockSurfaceImpl() {
- /**
+ /**
* if( isOffscreenInstance ) {
* return LOCK_SUCCESS;
* }
@@ -116,7 +117,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
@Override
protected void unlockSurfaceImpl() {
- /**
+ /**
* if( isOffscreenInstance ) {
* return;
* }
@@ -129,7 +130,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
}
}
-
+
@Override
public final long getSurfaceHandle() {
return 0 != sscSurfaceHandle ? sscSurfaceHandle : surfaceHandle;
@@ -144,22 +145,24 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
if (isNativeValid()) {
if (0 != sscSurfaceHandle) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
orderOut0( 0 != getParentWindowHandle() ? getParentWindowHandle() : getWindowHandle() );
} } );
- } /** this is done by recreation!
+ } /** this is done by recreation!
else if (isVisible()){
OSXUtil.RunOnMainThread(false, new Runnable() {
public void run() {
orderFront0( 0!=getParentWindowHandle() ? getParentWindowHandle() : getWindowHandle() );
} } );
} */
- }
+ }
}
@Override
protected void setTitleImpl(final String title) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
setTitle0(getWindowHandle(), title);
} } );
@@ -172,6 +175,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
if(!isOffscreenInstance) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
requestFocus0(getWindowHandle(), force);
} } );
@@ -179,7 +183,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
focusChanged(false, true);
}
}
-
+
@Override
public final void clearFocus() {
if(DEBUG_IMPLEMENTATION) {
@@ -187,6 +191,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
if(!isOffscreenInstance) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
resignFocus0(getWindowHandle());
} } );
@@ -194,9 +199,9 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
focusChanged(false, false);
}
}
-
+
private boolean useParent(NativeWindow parent) { return null != parent && 0 != parent.getWindowHandle(); }
-
+
@Override
public void updatePosition(int x, int y) {
final long handle = getWindowHandle();
@@ -209,14 +214,15 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
System.err.println("MacWindow: updatePosition() parent["+useParent+" "+pX+"/"+pY+"] "+x+"/"+y+" -> "+x+"/"+y+" rel-client-pos, "+p0S+" screen-client-pos");
}
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
setWindowClientTopLeftPoint0(handle, p0S.getX(), p0S.getY(), isVisible());
} } );
// no native event (fullscreen, some reparenting)
positionChanged(true, x, y);
}
- }
-
+ }
+
@Override
protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) {
final long handle = getWindowHandle();
@@ -230,6 +236,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
System.err.println("MacWindow: sizeChanged() parent["+useParent+" "+x+"/"+y+"] "+getX()+"/"+getY()+" "+newWidth+"x"+newHeight+" -> "+p0S+" screen-client-pos");
}
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
setWindowClientTopLeftPoint0(getWindowHandle(), p0S.getX(), p0S.getY(), isVisible());
} } );
@@ -237,7 +244,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
super.sizeChanged(defer, newWidth, newHeight, force);
}
-
+
@Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, int flags) {
final boolean _isOffscreenInstance = isOffscreenInstance(this, this.getParent());
@@ -250,11 +257,11 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
final boolean useParent = useParent(parent);
if( useParent ) {
pClientLevelOnSreen = getLocationOnScreenImpl(x, y, parent, useParent);
- } else {
+ } else {
pClientLevelOnSreen = new Point(x, y);
}
}
-
+
if(DEBUG_IMPLEMENTATION) {
final AbstractGraphicsConfiguration cWinCfg = this.getGraphicsConfiguration();
final NativeWindow pWin = getParent();
@@ -269,12 +276,13 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
"\n\t, "+getReconfigureFlagsAsString(null, flags));
// Thread.dumpStack();
}
-
+
final boolean setVisible = 0 != ( FLAG_IS_VISIBLE & flags);
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) && !setVisible ) {
if ( !isOffscreenInstance ) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
orderOut0(getWindowHandle());
visibleChanged(true, false);
@@ -290,13 +298,14 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
if(isOffscreenInstance) {
createWindow(true, 0 != getWindowHandle(), pClientLevelOnSreen, 64, 64, false, setVisible, false);
} else {
- createWindow(false, 0 != getWindowHandle(), pClientLevelOnSreen, width, height,
+ createWindow(false, 0 != getWindowHandle(), pClientLevelOnSreen, width, height,
0 != ( FLAG_IS_FULLSCREEN & flags), setVisible, 0 != ( FLAG_IS_ALWAYSONTOP & flags));
}
} else {
- if( width>0 && height>0 ) {
+ if( width>0 && height>0 ) {
if( !isOffscreenInstance ) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
setWindowClientTopLeftPointAndSize0(getWindowHandle(), pClientLevelOnSreen.getX(), pClientLevelOnSreen.getY(), width, height, setVisible);
} } );
@@ -306,8 +315,9 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
sizeChanged(true, width, height, false);
}
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) && setVisible ) {
- if( !isOffscreenInstance ) {
+ if( !isOffscreenInstance ) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
orderFront0(getWindowHandle());
visibleChanged(true, true);
@@ -321,7 +331,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
}
if(DEBUG_IMPLEMENTATION) {
- System.err.println("MacWindow reconfig.X: clientPos "+pClientLevelOnSreen+", "+width+"x"+height+" -> clientPos "+getLocationOnScreenImpl(0, 0)+", insets: "+getInsets());
+ System.err.println("MacWindow reconfig.X: clientPos "+pClientLevelOnSreen+", "+width+"x"+height+" -> clientPos "+getLocationOnScreenImpl(0, 0)+", insets: "+getInsets());
}
return true;
}
@@ -332,28 +342,28 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
final boolean useParent = useParent(parent);
return getLocationOnScreenImpl(x, y, parent, useParent);
}
-
+
private Point getLocationOnScreenImpl(final int x, final int y, final NativeWindow parent, final boolean useParent) {
if( !useParent && !isOffscreenInstance && 0 != surfaceHandle) {
return OSXUtil.GetLocationOnScreen(surfaceHandle, true, x, y);
}
-
+
final Point p = new Point(x, y);
if( useParent ) {
p.translate( parent.getLocationOnScreen(null) );
}
return p;
}
-
+
@Override
protected void updateInsetsImpl(Insets insets) {
// nop - using event driven insetsChange(..)
}
-
+
/** Callback for native screen position change event of the client area. */
- protected void screenPositionChanged(boolean defer, int newX, int newY) {
+ protected void screenPositionChanged(boolean defer, int newX, int newY) {
// passed coordinates are in screen position of the client area
- if(getWindowHandle()!=0) {
+ if(getWindowHandle()!=0) {
final NativeWindow parent = getParent();
if( null == parent || isOffscreenInstance ) {
if(DEBUG_IMPLEMENTATION) {
@@ -362,7 +372,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
positionChanged(defer, newX, newY);
} else {
// screen position -> rel child window position
- Point absPos = new Point(newX, newY);
+ Point absPos = new Point(newX, newY);
Point parentOnScreen = parent.getLocationOnScreen(null);
absPos.translate( parentOnScreen.scale(-1, -1) );
if(DEBUG_IMPLEMENTATION) {
@@ -374,10 +384,10 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
System.err.println("MacWindow.positionChanged.2 (Screen Pos - IGN): ("+getThreadName()+"): (defer: "+defer+") "+getX()+"/"+getY()+" -> "+newX+"/"+newY);
}
}
-
+
@Override
protected boolean setPointerVisibleImpl(final boolean pointerVisible) {
- if( !isOffscreenInstance ) {
+ if( !isOffscreenInstance ) {
return setPointerVisible0(getWindowHandle(), hasFocus(), pointerVisible);
} // else may need offscreen solution ? FIXME
return false;
@@ -385,29 +395,29 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
@Override
protected boolean confinePointerImpl(final boolean confine) {
- if( !isOffscreenInstance ) {
+ if( !isOffscreenInstance ) {
return confinePointer0(getWindowHandle(), confine);
} // else may need offscreen solution ? FIXME
return false;
}
-
+
@Override
protected void warpPointerImpl(final int x, final int y) {
- if( !isOffscreenInstance ) {
+ if( !isOffscreenInstance ) {
warpPointer0(getWindowHandle(), x, y);
} // else may need offscreen solution ? FIXME
}
-
+
@Override
public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
-
+
@Override
public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short _keyCode, short _keySym, char keyChar) {
- throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
+ throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
-
+
protected final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short _keyCode, char keyChar, char keySymChar) {
// Note that we send the key char for the key code on this
// platform -- we do not get any useful key codes out of the system
@@ -427,7 +437,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
", was: pressed "+isKeyPressed(keyCode)+", isModifierKeyCode "+isModifierKeyCode+
", nativeValid "+isNativeValid()+", isOffscreen "+isOffscreenInstance);
} */
-
+
// OSX delivery order is PRESSED (t0), RELEASED (t1) and TYPED (t2) -> NEWT order: PRESSED (t0) and RELEASED (t1)
// Auto-Repeat: OSX delivers only PRESSED, inject auto-repeat RELEASE key _before_ PRESSED
switch(eventType) {
@@ -451,15 +461,15 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
//----------------------------------------------------------------------
// Internals only
- //
-
- private void createWindow(final boolean offscreenInstance, final boolean recreate,
- final PointImmutable pS, final int width, final int height,
+ //
+
+ private void createWindow(final boolean offscreenInstance, final boolean recreate,
+ final PointImmutable pS, final int width, final int height,
final boolean fullscreen, final boolean visible, final boolean alwaysOnTop) {
final long parentWinHandle = getParentWindowHandle();
final long preWinHandle = getWindowHandle();
-
+
if(DEBUG_IMPLEMENTATION) {
System.err.println("MacWindow.createWindow on thread "+Thread.currentThread().getName()+
": offscreen "+offscreenInstance+", recreate "+recreate+
@@ -474,8 +484,9 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
setWindowHandle(0);
if( 0 == surfaceHandle ) {
throw new NativeWindowException("Internal Error - create w/ window, but no Newt NSView");
- }
+ }
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
changeContentView0(parentWinHandle, preWinHandle, 0);
close0( preWinHandle );
@@ -483,14 +494,14 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
} else {
if( 0 != surfaceHandle ) {
throw new NativeWindowException("Internal Error - create w/o window, but has Newt NSView");
- }
+ }
surfaceHandle = createView0(pS.getX(), pS.getY(), width, height, fullscreen);
if( 0 == surfaceHandle ) {
throw new NativeWindowException("Could not create native view "+Thread.currentThread().getName()+" "+this);
}
}
-
- final long newWin = createWindow0( pS.getX(), pS.getY(), width, height, fullscreen,
+
+ final long newWin = createWindow0( pS.getX(), pS.getY(), width, height, fullscreen,
( isUndecorated() || offscreenInstance ) ? NSBorderlessWindowMask :
NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask,
NSBackingStoreBuffered, surfaceHandle);
@@ -498,10 +509,11 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
throw new NativeWindowException("Could not create native window "+Thread.currentThread().getName()+" "+this);
}
setWindowHandle( newWin );
-
+
final boolean isOpaque = getGraphicsConfiguration().getChosenCapabilities().isBackgroundOpaque() && !offscreenInstance;
- // Blocking initialization on main-thread!
+ // Blocking initialization on main-thread!
OSXUtil.RunOnMainThread(true, new Runnable() {
+ @Override
public void run() {
initWindow0( parentWinHandle, newWin, pS.getX(), pS.getY(), width, height,
isOpaque, fullscreen, visible && !offscreenInstance, surfaceHandle);
@@ -517,7 +529,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
ie.printStackTrace();
}
}
-
+
protected static native boolean initIDs0();
private native long createView0(int x, int y, int w, int h, boolean fullscreen);
private native long createWindow0(int x, int y, int w, int h, boolean fullscreen, int windowStyle, int backingStoreType, long view);
@@ -543,7 +555,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
private native void changeContentView0(long parentWindowOrView, long window, long view);
/** Must be called on Main-Thread */
private native void setWindowClientTopLeftPointAndSize0(long window, int x, int y, int w, int h, boolean display);
- /** Must be called on Main-Thread */
+ /** Must be called on Main-Thread */
private native void setWindowClientTopLeftPoint0(long window, int x, int y, boolean display);
/** Must be called on Main-Thread */
private native void setAlwaysOnTop0(long window, boolean atop);
@@ -551,7 +563,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
private static native boolean setPointerVisible0(long windowHandle, boolean hasFocus, boolean visible);
private static native boolean confinePointer0(long windowHandle, boolean confine);
private static native void warpPointer0(long windowHandle, int x, int y);
-
+
// Window styles
private static final int NSBorderlessWindowMask = 0;
private static final int NSTitledWindowMask = 1 << 0;
@@ -567,5 +579,5 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
private volatile long surfaceHandle = 0;
private long sscSurfaceHandle = 0;
private boolean isOffscreenInstance = false;
-
+
}
diff --git a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
index 595d5e952..d8ff7ecb5 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.windows;
@@ -52,10 +52,10 @@ public class DisplayDriver extends DisplayImpl {
NEWTJNILibLoader.loadNEWT();
sharedClassFactory = new RegisteredClassFactory(newtClassBaseName, WindowDriver.getNewtWndProc0());
-
+
if (!WindowDriver.initIDs0(RegisteredClassFactory.getHInstance())) {
throw new NativeWindowException("Failed to initialize WindowsWindow jmethodIDs");
- }
+ }
}
public static void initSingleton() {
@@ -71,16 +71,19 @@ public class DisplayDriver extends DisplayImpl {
public DisplayDriver() {
}
+ @Override
protected void createNativeImpl() {
sharedClass = sharedClassFactory.getSharedClass();
aDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
}
- protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
+ @Override
+ protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
sharedClassFactory.releaseSharedClass();
aDevice.close();
}
+ @Override
protected void dispatchMessagesNative() {
DispatchMessages0();
}
diff --git a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
index 621091320..e789b995f 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.windows;
@@ -60,7 +60,7 @@ public class ScreenDriver extends ScreenImpl {
protected void createNativeImpl() {
aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), screen_idx);
}
-
+
@Override
protected void closeNativeImpl() {
}
@@ -71,7 +71,7 @@ public class ScreenDriver extends ScreenImpl {
private final String getActiveMonitorName(String adapterName, int monitor_idx) {
return getActiveMonitorName0(adapterName, monitor_idx);
}
-
+
private final MonitorMode getMonitorModeImpl(MonitorModeProps.Cache cache, String adapterName, int crtModeIdx) {
if( null == adapterName ) {
return null;
@@ -107,7 +107,7 @@ public class ScreenDriver extends ScreenImpl {
final int[] monitorProps = getMonitorDevice0(adapterName, crtIdx);
// merge monitor-props + supported modes
MonitorModeProps.streamInMonitorDevice(null, cache, this, supportedModes, currentMode, monitorProps, 0);
-
+
// next monitor, 1st mode
supportedModes= new ArrayHashSet<MonitorMode>();
}
@@ -116,7 +116,7 @@ public class ScreenDriver extends ScreenImpl {
adapterName = getAdapterName(crtIdx);
}
}
-
+
@Override
protected Rectangle getNativeMonitorDeviceViewportImpl(MonitorDevice monitor) {
final String adapterName = getAdapterName(monitor.getId());
@@ -135,7 +135,7 @@ public class ScreenDriver extends ScreenImpl {
protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) {
return getMonitorModeImpl(null, getAdapterName(monitor.getId()), -1);
}
-
+
@Override
protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) {
return setMonitorMode0(monitor.getId(),
@@ -150,14 +150,14 @@ public class ScreenDriver extends ScreenImpl {
@Override
protected int validateScreenIndex(int idx) {
- return 0; // big-desktop w/ multiple monitor attached, only one screen available
+ return 0; // big-desktop w/ multiple monitor attached, only one screen available
}
-
+
@Override
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
vOriginSize.set(getVirtualOriginX0(), getVirtualOriginY0(), getVirtualWidthImpl0(), getVirtualHeightImpl0());
}
-
+
// Native calls
private native int getVirtualOriginX0();
private native int getVirtualOriginY0();
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
index b2e175415..6e8ac3efa 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.windows;
@@ -74,26 +74,26 @@ public class WindowDriver extends WindowImpl {
}
final long hWnd = getWindowHandle();
hdc = GDI.GetDC(hWnd);
-
+
// return ( 0 == hdc ) ? LOCK_SURFACE_NOT_READY : ( hdc_old != hdc ) ? LOCK_SURFACE_CHANGED : LOCK_SUCCESS ;
- if( 0 == hdc ) {
+ if( 0 == hdc ) {
return LOCK_SURFACE_NOT_READY;
- }
+ }
hmon = MonitorFromWindow0(hWnd);
-
+
// Let's not trigger on HDC change, GLDrawableImpl.'s destroy/create is a nop here anyways.
// FIXME: Validate against EGL surface creation: ANGLE uses HWND -> fine!
- return LOCK_SUCCESS;
-
+ return LOCK_SUCCESS;
+
/**
if( hdc_old == hdc ) {
return LOCK_SUCCESS;
}
- if(DEBUG_IMPLEMENTATION) {
+ if(DEBUG_IMPLEMENTATION) {
System.err.println("WindowsWindow: surface change "+toHexString(hdc_old)+" -> "+toHexString(hdc));
// Thread.dumpStack();
}
- return LOCK_SURFACE_CHANGED; */
+ return LOCK_SURFACE_CHANGED; */
}
@Override
@@ -127,6 +127,7 @@ public class WindowDriver extends WindowImpl {
return false;
}
+ @Override
protected void createNativeImpl() {
final ScreenDriver screen = (ScreenDriver) getScreen();
final DisplayDriver display = (DisplayDriver) screen.getDisplay();
@@ -137,32 +138,33 @@ public class WindowDriver extends WindowImpl {
}
setGraphicsConfiguration(cfg);
final VersionNumber winVer = Platform.getOSVersionNumber();
- final int flags = getReconfigureFlags(0, true) &
+ final int flags = getReconfigureFlags(0, true) &
( FLAG_IS_ALWAYSONTOP | FLAG_IS_UNDECORATED ) ;
final long _windowHandle = CreateWindow0(DisplayDriver.getHInstance(), display.getWindowClassName(), display.getWindowClassName(),
winVer.getMajor(), winVer.getMinor(),
- getParentWindowHandle(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags);
+ getParentWindowHandle(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags);
if ( 0 == _windowHandle ) {
throw new NativeWindowException("Error creating window");
}
setWindowHandle(_windowHandle);
windowHandleClose = _windowHandle;
-
+
if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Info: Window new window handle "+Thread.currentThread().getName()+
" (Parent HWND "+toHexString(getParentWindowHandle())+
") : HWND "+toHexString(_windowHandle)+", "+Thread.currentThread());
e.printStackTrace();
}
- }
+ }
+ @Override
protected void closeNativeImpl() {
if(windowHandleClose != 0) {
if (hdc != 0) {
try {
GDI.ReleaseDC(windowHandleClose, hdc);
} catch (Throwable t) {
- if(DEBUG_IMPLEMENTATION) {
+ if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
@@ -183,19 +185,20 @@ public class WindowDriver extends WindowImpl {
hdc_old = 0;
}
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("WindowsWindow reconfig: "+x+"/"+y+" "+width+"x"+height+", "+
getReconfigureFlagsAsString(null, flags));
}
-
+
if(0 == ( FLAG_IS_UNDECORATED & flags)) {
final InsetsImmutable i = getInsets();
-
+
// client position -> top-level window position
x -= i.getLeftWidth() ;
y -= i.getTopHeight() ;
-
+
if(0<width && 0<height) {
// client size -> top-level window size
width += i.getTotalWidth();
@@ -203,13 +206,14 @@ public class WindowDriver extends WindowImpl {
}
}
reconfigureWindow0( getParentWindowHandle(), getWindowHandle(), x, y, width, height, flags);
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
- visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
+ visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
return true;
}
+ @Override
protected void requestFocusImpl(boolean force) {
requestFocus0(getWindowHandle(), force);
}
@@ -222,8 +226,9 @@ public class WindowDriver extends WindowImpl {
@Override
protected boolean setPointerVisibleImpl(final boolean pointerVisible) {
final boolean[] res = new boolean[] { false };
-
+
this.runOnEDTIfAvail(true, new Runnable() {
+ @Override
public void run() {
res[0] = setPointerVisible0(getWindowHandle(), pointerVisible);
}
@@ -234,20 +239,22 @@ public class WindowDriver extends WindowImpl {
@Override
protected boolean confinePointerImpl(final boolean confine) {
final Boolean[] res = new Boolean[] { Boolean.FALSE };
-
+
this.runOnEDTIfAvail(true, new Runnable() {
+ @Override
public void run() {
final Point p0 = getLocationOnScreenImpl(0, 0);
- res[0] = Boolean.valueOf(confinePointer0(getWindowHandle(), confine,
+ res[0] = Boolean.valueOf(confinePointer0(getWindowHandle(), confine,
p0.getX(), p0.getY(), p0.getX()+getWidth(), p0.getY()+getHeight()));
}
});
return res[0].booleanValue();
}
-
+
@Override
- protected void warpPointerImpl(final int x, final int y) {
+ protected void warpPointerImpl(final int x, final int y) {
this.runOnEDTIfAvail(true, new Runnable() {
+ @Override
public void run() {
final Point sPos = getLocationOnScreenImpl(x, y);
warpPointer0(getWindowHandle(), sPos.getX(), sPos.getY());
@@ -255,44 +262,46 @@ public class WindowDriver extends WindowImpl {
});
return;
}
-
+
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
return GDIUtil.GetRelativeLocation( getWindowHandle(), 0 /*root win*/, x, y);
}
+ @Override
protected void updateInsetsImpl(Insets insets) {
- // nop - using event driven insetsChange(..)
+ // nop - using event driven insetsChange(..)
}
-
+
//
// PointerEvent Handling
//
/**
* Send multiple-pointer {@link MouseEvent.PointerType#TouchScreen} event to be directly consumed
* <p>
- * Assumes non normal pointer names and rotation/scroll will be determined by a gesture handler.
+ * Assumes non normal pointer names and rotation/scroll will be determined by a gesture handler.
* </p>
* <p>
* See {@link #doPointerEvent(boolean, boolean, PointerType[], short, int, int, boolean, int[], int[], int[], float[], float, float[], float)}
* for details.
* </p>
*/
- public final void sendTouchScreenEvent(short eventType, int modifiers,
+ public final void sendTouchScreenEvent(short eventType, int modifiers,
int pActionIdx, int[] pNames,
int[] pX, int[] pY, float[] pPressure, float maxPressure) {
final int pCount = pNames.length;
final MouseEvent.PointerType[] pTypes = new MouseEvent.PointerType[pCount];
for(int i=pCount-1; i>=0; i--) { pTypes[i] = PointerType.TouchScreen; }
- doPointerEvent(false /*enqueue*/, false /*wait*/,
- pTypes, eventType, modifiers, pActionIdx, false /*normalPNames*/, pNames,
+ doPointerEvent(false /*enqueue*/, false /*wait*/,
+ pTypes, eventType, modifiers, pActionIdx, false /*normalPNames*/, pNames,
pX, pY, pPressure, maxPressure, new float[] { 0f, 0f, 0f} /*rotationXYZ*/, 1f/*rotationScale*/);
}
-
+
//
// KeyEvent Handling
//
private short repeatedKey = KeyEvent.VK_UNDEFINED;
-
+
private final boolean handlePressTypedAutoRepeat(boolean isModifierKey, int modifiers, short keyCode, short keySym, char keyChar) {
if( setKeyPressed(keyCode, true) ) {
// AR: Key was already pressed: Either [enter | within] AR mode
@@ -308,18 +317,18 @@ public class WindowDriver extends WindowImpl {
super.sendKeyEvent(KeyEvent.EVENT_KEY_RELEASED, modifiers, keyCode, keySym, keyChar);
}
return true;
- }
+ }
return false;
}
-
+
@Override
public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
final boolean isModifierKey = KeyEvent.isModifierKey(keySym);
// System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar+">, mods "+toHexString(modifiers)+
// ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", printableKey "+KeyEvent.isPrintableKey(keyCode, false)+" [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis());
-
+
// Reorder: WINDOWS delivery order is PRESSED (t0), TYPED (t0) and RELEASED (t1) -> NEWT order: PRESSED (t0) and RELEASED (t1)
- // Auto-Repeat: WINDOWS delivers only PRESSED (t0) and TYPED (t0).
+ // Auto-Repeat: WINDOWS delivers only PRESSED (t0) and TYPED (t0).
switch(eventType) {
case KeyEvent.EVENT_KEY_RELEASED:
if( isKeyCodeTracked(keyCode) ) {
@@ -339,12 +348,12 @@ public class WindowDriver extends WindowImpl {
break;
}
}
-
+
@Override
public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
-
+
//----------------------------------------------------------------------
// Internals only
//
@@ -361,5 +370,5 @@ public class WindowDriver extends WindowImpl {
private static native boolean setPointerVisible0(long windowHandle, boolean visible);
private static native boolean confinePointer0(long windowHandle, boolean grab, int l, int t, int r, int b);
- private static native void warpPointer0(long windowHandle, int x, int y);
+ private static native void warpPointer0(long windowHandle, int x, int y);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
index d911483b0..504839797 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.x11;
@@ -63,6 +63,7 @@ public class DisplayDriver extends DisplayImpl {
public DisplayDriver() {
}
+ @Override
public String validateDisplayName(String name, long handle) {
return X11Util.validateDisplayName(name, handle);
}
@@ -72,6 +73,7 @@ public class DisplayDriver extends DisplayImpl {
*
* We use a private non-shared X11 Display instance for EDT window operations and one for exposed animation, eg. OpenGL.
*/
+ @Override
protected void createNativeImpl() {
X11Util.setX11ErrorHandler(true, DEBUG ? false : true); // make sure X11 error handler is set
long handle = X11Util.openDisplay(name);
@@ -83,7 +85,7 @@ public class DisplayDriver extends DisplayImpl {
CompleteDisplay0(aDevice.getHandle());
} catch(RuntimeException e) {
closeNativeImpl(aDevice);
- throw e;
+ throw e;
}
}
@@ -114,14 +116,14 @@ public class DisplayDriver extends DisplayImpl {
protected long getJavaObjectAtom() { return javaObjectAtom; }
protected long getWindowDeleteAtom() { return windowDeleteAtom; }
// protected long getKbdHandle() { return kbdHandle; } // XKB disabled for now
-
- /** Returns <code>null</code> if !{@link #isNativeValid()}, otherwise the Boolean value of {@link X11GraphicsDevice#isXineramaEnabled()}. */
+
+ /** Returns <code>null</code> if !{@link #isNativeValid()}, otherwise the Boolean value of {@link X11GraphicsDevice#isXineramaEnabled()}. */
protected Boolean isXineramaEnabled() { return isNativeValid() ? Boolean.valueOf(((X11GraphicsDevice)aDevice).isXineramaEnabled()) : null; }
-
+
//----------------------------------------------------------------------
// Internals only
//
-
+
private static native boolean initIDs0(boolean debug);
private native void CompleteDisplay0(long handle);
@@ -137,10 +139,10 @@ public class DisplayDriver extends DisplayImpl {
/** X11 Window delete atom marker used on EDT */
private long windowDeleteAtom;
-
+
/** X11 Window java object property used on EDT */
- private long javaObjectAtom;
-
+ private long javaObjectAtom;
+
/** X11 Keyboard handle used on EDT */
// private long kbdHandle; // XKB disabled for now
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR.java b/src/newt/classes/jogamp/newt/driver/x11/RandR.java
index e39a6c63a..8b065d1f0 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR.java
@@ -38,18 +38,18 @@ import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
public interface RandR {
- public static final VersionNumber version110 = new VersionNumber(1, 1, 0);
+ public static final VersionNumber version110 = new VersionNumber(1, 1, 0);
public static final VersionNumber version130 = new VersionNumber(1, 3, 0);
public static final VersionNumber version140 = new VersionNumber(1, 4, 0);
VersionNumber getVersion();
-
+
void dumpInfo(final long dpy, final int screen_idx);
-
+
/**
- * Encapsulate initial device query allowing caching of internal data structures.
+ * Encapsulate initial device query allowing caching of internal data structures.
* Methods covered:
- * <ul>
+ * <ul>
* <li>{@link #getMonitorDeviceCount(long, ScreenDriver)}</li>
* <li>{@link #getAvailableRotations(long, ScreenDriver, int)}</li>
* <li>{@link #getMonitorModeProps(long, ScreenDriver, int)}</li>
@@ -57,7 +57,7 @@ public interface RandR {
* <li>{@link #getMonitorDeviceProps(long, ScreenDriver, List, int, MonitorMode)}</li>
* </ul>
* <p>
- * Above methods may be called w/o begin/end, in which case no
+ * Above methods may be called w/o begin/end, in which case no
* internal data structures can be cached:
* </p>
* @param dpy TODO
@@ -66,11 +66,11 @@ public interface RandR {
*/
boolean beginInitialQuery(long dpy, ScreenDriver screen);
void endInitialQuery(long dpy, ScreenDriver screen);
-
+
int getMonitorDeviceCount(final long dpy, final ScreenDriver screen);
int[] getAvailableRotations(final long dpy, final ScreenDriver screen, final int crt_idx);
/**
- *
+ *
* @param dpy
* @param screen
* @param mode_idx w/o indexing rotation
@@ -80,7 +80,7 @@ public interface RandR {
int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, MonitorModeProps.Cache cache, final int crt_idx);
int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx);
int[] getCurrentMonitorModeProps(final long dpy, final ScreenDriver screen, final int crt_idx);
- boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode);
-
- public void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport);
+ boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode);
+
+ public void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
index 877607f72..6c22a3fc6 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
@@ -38,8 +38,8 @@ import com.jogamp.newt.MonitorMode;
class RandR11 implements RandR {
private static final boolean DEBUG = ScreenDriver.DEBUG;
-
- RandR11() {
+
+ RandR11() {
}
@Override
@@ -51,13 +51,13 @@ class RandR11 implements RandR {
public void dumpInfo(final long dpy, final int screen_idx) {
// NOP
}
-
+
private int widthMM=0, heightMM=0;
private int modeCount = 0;
private int resolutionCount = 0;
private int[][] nrates = null; // [nres_number][nrate_number]
private int[] idx_rate = null, idx_res = null;
-
+
@Override
public boolean beginInitialQuery(long dpy, ScreenDriver screen) {
// initialize iterators and static data
@@ -76,11 +76,11 @@ class RandR11 implements RandR {
return false;
}
}
-
+
for(int nresIdx=0; nresIdx < resolutionCount; nresIdx++) {
modeCount += nrates[nresIdx].length;
}
-
+
idx_rate = new int[modeCount];
idx_res = new int[modeCount];
@@ -94,23 +94,23 @@ class RandR11 implements RandR {
}
return true;
}
-
+
@Override
public void endInitialQuery(long dpy, ScreenDriver screen) {
idx_rate=null;
- idx_res=null;
- nrates=null;
+ idx_res=null;
+ nrates=null;
}
-
+
@Override
public int getMonitorDeviceCount(final long dpy, final ScreenDriver screen) {
return 1;
}
-
+
@Override
public int[] getAvailableRotations(final long dpy, final ScreenDriver screen, final int crt_idx) {
if( 0 < crt_idx ) {
- // RandR11 only supports 1 CRT
+ // RandR11 only supports 1 CRT
return null;
}
final int screen_idx = screen.getIndex();
@@ -120,17 +120,17 @@ class RandR11 implements RandR {
}
return availRotations;
}
-
+
@Override
public int[] getMonitorModeProps(final long dpy, final ScreenDriver screen, final int mode_idx) {
if( mode_idx >= modeCount ) {
return null;
- }
+ }
final int screen_idx = screen.getIndex();
-
+
final int nres_index = idx_res[mode_idx];
final int nrate_index = idx_rate[mode_idx];
-
+
final int[] res = getScreenResolution0(dpy, screen_idx, nres_index);
if(null==res || 0==res.length) {
return null;
@@ -144,7 +144,7 @@ class RandR11 implements RandR {
if( res[3] > heightMM ) {
heightMM = res[3];
}
-
+
int rate = nrates[nres_index][nrate_index];
if(0>=rate) {
rate = ScreenImpl.default_sm_rate;
@@ -166,13 +166,13 @@ class RandR11 implements RandR {
if( MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL != i ) {
throw new InternalError("XX");
}
- return props;
+ return props;
}
-
+
@Override
public int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, final MonitorModeProps.Cache cache, final int crt_idx) {
if( 0 < crt_idx ) {
- // RandR11 only supports 1 CRT
+ // RandR11 only supports 1 CRT
return null;
}
final int[] currentModeProps = getCurrentMonitorModeProps(dpy, screen, crt_idx);
@@ -194,15 +194,15 @@ class RandR11 implements RandR {
props[i++] = currentMode.getId(); // current mode id
props[i++] = currentMode.getRotation();
for(int j=0; j<allModesCount; j++) {
- props[i++] = cache.monitorModes.get(j).getId();
+ props[i++] = cache.monitorModes.get(j).getId();
}
return props;
}
-
+
@Override
public int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx) {
if( 0 < crt_idx ) {
- // RandR11 only supports 1 CRT
+ // RandR11 only supports 1 CRT
return null;
}
final int screen_idx = screen.getIndex();
@@ -212,7 +212,7 @@ class RandR11 implements RandR {
}
int[] res;
final int nres_idx;
- try {
+ try {
int resNumber = getNumScreenResolutions0(dpy, screen_idx);
if(0==resNumber) {
return null;
@@ -241,13 +241,13 @@ class RandR11 implements RandR {
props[i++] = 0;
props[i++] = res[0]; // width
props[i++] = res[1]; // height
- return props;
+ return props;
}
-
+
@Override
public int[] getCurrentMonitorModeProps(final long dpy, final ScreenDriver screen, final int crt_idx) {
if( 0 < crt_idx ) {
- // RandR11 only supports 1 CRT
+ // RandR11 only supports 1 CRT
return null;
}
final int screen_idx = screen.getIndex();
@@ -258,7 +258,7 @@ class RandR11 implements RandR {
int[] res;
int rate, rot;
final int nres_idx;
- try {
+ try {
int resNumber = getNumScreenResolutions0(dpy, screen_idx);
if(0==resNumber) {
return null;
@@ -318,7 +318,7 @@ class RandR11 implements RandR {
final int resId = mode.getId();
if(0>resId || resId>=resolutionCount) {
throw new RuntimeException("Invalid resolution index: ! 0 < "+resId+" < "+resolutionCount+", "+monitor+", "+mode);
- }
+ }
final int f = (int)mode.getRefreshRate(); // simply cut-off, orig is int
final int r = mode.getRotation();
@@ -335,11 +335,11 @@ class RandR11 implements RandR {
}
return done;
}
-
+
@Override
public final void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport) {
// nop
- }
+ }
/** @return int[] { rot1, .. } */
private static native int[] getAvailableScreenRotations0(long display, int screen_index);
@@ -353,7 +353,7 @@ class RandR11 implements RandR {
private static native long getScreenConfiguration0(long display, int screen_index);
private static native void freeScreenConfiguration0(long screenConfiguration);
-
+
private static native int getCurrentScreenResolutionIndex0(long screenConfiguration);
private static native int getCurrentScreenRate0(long screenConfiguration);
private static native int getCurrentScreenRotation0(long screenConfiguration);
@@ -361,5 +361,5 @@ class RandR11 implements RandR {
/** needs own Display connection for XRANDR event handling */
private static native boolean setCurrentScreenModeStart0(long display, int screen_index, long screenConfiguration, int mode_index, int freq, int rot);
private static native boolean setCurrentScreenModePollEnd0(long display, int screen_index, int mode_index, int freq, int rot);
-
+
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
index ac83fc5f2..a08741d9e 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
@@ -43,19 +43,19 @@ import com.jogamp.newt.MonitorMode;
* <pre>
* MonitorMode.id == XRR mode-id (not index)
* MonitorDevice.id == XRR monitor-idx (not id)
- * </pre>
+ * </pre>
*/
class RandR13 implements RandR {
private static final boolean DEBUG = ScreenDriver.DEBUG;
-
- RandR13() {
+
+ RandR13() {
}
-
+
@Override
public final VersionNumber getVersion() {
return version130;
}
-
+
@Override
public void dumpInfo(final long dpy, final int screen_idx) {
long screenResources = getScreenResources0(dpy, screen_idx);
@@ -66,12 +66,12 @@ class RandR13 implements RandR {
dumpInfo0(dpy, screen_idx, screenResources);
} finally {
freeScreenResources0(screenResources);
- }
+ }
}
-
+
long sessionScreenResources = 0;
IntLongHashMap crtInfoHandleMap = null;
-
+
@Override
public boolean beginInitialQuery(long dpy, ScreenDriver screen) {
final int screen_idx = screen.getIndex();
@@ -84,7 +84,7 @@ class RandR13 implements RandR {
return false;
}
}
-
+
@Override
public void endInitialQuery(long dpy, ScreenDriver screen) {
if( null != crtInfoHandleMap ) {
@@ -100,7 +100,7 @@ class RandR13 implements RandR {
sessionScreenResources = 0;
}
}
-
+
private final long getScreenResourceHandle(final long dpy, final int screen_idx) {
if( 0 != sessionScreenResources ) {
return sessionScreenResources;
@@ -112,7 +112,7 @@ class RandR13 implements RandR {
freeScreenResources0( screenResourceHandle );
}
}
-
+
private final long getMonitorInfoHandle(final long dpy, final int screen_idx, long screenResources, final int monitor_idx) {
if( null != crtInfoHandleMap ) {
long h = crtInfoHandleMap.get(monitor_idx);
@@ -129,8 +129,8 @@ class RandR13 implements RandR {
if( null == crtInfoHandleMap ) {
freeMonitorInfoHandle0(monitorInfoHandle);
}
- }
-
+ }
+
@Override
public int getMonitorDeviceCount(final long dpy, final ScreenDriver screen) {
final int screen_idx = screen.getIndex();
@@ -141,7 +141,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public int[] getAvailableRotations(final long dpy, final ScreenDriver screen, final int crt_idx) {
final int screen_idx = screen.getIndex();
@@ -152,7 +152,7 @@ class RandR13 implements RandR {
final int[] availRotations = getAvailableRotations0(monitorInfo);
if(null==availRotations || 0==availRotations.length) {
return null;
- }
+ }
return availRotations;
} finally {
releaseMonitorInfoHandle(monitorInfo);
@@ -161,7 +161,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public int[] getMonitorModeProps(final long dpy, final ScreenDriver screen, final int mode_idx) {
final int screen_idx = screen.getIndex();
@@ -172,7 +172,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, MonitorModeProps.Cache cache, final int crt_idx) {
final int screen_idx = screen.getIndex();
@@ -188,9 +188,9 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
- public int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx) {
+ public int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx) {
final int screen_idx = screen.getIndex();
final long screenResources = getScreenResourceHandle(dpy, screen_idx);
try {
@@ -204,7 +204,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public int[] getCurrentMonitorModeProps(final long dpy, final ScreenDriver screen, final int crt_idx) {
final int screen_idx = screen.getIndex();
@@ -220,7 +220,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode) {
final int screen_idx = screen.getIndex();
@@ -229,7 +229,7 @@ class RandR13 implements RandR {
try {
final long monitorInfo = getMonitorInfoHandle(dpy, screen_idx, screenResources, monitor.getId());
try {
- res = setMonitorMode0(dpy, screenResources, monitorInfo, monitor.getId(), mode.getId(), mode.getRotation(),
+ res = setMonitorMode0(dpy, screenResources, monitorInfo, monitor.getId(), mode.getId(), mode.getRotation(),
-1, -1); // no fixed position!
} finally {
releaseMonitorInfoHandle(monitorInfo);
@@ -239,36 +239,36 @@ class RandR13 implements RandR {
}
return res;
}
-
+
@Override
public final void updateScreenViewport(final long dpy, final ScreenDriver screen, final RectangleImmutable viewport) {
final int screen_idx = screen.getIndex();
final long screenResources = getScreenResourceHandle(dpy, screen_idx);
try {
- setScreenViewport0(dpy, screen_idx, screenResources, viewport.getX(), viewport.getY(), viewport.getWidth(), viewport.getHeight());
+ setScreenViewport0(dpy, screen_idx, screenResources, viewport.getX(), viewport.getY(), viewport.getWidth(), viewport.getHeight());
} finally {
dumpInfo0(dpy, screen_idx, screenResources);
releaseScreenResourceHandle(screenResources);
}
}
-
+
private static native long getScreenResources0(long display, int screen_index);
private static native void freeScreenResources0(long screenResources);
private static native void dumpInfo0(long display, int screen_index, long screenResources);
-
+
private static native int getMonitorDeviceCount0(long screenResources);
-
+
private static native long getMonitorInfoHandle0(long display, int screen_index, long screenResources, int monitor_index);
private static native void freeMonitorInfoHandle0(long monitorInfoHandle);
-
+
private static native int[] getAvailableRotations0(long monitorInfo);
private static native int[] getMonitorViewport0(long monitorInfo);
private static native int[] getMonitorCurrentMode0(long monitorInfo);
-
+
private static native int[] getMonitorMode0(long screenResources, int mode_index);
private static native int[] getMonitorCurrentMode0(long screenResources, long monitorInfo);
private static native int[] getMonitorDevice0(long display, long screenResources, long monitorInfo, int monitor_idx);
-
+
private static native boolean setMonitorMode0(long display, long screenResources, long monitorInfo, int monitor_idx, int mode_id, int rotation, int x, int y);
private static native boolean setScreenViewport0(long display, int screen_index, long screenResources, int x, int y, int width, int height);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
index c01d899f8..bef7f60ec 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.x11;
@@ -54,19 +54,19 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen;
import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
-public class ScreenDriver extends ScreenImpl {
+public class ScreenDriver extends ScreenImpl {
protected static final boolean DEBUG_TEST_RANDR13_DISABLED;
-
+
static {
Debug.initSingleton();
DEBUG_TEST_RANDR13_DISABLED = Debug.isPropertyDefined("newt.test.Screen.disableRandR13", true);
-
+
DisplayDriver.initSingleton();
}
/** Ensure static init has been run. */
/* pp */static void initSingleton() { }
-
+
public ScreenDriver() {
}
@@ -74,14 +74,15 @@ public class ScreenDriver extends ScreenImpl {
protected void createNativeImpl() {
// validate screen index
Long handle = runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Long>() {
- public Long run(long dpy) {
+ @Override
+ public Long run(long dpy) {
return new Long(GetScreen0(dpy, screen_idx));
} } );
if (handle.longValue() == 0) {
throw new RuntimeException("Error creating screen: " + screen_idx);
}
- final X11GraphicsDevice x11dev = (X11GraphicsDevice) getDisplay().getGraphicsDevice();
- final long dpy = x11dev.getHandle();
+ final X11GraphicsDevice x11dev = (X11GraphicsDevice) getDisplay().getGraphicsDevice();
+ final long dpy = x11dev.getHandle();
aScreen = new X11GraphicsScreen(x11dev, screen_idx);
{
int v[] = getRandRVersion0(dpy);
@@ -118,7 +119,7 @@ public class ScreenDriver extends ScreenImpl {
if( rAndR.beginInitialQuery(device.getHandle(), this) ) {
try {
final int crtCount = rAndR.getMonitorDeviceCount(device.getHandle(), this);
-
+
// Gather all available rotations
final ArrayHashSet<Integer> availableRotations = new ArrayHashSet<Integer>();
for(int i = 0; i < crtCount; i++) {
@@ -129,7 +130,7 @@ public class ScreenDriver extends ScreenImpl {
availableRotations.addAll(rotationList);
}
}
-
+
// collect all modes, while injecting all available rotations
{
int modeIdx = 0;
@@ -147,8 +148,8 @@ public class ScreenDriver extends ScreenImpl {
if( cache.monitorModes.size() > 0 ) {
for(int i = 0; i < crtCount; i++) {
final int[] monitorProps = rAndR.getMonitorDeviceProps(device.getHandle(), this, cache, i);
- if( null != monitorProps &&
- MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps[0] && // Enabled ? I.e. contains active modes ?
+ if( null != monitorProps &&
+ MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps[0] && // Enabled ? I.e. contains active modes ?
MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps.length ) {
MonitorModeProps.streamInMonitorDevice(null, cache, this, monitorProps, 0);
}
@@ -174,12 +175,13 @@ public class ScreenDriver extends ScreenImpl {
device.unlock();
}
}
-
+
@Override
protected MonitorMode queryCurrentMonitorModeImpl(final MonitorDevice monitor) {
if( null == rAndR ) { return null; }
-
+
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<MonitorMode>() {
+ @Override
public MonitorMode run(long dpy) {
final int[] currentModeProps = rAndR.getCurrentMonitorModeProps(dpy, ScreenDriver.this, monitor.getId());
return MonitorModeProps.streamInMonitorMode(null, null, currentModeProps, 0);
@@ -189,14 +191,15 @@ public class ScreenDriver extends ScreenImpl {
@Override
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
if( null == rAndR ) { return false; }
-
+
final long t0 = System.currentTimeMillis();
boolean done = runWithOptTempDisplayHandle( new DisplayImpl.DisplayRunnable<Boolean>() {
+ @Override
public Boolean run(long dpy) {
return Boolean.valueOf( rAndR.setCurrentMonitorMode(dpy, ScreenDriver.this, monitor, mode) );
- }
+ }
}).booleanValue();
-
+
if(DEBUG || !done) {
System.err.println("X11Screen.setCurrentMonitorModeImpl: TO ("+SCREEN_MODE_CHANGE_TIMEOUT+") reached: "+
(System.currentTimeMillis()-t0)+"ms; "+monitor.getCurrentMode()+" -> "+mode);
@@ -205,10 +208,11 @@ public class ScreenDriver extends ScreenImpl {
}
private DisplayImpl.DisplayRunnable<Boolean> xineramaEnabledQueryWithTemp = new DisplayImpl.DisplayRunnable<Boolean>() {
- public Boolean run(long dpy) {
- return new Boolean(X11Util.XineramaIsEnabled(dpy));
+ @Override
+ public Boolean run(long dpy) {
+ return new Boolean(X11Util.XineramaIsEnabled(dpy));
} };
-
+
@Override
protected int validateScreenIndex(final int idx) {
final DisplayDriver x11Display = (DisplayDriver) getDisplay();
@@ -219,7 +223,7 @@ public class ScreenDriver extends ScreenImpl {
return runWithTempDisplayHandle( xineramaEnabledQueryWithTemp ).booleanValue() ? 0 : idx;
}
}
-
+
@Override
protected void calcVirtualScreenOriginAndSize(final Rectangle vOriginSize) {
final RectangleImmutable ov = (RectangleImmutable) getViewport().cloneMutable();
@@ -236,6 +240,7 @@ public class ScreenDriver extends ScreenImpl {
} } );
} else */ {
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() {
+ @Override
public Object run(long dpy) {
vOriginSize.set(0, 0, getWidth0(dpy, screen_idx), getHeight0(dpy, screen_idx));
return null;
@@ -244,17 +249,17 @@ public class ScreenDriver extends ScreenImpl {
System.err.println("X11Screen.calcVirtualScreenOriginAndSize: Querying X11: "+ov+" -> "+vOriginSize);
}
}
- }
-
+ }
+
//----------------------------------------------------------------------
// Internals only
- //
+ //
private final <T> T runWithLockedDisplayDevice(DisplayRunnable<T> action) {
return display.runWithLockedDisplayDevice(action);
}
-
+
private final <T> T runWithTempDisplayHandle(DisplayRunnable<T> action) {
- final long displayHandle = X11Util.openDisplay(display.getName());
+ final long displayHandle = X11Util.openDisplay(display.getName());
if(0 == displayHandle) {
throw new RuntimeException("null device");
}
@@ -266,7 +271,7 @@ public class ScreenDriver extends ScreenImpl {
}
return res;
}
-
+
private final <T> T runWithOptTempDisplayHandle(DisplayRunnable<T> action) {
if( null != rAndR && rAndR.getVersion().compareTo(RandR.version130) >= 0 ) {
return display.runWithLockedDisplayDevice(action);
@@ -274,12 +279,12 @@ public class ScreenDriver extends ScreenImpl {
return runWithTempDisplayHandle(action);
}
}
-
+
private static native long GetScreen0(long dpy, int scrn_idx);
private static native int getWidth0(long display, int scrn_idx);
private static native int getHeight0(long display, int scrn_idx);
-
+
private static native int[] getRandRVersion0(long display);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
index 806dd270c..5e1f7a6ed 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.x11;
@@ -57,7 +57,7 @@ public class WindowDriver extends WindowImpl {
private static final int X11_WHEEL_ONE_DOWN_BUTTON = 5;
private static final int X11_WHEEL_TWO_UP_BUTTON = 6;
private static final int X11_WHEEL_TWO_DOWN_BUTTON = 7;
-
+
static {
ScreenDriver.initSingleton();
}
@@ -70,21 +70,21 @@ public class WindowDriver extends WindowImpl {
final ScreenDriver screen = (ScreenDriver) getScreen();
final DisplayDriver display = (DisplayDriver) screen.getDisplay();
final AbstractGraphicsDevice edtDevice = display.getGraphicsDevice();
-
- // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering
+
+ // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering
final long renderDeviceHandle = X11Util.openDisplay(edtDevice.getConnection());
if( 0 == renderDeviceHandle ) {
throw new RuntimeException("Error creating display(GfxCfg/Render): "+edtDevice.getConnection());
}
renderDevice = new X11GraphicsDevice(renderDeviceHandle, AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */);
final AbstractGraphicsScreen renderScreen = new X11GraphicsScreen(renderDevice, screen.getIndex());
-
+
final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(display.getGraphicsDevice(), capsRequested);
final AbstractGraphicsConfiguration cfg = factory.chooseGraphicsConfiguration(
capsRequested, capsRequested, capabilitiesChooser, renderScreen, VisualIDHolder.VID_UNDEFINED);
if(DEBUG_IMPLEMENTATION) {
System.err.println("X11Window.createNativeImpl() factory: "+factory+", chosen config: "+cfg);
- }
+ }
if (null == cfg) {
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
@@ -93,13 +93,13 @@ public class WindowDriver extends WindowImpl {
throw new NativeWindowException("Chosen Configuration w/o native visual ID: "+cfg);
}
setGraphicsConfiguration(cfg);
- final int flags = getReconfigureFlags(0, true) &
+ final int flags = getReconfigureFlags(0, true) &
( FLAG_IS_ALWAYSONTOP | FLAG_IS_UNDECORATED ) ;
edtDevice.lock();
- try {
+ try {
setWindowHandle(CreateWindow0(getParentWindowHandle(),
- edtDevice.getHandle(), screen.getIndex(), visualID,
- display.getJavaObjectAtom(), display.getWindowDeleteAtom(),
+ edtDevice.getHandle(), screen.getIndex(), visualID,
+ display.getJavaObjectAtom(), display.getWindowDeleteAtom(),
getX(), getY(), getWidth(), getHeight(), autoPosition(), flags));
} finally {
edtDevice.unlock();
@@ -117,10 +117,10 @@ public class WindowDriver extends WindowImpl {
final AbstractGraphicsDevice edtDevice = display.getGraphicsDevice();
edtDevice.lock();
try {
- CloseWindow0(edtDevice.getHandle(), windowHandleClose,
+ CloseWindow0(edtDevice.getHandle(), windowHandleClose,
display.getJavaObjectAtom(), display.getWindowDeleteAtom() /* , display.getKbdHandle() */); // XKB disabled for now
} catch (Throwable t) {
- if(DEBUG_IMPLEMENTATION) {
+ if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
@@ -135,7 +135,7 @@ public class WindowDriver extends WindowImpl {
}
}
- /**
+ /**
* <p>
* X11 Window supports {@link #FLAG_IS_FULLSCREEN_SPAN}
* </p>
@@ -145,7 +145,7 @@ public class WindowDriver extends WindowImpl {
protected boolean isReconfigureFlagSupported(int changeFlags) {
return true; // all flags!
}
-
+
@Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, int flags) {
if(DEBUG_IMPLEMENTATION) {
@@ -153,8 +153,8 @@ public class WindowDriver extends WindowImpl {
}
final int _x, _y;
if(0 == ( FLAG_IS_UNDECORATED & flags)) {
- final InsetsImmutable i = getInsets();
-
+ final InsetsImmutable i = getInsets();
+
// client position -> top-level window position
_x = x - i.getLeftWidth() ;
_y = y - i.getTopHeight() ;
@@ -176,8 +176,9 @@ public class WindowDriver extends WindowImpl {
final int fflags = flags;
final DisplayDriver display = (DisplayDriver) getScreen().getDisplay();
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() {
+ @Override
public Object run(long dpy) {
- reconfigureWindow0( dpy, getScreenIndex(),
+ reconfigureWindow0( dpy, getScreenIndex(),
getParentWindowHandle(), getWindowHandle(), display.getWindowDeleteAtom(),
_x, _y, width, height, fflags);
return null;
@@ -202,27 +203,29 @@ public class WindowDriver extends WindowImpl {
}
final DisplayDriver display = (DisplayDriver) getScreen().getDisplay();
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() {
+ @Override
public Object run(long dpy) {
reconfigureWindow0( dpy, getScreenIndex(),
getParentWindowHandle(), getWindowHandle(), display.getWindowDeleteAtom(),
- getX(), getY(), getWidth(), getHeight(), flags);
+ getX(), getY(), getWidth(), getHeight(), flags);
return null;
}
});
}
super.focusChanged(defer, focusGained);
}
-
+
protected void reparentNotify(long newParentWindowHandle) {
if(DEBUG_IMPLEMENTATION) {
final long p0 = getParentWindowHandle();
System.err.println("Window.reparentNotify ("+getThreadName()+"): "+toHexString(p0)+" -> "+toHexString(newParentWindowHandle));
}
}
-
+
@Override
- protected void requestFocusImpl(final boolean force) {
+ protected void requestFocusImpl(final boolean force) {
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() {
+ @Override
public Object run(long dpy) {
requestFocus0(dpy, getWindowHandle(), force);
return null;
@@ -233,16 +236,18 @@ public class WindowDriver extends WindowImpl {
@Override
protected void setTitleImpl(final String title) {
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() {
+ @Override
public Object run(long dpy) {
setTitle0(dpy, getWindowHandle(), title);
return null;
}
});
}
-
+
@Override
protected boolean setPointerVisibleImpl(final boolean pointerVisible) {
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Boolean>() {
+ @Override
public Boolean run(long dpy) {
return Boolean.valueOf(setPointerVisible0(dpy, getWindowHandle(), pointerVisible));
}
@@ -252,25 +257,28 @@ public class WindowDriver extends WindowImpl {
@Override
protected boolean confinePointerImpl(final boolean confine) {
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Boolean>() {
+ @Override
public Boolean run(long dpy) {
return Boolean.valueOf(confinePointer0(dpy, getWindowHandle(), confine));
}
}).booleanValue();
}
-
+
@Override
protected void warpPointerImpl(final int x, final int y) {
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() {
+ @Override
public Object run(long dpy) {
warpPointer0(dpy, getWindowHandle(), x, y);
return null;
}
});
}
-
+
@Override
protected Point getLocationOnScreenImpl(final int x, final int y) {
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Point>() {
+ @Override
public Point run(long dpy) {
return X11Lib.GetRelativeLocation(dpy, getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y);
}
@@ -279,9 +287,9 @@ public class WindowDriver extends WindowImpl {
@Override
protected void updateInsetsImpl(Insets insets) {
- // nop - using event driven insetsChange(..)
+ // nop - using event driven insetsChange(..)
}
-
+
@Override
protected final void doMouseEvent(boolean enqueue, boolean wait, short eventType, int modifiers,
int x, int y, short button, float[] rotationXYZ, float rotationScale) {
@@ -321,34 +329,34 @@ public class WindowDriver extends WindowImpl {
rotationXYZ[0] = -1;
modifiers |= InputEvent.SHIFT_MASK;
break;
- }
+ }
break;
}
super.doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale);
}
-
+
/** Called by native TK */
protected final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar0, String keyString) {
// handleKeyEvent(true, false, eventType, modifiers, keyCode, keyChar);
final boolean isModifierKey = KeyEvent.isModifierKey(keyCode);
final boolean isAutoRepeat = 0 != ( KeyEvent.AUTOREPEAT_MASK & modifiers );
- final char keyChar = ( null != keyString ) ? keyString.charAt(0) : keyChar0;
+ final char keyChar = ( null != keyString ) ? keyString.charAt(0) : keyChar0;
// System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar0+">/<"+keyChar+">, keyString "+keyString+", mods "+toHexString(modifiers)+
// ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", repeat "+isAutoRepeat+", [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis());
-
+
if( !isAutoRepeat || !isModifierKey ) { // ! ( isModifierKey && isAutoRepeat )
switch(eventType) {
case KeyEvent.EVENT_KEY_PRESSED:
super.sendKeyEvent(KeyEvent.EVENT_KEY_PRESSED, modifiers, keyCode, keySym, keyChar);
break;
-
+
case KeyEvent.EVENT_KEY_RELEASED:
super.sendKeyEvent(KeyEvent.EVENT_KEY_RELEASED, modifiers, keyCode, keySym, keyChar);
break;
}
}
}
-
+
@Override
public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
@@ -357,33 +365,33 @@ public class WindowDriver extends WindowImpl {
public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
-
+
//----------------------------------------------------------------------
// Internals only
//
private static final String getCurrentThreadName() { return Thread.currentThread().getName(); } // Callback for JNI
private static final void dumpStack() { Thread.dumpStack(); } // Callback for JNI
-
+
private final <T> T runWithLockedDisplayDevice(DisplayRunnable<T> action) {
return ((DisplayDriver) getScreen().getDisplay()).runWithLockedDisplayDevice(action);
}
protected static native boolean initIDs0();
-
- private native long CreateWindow0(long parentWindowHandle, long display, int screen_index,
- int visualID, long javaObjectAtom, long windowDeleteAtom,
- int x, int y, int width, int height, boolean autoPosition, int flags);
+
+ private native long CreateWindow0(long parentWindowHandle, long display, int screen_index,
+ int visualID, long javaObjectAtom, long windowDeleteAtom,
+ int x, int y, int width, int height, boolean autoPosition, int flags);
private native void CloseWindow0(long display, long windowHandle, long javaObjectAtom, long windowDeleteAtom /*, long kbdHandle*/ ); // XKB disabled for now
private native void reconfigureWindow0(long display, int screen_index, long parentWindowHandle, long windowHandle,
- long windowDeleteAtom, int x, int y, int width, int height, int flags);
+ long windowDeleteAtom, int x, int y, int width, int height, int flags);
private native void requestFocus0(long display, long windowHandle, boolean force);
-
+
private static native void setTitle0(long display, long windowHandle, String title);
private static native long getParentWindow0(long display, long windowHandle);
private static native boolean setPointerVisible0(long display, long windowHandle, boolean visible);
private static native boolean confinePointer0(long display, long windowHandle, boolean grab);
private static native void warpPointer0(long display, long windowHandle, int x, int y);
-
+
private long windowHandleClose;
private X11GraphicsDevice renderDevice;
}
diff --git a/src/newt/classes/jogamp/newt/event/NEWTEventTask.java b/src/newt/classes/jogamp/newt/event/NEWTEventTask.java
index 93d5e2fb9..38a434279 100644
--- a/src/newt/classes/jogamp/newt/event/NEWTEventTask.java
+++ b/src/newt/classes/jogamp/newt/event/NEWTEventTask.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.newt.event;
import com.jogamp.newt.event.NEWTEvent;
diff --git a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
index 6024195e3..db89690f4 100644
--- a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
@@ -40,20 +40,21 @@ import com.jogamp.newt.util.EDTUtil;
*/
public class SWTEDTUtil implements EDTUtil {
public static final boolean DEBUG = Debug.debug("EDT");
-
+
private final Object edtLock = new Object(); // locking the EDT start/stop state
- private final ThreadGroup threadGroup;
+ private final ThreadGroup threadGroup;
private final String name;
private final Runnable dispatchMessages;
private final org.eclipse.swt.widgets.Display swtDisplay;
private NEDT nedt = null;
private int start_iter=0;
private static long pollPeriod = EDTUtil.defaultEDTPollPeriod;
-
+
public SWTEDTUtil(final com.jogamp.newt.Display newtDisplay, org.eclipse.swt.widgets.Display swtDisplay) {
this.threadGroup = Thread.currentThread().getThreadGroup();
this.name=Thread.currentThread().getName()+"-SWTDisplay-"+newtDisplay.getFQName()+"-EDT-";
this.dispatchMessages = new Runnable() {
+ @Override
public void run() {
((jogamp.newt.DisplayImpl) newtDisplay).dispatchMessages();
} };
@@ -61,11 +62,11 @@ public class SWTEDTUtil implements EDTUtil {
this.nedt = new NEDT(threadGroup, name);
this.nedt.setDaemon(true); // don't stop JVM from shutdown ..
}
-
+
public final org.eclipse.swt.widgets.Display getDisplay() {
return swtDisplay;
}
-
+
@Override
public long getPollPeriod() {
return pollPeriod;
@@ -116,7 +117,7 @@ public class SWTEDTUtil implements EDTUtil {
}
nedt.start();
}
-
+
@Override
public boolean isCurrentThreadEDT() {
return !swtDisplay.isDisposed() && swtDisplay.getThread() == Thread.currentThread();
@@ -126,18 +127,18 @@ public class SWTEDTUtil implements EDTUtil {
public final boolean isCurrentThreadNEDT() {
return nedt == Thread.currentThread();
}
-
+
@Override
public final boolean isCurrentThreadEDTorNEDT() {
final Thread ct = Thread.currentThread();
return ( !swtDisplay.isDisposed() && ct == swtDisplay.getThread() ) || ct == nedt ;
}
-
+
@Override
public boolean isRunning() {
return nedt.isRunning();
}
-
+
@Override
public final boolean invokeStop(boolean wait, Runnable task) {
return invokeImpl(wait, task, true);
@@ -147,12 +148,12 @@ public class SWTEDTUtil implements EDTUtil {
public final boolean invoke(boolean wait, Runnable task) {
return invokeImpl(wait, task, false);
}
-
+
private static Runnable nullTask = new Runnable() {
@Override
- public void run() { }
+ public void run() { }
};
-
+
private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) {
Throwable throwable = null;
RunnableTask rTask = null;
@@ -165,12 +166,12 @@ public class SWTEDTUtil implements EDTUtil {
System.err.println(Thread.currentThread()+": Warning: SWT-EDT about (1) to stop, won't enqueue new task: "+nedt+", isRunning "+nedt.isRunning+", shouldStop "+nedt.shouldStop);
Thread.dumpStack();
}
- return false;
+ return false;
}
if( swtDisplay.isDisposed() ) {
stop = true;
}
-
+
if( isCurrentThreadEDT() ) {
if(null != task) {
task.run();
@@ -179,7 +180,7 @@ public class SWTEDTUtil implements EDTUtil {
if( stop ) {
nedt.shouldStop = true;
}
- } else {
+ } else {
if( !nedt.isRunning && !swtDisplay.isDisposed() ) {
if( null != task ) {
if( stop ) {
@@ -210,11 +211,11 @@ public class SWTEDTUtil implements EDTUtil {
return false;
}
}
-
+
if( null != task ) {
rTask = new RunnableTask(task,
wait ? rTaskLock : null,
- true /* always catch and report Exceptions, don't disturb EDT */,
+ true /* always catch and report Exceptions, don't disturb EDT */,
wait ? null : System.err);
swtDisplay.asyncExec(rTask);
}
@@ -238,7 +239,7 @@ public class SWTEDTUtil implements EDTUtil {
}
return true;
}
- }
+ }
@Override
final public boolean waitUntilIdle() {
@@ -252,6 +253,7 @@ public class SWTEDTUtil implements EDTUtil {
}
try {
swtDisplay.syncExec(new Runnable() {
+ @Override
public void run() { }
});
} catch (Exception e) { }
@@ -278,7 +280,7 @@ public class SWTEDTUtil implements EDTUtil {
}
}
}
-
+
class NEDT extends Thread {
volatile boolean shouldStop = false;
volatile boolean isRunning = false;
@@ -298,7 +300,7 @@ public class SWTEDTUtil implements EDTUtil {
super.start();
}
- /**
+ /**
* Utilizing locking only on tasks and its execution,
* not for event dispatching.
*/
@@ -315,7 +317,7 @@ public class SWTEDTUtil implements EDTUtil {
// EDT invoke thread is SWT-EDT,
// hence dispatching is required to run on SWT-EDT as well.
// Otherwise a deadlock may happen due to dispatched event's
- // triggering a locking action.
+ // triggering a locking action.
if ( !swtDisplay.isDisposed() ) {
swtDisplay.syncExec(dispatchMessages);
} else {
@@ -343,7 +345,7 @@ public class SWTEDTUtil implements EDTUtil {
}
} finally {
if(DEBUG) {
- System.err.println(getName()+": SWT-EDT run() END "+ getName()+", "+error);
+ System.err.println(getName()+": SWT-EDT run() END "+ getName()+", "+error);
}
synchronized(edtLock) {
isRunning = false;
@@ -358,5 +360,5 @@ public class SWTEDTUtil implements EDTUtil {
} // finally
} // run()
} // EventDispatchThread
-
+
}
diff --git a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
index 3782a1186..b5c45c1aa 100644
--- a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.newt.swt.event;
import org.eclipse.swt.SWT;
@@ -206,7 +206,7 @@ public class SWTNewtEventFactory {
}
return res;
}
-
+
public static final com.jogamp.newt.event.MouseEvent createMouseEvent(org.eclipse.swt.widgets.Event event, Object source) {
switch(event.type) {
case SWT.MouseDown:
@@ -229,7 +229,7 @@ public class SWTNewtEventFactory {
}
int mods = swtModifiers2Newt(event.stateMask, true);
-
+
if( source instanceof com.jogamp.newt.Window) {
final com.jogamp.newt.Window newtSource = (com.jogamp.newt.Window)source;
if(newtSource.isPointerConfined()) {
@@ -239,7 +239,7 @@ public class SWTNewtEventFactory {
mods |= InputEvent.INVISIBLE_MASK;
}
}
-
+
return new com.jogamp.newt.event.MouseEvent(
type, (null==source)?(Object)event.data:source, (0xFFFFFFFFL & (long)event.time),
mods, event.x, event.y, (short)event.count, (short)event.button, MouseEvent.getRotationXYZ(rotation, mods), 1f);
@@ -260,32 +260,32 @@ public class SWTNewtEventFactory {
final short newtKeyCode = swtKeyCode2NewtKeyCode( event.keyCode );
return com.jogamp.newt.event.KeyEvent.create(
type, (null==source)?(Object)event.data:source, (0xFFFFFFFFL & (long)event.time),
- swtModifiers2Newt(event.stateMask, false),
+ swtModifiers2Newt(event.stateMask, false),
newtKeyCode, newtKeyCode, event.character);
}
return null; // no mapping ..
}
-
+
//
//
//
-
+
short dragButtonDown = 0;
-
+
public SWTNewtEventFactory() {
resetButtonsDown();
}
-
+
final void resetButtonsDown() {
dragButtonDown = 0;
}
-
+
public final boolean dispatchMouseEvent(org.eclipse.swt.widgets.Event event, Object source, com.jogamp.newt.event.MouseListener l) {
com.jogamp.newt.event.MouseEvent res = createMouseEvent(event, source);
if(null != res) {
if(null != l) {
switch(event.type) {
- case SWT.MouseDown:
+ case SWT.MouseDown:
dragButtonDown = (short) event.button;
l.mousePressed(res); break;
case SWT.MouseUp:
@@ -293,7 +293,7 @@ public class SWTNewtEventFactory {
l.mouseReleased(res);
{
final com.jogamp.newt.event.MouseEvent res2 = new com.jogamp.newt.event.MouseEvent(
- com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED,
+ com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED,
res.getSource(),
res.getWhen(), res.getModifiers(),
res.getX(), res.getY(), res.getClickCount(),
@@ -304,7 +304,7 @@ public class SWTNewtEventFactory {
case SWT.MouseMove:
if( 0 < dragButtonDown ) {
final com.jogamp.newt.event.MouseEvent res2 = new com.jogamp.newt.event.MouseEvent(
- com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED,
+ com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED,
res.getSource(),
res.getWhen(), res.getModifiers(),
res.getX(), res.getY(), res.getClickCount(),
@@ -315,14 +315,14 @@ public class SWTNewtEventFactory {
}
break;
case SWT.MouseEnter:
- l.mouseEntered(res);
+ l.mouseEntered(res);
break;
case SWT.MouseExit:
resetButtonsDown();
- l.mouseExited(res);
+ l.mouseExited(res);
break;
case SWT.MouseVerticalWheel:
- l.mouseWheelMoved(res);
+ l.mouseWheelMoved(res);
break;
}
}
@@ -337,7 +337,7 @@ public class SWTNewtEventFactory {
if(null != l) {
switch(event.type) {
case SWT.KeyDown:
- l.keyPressed(res);
+ l.keyPressed(res);
break;
case SWT.KeyUp:
l.keyReleased(res);
@@ -347,9 +347,9 @@ public class SWTNewtEventFactory {
return true;
}
return false;
- }
-
- public final void attachDispatchListener(final org.eclipse.swt.widgets.Control ctrl, final Object source,
+ }
+
+ public final void attachDispatchListener(final org.eclipse.swt.widgets.Control ctrl, final Object source,
final com.jogamp.newt.event.MouseListener ml,
final com.jogamp.newt.event.KeyListener kl) {
final Listener listener = new Listener () {