summaryrefslogtreecommitdiffstats
path: root/src/nativewindow
diff options
context:
space:
mode:
Diffstat (limited to 'src/nativewindow')
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/macosx/MacOSXJAWTWindow.java29
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java54
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/x11/X11JAWTWindow.java23
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java11
4 files changed, 41 insertions, 76 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/macosx/MacOSXJAWTWindow.java
index f511c7082..fc5607707 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/macosx/MacOSXJAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/macosx/MacOSXJAWTWindow.java
@@ -1,5 +1,6 @@
/*
* 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
@@ -39,16 +40,20 @@
package com.jogamp.nativewindow.impl.jawt.macosx;
-import com.jogamp.nativewindow.impl.*;
-import com.jogamp.nativewindow.impl.jawt.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-
-import javax.media.nativewindow.*;
-import java.security.*;
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.NativeWindow;
+import javax.media.nativewindow.NativeWindowException;
import javax.media.nativewindow.util.Point;
+import com.jogamp.nativewindow.impl.jawt.JAWT;
+import com.jogamp.nativewindow.impl.jawt.JAWTFactory;
+import com.jogamp.nativewindow.impl.jawt.JAWTWindow;
+import com.jogamp.nativewindow.impl.jawt.JAWT_DrawingSurface;
+import com.jogamp.nativewindow.impl.jawt.JAWT_DrawingSurfaceInfo;
+
public class MacOSXJAWTWindow extends JAWTWindow {
public MacOSXJAWTWindow(Object comp, AbstractGraphicsConfiguration config) {
@@ -63,13 +68,13 @@ public class MacOSXJAWTWindow extends JAWTWindow {
ds = JAWT.getJAWT().GetDrawingSurface(component);
if (ds == null) {
// Widget not yet realized
- unlockSurface();
+ unlockSurfaceImpl();
return NativeWindow.LOCK_SURFACE_NOT_READY;
}
int res = ds.Lock();
dsLocked = ( 0 == ( res & JAWTFactory.JAWT_LOCK_ERROR ) ) ;
if (!dsLocked) {
- unlockSurface();
+ unlockSurfaceImpl();
throw new NativeWindowException("Unable to lock surface");
}
// See whether the surface changed and if so destroy the old
@@ -91,19 +96,19 @@ public class MacOSXJAWTWindow extends JAWTWindow {
dsi = ds.GetDrawingSurfaceInfo();
}
if (dsi == null) {
- unlockSurface();
+ unlockSurfaceImpl();
return NativeWindow.LOCK_SURFACE_NOT_READY;
}
firstLock = false;
macosxdsi = (JAWT_MacOSXDrawingSurfaceInfo) dsi.platformInfo();
if (macosxdsi == null) {
- unlockSurface();
+ unlockSurfaceImpl();
return NativeWindow.LOCK_SURFACE_NOT_READY;
}
drawable = macosxdsi.getCocoaViewRef();
if (drawable == 0) {
- unlockSurface();
+ unlockSurfaceImpl();
return NativeWindow.LOCK_SURFACE_NOT_READY;
} else {
updateBounds(dsi.getBounds());
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java
index 14d6eebcd..d7cd55f9a 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java
@@ -40,6 +40,11 @@
package com.jogamp.nativewindow.impl.jawt.windows;
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.NativeWindow;
+import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.util.Point;
+
import com.jogamp.nativewindow.impl.jawt.JAWT;
import com.jogamp.nativewindow.impl.jawt.JAWTFactory;
import com.jogamp.nativewindow.impl.jawt.JAWTWindow;
@@ -47,16 +52,8 @@ import com.jogamp.nativewindow.impl.jawt.JAWT_DrawingSurface;
import com.jogamp.nativewindow.impl.jawt.JAWT_DrawingSurfaceInfo;
import com.jogamp.nativewindow.impl.windows.GDI;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.util.Point;
-
public class WindowsJAWTWindow extends JAWTWindow {
- public static final boolean PROFILING = false; // FIXME
- public static final int PROFILING_TICKS = 600; // FIXME
-
public WindowsJAWTWindow(Object comp, AbstractGraphicsConfiguration config) {
super(comp, config);
}
@@ -71,20 +68,16 @@ public class WindowsJAWTWindow extends JAWTWindow {
protected int lockSurfaceImpl() throws NativeWindowException {
int ret = NativeWindow.LOCK_SUCCESS;
- long startTime;
- if (PROFILING) {
- startTime = System.currentTimeMillis();
- }
ds = JAWT.getJAWT().GetDrawingSurface(component);
if (ds == null) {
// Widget not yet realized
- unlockSurface();
+ unlockSurfaceImpl();
return LOCK_SURFACE_NOT_READY;
}
int res = ds.Lock();
dsLocked = ( 0 == ( res & JAWTFactory.JAWT_LOCK_ERROR ) ) ;
if (!dsLocked) {
- unlockSurface();
+ unlockSurfaceImpl();
throw new NativeWindowException("Unable to lock surface");
}
// See whether the surface changed and if so destroy the old
@@ -97,40 +90,27 @@ public class WindowsJAWTWindow extends JAWTWindow {
}
dsi = ds.GetDrawingSurfaceInfo();
if (dsi == null) {
- unlockSurface();
+ unlockSurfaceImpl();
return LOCK_SURFACE_NOT_READY;
}
win32dsi = (JAWT_Win32DrawingSurfaceInfo) dsi.platformInfo();
if (win32dsi == null) {
- unlockSurface();
+ unlockSurfaceImpl();
return LOCK_SURFACE_NOT_READY;
}
windowHandle = win32dsi.getHandle();
drawable = win32dsi.getHdc();
if (windowHandle == 0 || drawable == 0) {
- unlockSurface();
+ unlockSurfaceImpl();
return LOCK_SURFACE_NOT_READY;
} else {
updateBounds(dsi.getBounds());
}
- if (PROFILING) {
- long endTime = System.currentTimeMillis();
- profilingLockSurfaceTime += (endTime - startTime);
- if (++profilingLockSurfaceTicks == PROFILING_TICKS) {
- System.err.println("LockSurface calls: " + profilingLockSurfaceTime + " ms / " + PROFILING_TICKS + " calls (" +
- ((float) profilingLockSurfaceTime / (float) PROFILING_TICKS) + " ms/call)");
- profilingLockSurfaceTime = 0;
- profilingLockSurfaceTicks = 0;
- }
- }
return ret;
}
protected void unlockSurfaceImpl() throws NativeWindowException {
long startTime = 0;
- if (PROFILING) {
- startTime = System.currentTimeMillis();
- }
if(null!=ds) {
if (null!=dsi) {
ds.FreeDrawingSurfaceInfo(dsi);
@@ -143,16 +123,6 @@ public class WindowsJAWTWindow extends JAWTWindow {
ds = null;
dsi = null;
win32dsi = null;
- if (PROFILING) {
- long endTime = System.currentTimeMillis();
- profilingUnlockSurfaceTime += (endTime - startTime);
- if (++profilingUnlockSurfaceTicks == PROFILING_TICKS) {
- System.err.println("UnlockSurface calls: " + profilingUnlockSurfaceTime + " ms / " + PROFILING_TICKS + " calls (" +
- ((float) profilingUnlockSurfaceTime / (float) PROFILING_TICKS) + " ms/call)");
- profilingUnlockSurfaceTime = 0;
- profilingUnlockSurfaceTicks = 0;
- }
- }
}
public long getWindowHandle() {
@@ -168,10 +138,6 @@ public class WindowsJAWTWindow extends JAWTWindow {
private boolean dsLocked;
private JAWT_DrawingSurfaceInfo dsi;
private JAWT_Win32DrawingSurfaceInfo win32dsi;
- private long profilingLockSurfaceTime = 0;
- private int profilingLockSurfaceTicks = 0;
- private long profilingUnlockSurfaceTime = 0;
- private int profilingUnlockSurfaceTicks = 0;
// lifetime: valid after lock, forever until invalidate
protected long windowHandle;
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/x11/X11JAWTWindow.java
index 1324bd199..f87558dbc 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/x11/X11JAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/x11/X11JAWTWindow.java
@@ -37,12 +37,6 @@
package com.jogamp.nativewindow.impl.jawt.x11;
-import com.jogamp.nativewindow.impl.jawt.JAWT;
-import com.jogamp.nativewindow.impl.jawt.JAWTFactory;
-import com.jogamp.nativewindow.impl.jawt.JAWTWindow;
-import com.jogamp.nativewindow.impl.jawt.JAWT_DrawingSurface;
-import com.jogamp.nativewindow.impl.jawt.JAWT_DrawingSurfaceInfo;
-import com.jogamp.nativewindow.impl.x11.X11Util;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.AbstractGraphicsScreen;
@@ -52,6 +46,13 @@ import javax.media.nativewindow.NativeWindowFactory;
import javax.media.nativewindow.awt.AWTGraphicsDevice;
import javax.media.nativewindow.util.Point;
+import com.jogamp.nativewindow.impl.jawt.JAWT;
+import com.jogamp.nativewindow.impl.jawt.JAWTFactory;
+import com.jogamp.nativewindow.impl.jawt.JAWTWindow;
+import com.jogamp.nativewindow.impl.jawt.JAWT_DrawingSurface;
+import com.jogamp.nativewindow.impl.jawt.JAWT_DrawingSurfaceInfo;
+import com.jogamp.nativewindow.impl.x11.X11Util;
+
public class X11JAWTWindow extends JAWTWindow {
public X11JAWTWindow(Object comp, AbstractGraphicsConfiguration config) {
@@ -90,13 +91,13 @@ public class X11JAWTWindow extends JAWTWindow {
ds = JAWT.getJAWT().GetDrawingSurface(component);
if (ds == null) {
// Widget not yet realized
- unlockSurface();
+ unlockSurfaceImpl();
return LOCK_SURFACE_NOT_READY;
}
int res = ds.Lock();
dsLocked = ( 0 == ( res & JAWTFactory.JAWT_LOCK_ERROR ) ) ;
if (!dsLocked) {
- unlockSurface();
+ unlockSurfaceImpl();
throw new NativeWindowException("Unable to lock surface");
}
// See whether the surface changed and if so destroy the old
@@ -109,17 +110,17 @@ public class X11JAWTWindow extends JAWTWindow {
}
dsi = ds.GetDrawingSurfaceInfo();
if (dsi == null) {
- unlockSurface();
+ unlockSurfaceImpl();
return LOCK_SURFACE_NOT_READY;
}
x11dsi = (JAWT_X11DrawingSurfaceInfo) dsi.platformInfo();
if (x11dsi == null) {
- unlockSurface();
+ unlockSurfaceImpl();
return LOCK_SURFACE_NOT_READY;
}
drawable = x11dsi.getDrawable();
if (drawable == 0) {
- unlockSurface();
+ unlockSurfaceImpl();
return LOCK_SURFACE_NOT_READY;
} else {
updateBounds(dsi.getBounds());
diff --git a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java
index 41051ab46..c3d10de10 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java
@@ -44,7 +44,6 @@ import javax.media.nativewindow.*;
import java.awt.Component;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
-import java.awt.Transparency;
import java.awt.image.ColorModel;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
import com.jogamp.nativewindow.impl.Debug;
@@ -125,14 +124,8 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple
*/
public static CapabilitiesImmutable setupCapabilitiesRGBABits(CapabilitiesImmutable capabilitiesIn, GraphicsConfiguration gc) {
Capabilities capabilities = (Capabilities) capabilitiesIn.cloneMutable();
-
- int cmTransparency = capabilities.isBackgroundOpaque()?Transparency.OPAQUE:Transparency.TRANSLUCENT;
- ColorModel cm = gc.getColorModel(cmTransparency);
- if(null==cm && !capabilities.isBackgroundOpaque()) {
- capabilities.setBackgroundOpaque(true);
- cmTransparency = Transparency.OPAQUE;
- cm = gc.getColorModel(cmTransparency);
- }
+
+ ColorModel cm = gc.getColorModel();
if(null==cm) {
throw new NativeWindowException("Could not determine AWT ColorModel");
}