diff options
author | Felipe Heidrich <fheidric> | 2009-06-30 22:00:12 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2009-06-30 22:00:12 +0000 |
commit | f664d297f7bb009784868bf3fcf0b3e3bb9a646b (patch) | |
tree | 54012fe4929893eef4891c88cbbf5841272ff433 /bundles/org.eclipse.swt/Eclipse SWT OpenGL | |
parent | bc18a5e014088ce811f09c603b88361094486062 (diff) | |
download | eclipse.platform.swt-f664d297f7bb009784868bf3fcf0b3e3bb9a646b.tar.gz eclipse.platform.swt-f664d297f7bb009784868bf3fcf0b3e3bb9a646b.tar.xz eclipse.platform.swt-f664d297f7bb009784868bf3fcf0b3e3bb9a646b.zip |
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT OpenGL')
32 files changed, 0 insertions, 3911 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl.c b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl.c deleted file mode 100644 index 600b28e77e..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl.c +++ /dev/null @@ -1,193 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "agl_structs.h" -#include "agl_stats.h" - -#define AGL_NATIVE(func) Java_org_eclipse_swt_internal_opengl_carbon_AGL_##func - -#ifndef NO_aglChoosePixelFormat -JNIEXPORT jint JNICALL AGL_NATIVE(aglChoosePixelFormat) - (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2) -{ - jint *lparg2=NULL; - jint rc = 0; - AGL_NATIVE_ENTER(env, that, aglChoosePixelFormat_FUNC); - if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; - rc = (jint)aglChoosePixelFormat((const AGLDevice *)arg0, arg1, (const GLint *)lparg2); -fail: - if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); - AGL_NATIVE_EXIT(env, that, aglChoosePixelFormat_FUNC); - return rc; -} -#endif - -#ifndef NO_aglCreateContext -JNIEXPORT jint JNICALL AGL_NATIVE(aglCreateContext) - (JNIEnv *env, jclass that, jint arg0, jint arg1) -{ - jint rc = 0; - AGL_NATIVE_ENTER(env, that, aglCreateContext_FUNC); - rc = (jint)aglCreateContext((AGLPixelFormat)arg0, (AGLContext)arg1); - AGL_NATIVE_EXIT(env, that, aglCreateContext_FUNC); - return rc; -} -#endif - -#ifndef NO_aglDescribePixelFormat -JNIEXPORT jboolean JNICALL AGL_NATIVE(aglDescribePixelFormat) - (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2) -{ - jint *lparg2=NULL; - jboolean rc = 0; - AGL_NATIVE_ENTER(env, that, aglDescribePixelFormat_FUNC); - if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; - rc = (jboolean)aglDescribePixelFormat((AGLPixelFormat)arg0, (GLint)arg1, (GLint *)lparg2); -fail: - if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); - AGL_NATIVE_EXIT(env, that, aglDescribePixelFormat_FUNC); - return rc; -} -#endif - -#ifndef NO_aglDestroyContext -JNIEXPORT jboolean JNICALL AGL_NATIVE(aglDestroyContext) - (JNIEnv *env, jclass that, jint arg0) -{ - jboolean rc = 0; - AGL_NATIVE_ENTER(env, that, aglDestroyContext_FUNC); - rc = (jboolean)aglDestroyContext((AGLContext)arg0); - AGL_NATIVE_EXIT(env, that, aglDestroyContext_FUNC); - return rc; -} -#endif - -#ifndef NO_aglDestroyPixelFormat -JNIEXPORT void JNICALL AGL_NATIVE(aglDestroyPixelFormat) - (JNIEnv *env, jclass that, jint arg0) -{ - AGL_NATIVE_ENTER(env, that, aglDestroyPixelFormat_FUNC); - aglDestroyPixelFormat((AGLPixelFormat)arg0); - AGL_NATIVE_EXIT(env, that, aglDestroyPixelFormat_FUNC); -} -#endif - -#ifndef NO_aglEnable -JNIEXPORT jboolean JNICALL AGL_NATIVE(aglEnable) - (JNIEnv *env, jclass that, jint arg0, jint arg1) -{ - jboolean rc = 0; - AGL_NATIVE_ENTER(env, that, aglEnable_FUNC); - rc = (jboolean)aglEnable((AGLContext)arg0, (GLenum)arg1); - AGL_NATIVE_EXIT(env, that, aglEnable_FUNC); - return rc; -} -#endif - -#ifndef NO_aglGetCurrentContext -JNIEXPORT jint JNICALL AGL_NATIVE(aglGetCurrentContext) - (JNIEnv *env, jclass that) -{ - jint rc = 0; - AGL_NATIVE_ENTER(env, that, aglGetCurrentContext_FUNC); - rc = (jint)aglGetCurrentContext(); - AGL_NATIVE_EXIT(env, that, aglGetCurrentContext_FUNC); - return rc; -} -#endif - -#ifndef NO_aglGetDrawable -JNIEXPORT jint JNICALL AGL_NATIVE(aglGetDrawable) - (JNIEnv *env, jclass that, jint arg0) -{ - jint rc = 0; - AGL_NATIVE_ENTER(env, that, aglGetDrawable_FUNC); - rc = (jint)aglGetDrawable((AGLContext)arg0); - AGL_NATIVE_EXIT(env, that, aglGetDrawable_FUNC); - return rc; -} -#endif - -#ifndef NO_aglSetCurrentContext -JNIEXPORT jboolean JNICALL AGL_NATIVE(aglSetCurrentContext) - (JNIEnv *env, jclass that, jint arg0) -{ - jboolean rc = 0; - AGL_NATIVE_ENTER(env, that, aglSetCurrentContext_FUNC); - rc = (jboolean)aglSetCurrentContext((AGLContext)arg0); - AGL_NATIVE_EXIT(env, that, aglSetCurrentContext_FUNC); - return rc; -} -#endif - -#ifndef NO_aglSetDrawable -JNIEXPORT jboolean JNICALL AGL_NATIVE(aglSetDrawable) - (JNIEnv *env, jclass that, jint arg0, jint arg1) -{ - jboolean rc = 0; - AGL_NATIVE_ENTER(env, that, aglSetDrawable_FUNC); - rc = (jboolean)aglSetDrawable((AGLContext)arg0, (AGLDrawable)arg1); - AGL_NATIVE_EXIT(env, that, aglSetDrawable_FUNC); - return rc; -} -#endif - -#ifndef NO_aglSetInteger__III -JNIEXPORT jboolean JNICALL AGL_NATIVE(aglSetInteger__III) - (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2) -{ - jboolean rc = 0; - AGL_NATIVE_ENTER(env, that, aglSetInteger__III_FUNC); - rc = (jboolean)aglSetInteger((AGLContext)arg0, (GLenum)arg1, (const GLint *)arg2); - AGL_NATIVE_EXIT(env, that, aglSetInteger__III_FUNC); - return rc; -} -#endif - -#ifndef NO_aglSetInteger__II_3I -JNIEXPORT jboolean JNICALL AGL_NATIVE(aglSetInteger__II_3I) - (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2) -{ - jint *lparg2=NULL; - jboolean rc = 0; - AGL_NATIVE_ENTER(env, that, aglSetInteger__II_3I_FUNC); - if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; - rc = (jboolean)aglSetInteger((AGLContext)arg0, (GLenum)arg1, (const GLint *)lparg2); -fail: - if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); - AGL_NATIVE_EXIT(env, that, aglSetInteger__II_3I_FUNC); - return rc; -} -#endif - -#ifndef NO_aglSwapBuffers -JNIEXPORT void JNICALL AGL_NATIVE(aglSwapBuffers) - (JNIEnv *env, jclass that, jint arg0) -{ - AGL_NATIVE_ENTER(env, that, aglSwapBuffers_FUNC); - aglSwapBuffers((AGLContext)arg0); - AGL_NATIVE_EXIT(env, that, aglSwapBuffers_FUNC); -} -#endif - -#ifndef NO_aglUpdateContext -JNIEXPORT jboolean JNICALL AGL_NATIVE(aglUpdateContext) - (JNIEnv *env, jclass that, jint arg0) -{ - jboolean rc = 0; - AGL_NATIVE_ENTER(env, that, aglUpdateContext_FUNC); - rc = (jboolean)aglUpdateContext((AGLContext)arg0); - AGL_NATIVE_EXIT(env, that, aglUpdateContext_FUNC); - return rc; -} -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl.h b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl.h deleted file mode 100644 index b0ca4d7290..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl.h +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#ifndef SWT_AGL_H_INCLUDED -#define SWT_AGL_H_INCLUDED - -#include <OpenGL/gl.h> -#include <AGL/agl.h> - -#endif /* SWT_AGL_H_INCLUDED */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl_stats.c b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl_stats.c deleted file mode 100644 index 84f3dadae7..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl_stats.c +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "agl_stats.h" - -#ifdef NATIVE_STATS - -int AGL_nativeFunctionCount = 14; -int AGL_nativeFunctionCallCount[14]; -char * AGL_nativeFunctionNames[] = { - "aglChoosePixelFormat", - "aglCreateContext", - "aglDescribePixelFormat", - "aglDestroyContext", - "aglDestroyPixelFormat", - "aglEnable", - "aglGetCurrentContext", - "aglGetDrawable", - "aglSetCurrentContext", - "aglSetDrawable", - "aglSetInteger__III", - "aglSetInteger__II_3I", - "aglSwapBuffers", - "aglUpdateContext", -}; - -#define STATS_NATIVE(func) Java_org_eclipse_swt_tools_internal_NativeStats_##func - -JNIEXPORT jint JNICALL STATS_NATIVE(AGL_1GetFunctionCount) - (JNIEnv *env, jclass that) -{ - return AGL_nativeFunctionCount; -} - -JNIEXPORT jstring JNICALL STATS_NATIVE(AGL_1GetFunctionName) - (JNIEnv *env, jclass that, jint index) -{ - return (*env)->NewStringUTF(env, AGL_nativeFunctionNames[index]); -} - -JNIEXPORT jint JNICALL STATS_NATIVE(AGL_1GetFunctionCallCount) - (JNIEnv *env, jclass that, jint index) -{ - return AGL_nativeFunctionCallCount[index]; -} - -#endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl_stats.h b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl_stats.h deleted file mode 100644 index 8f01d81680..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl_stats.h +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#ifdef NATIVE_STATS -extern int AGL_nativeFunctionCount; -extern int AGL_nativeFunctionCallCount[]; -extern char* AGL_nativeFunctionNames[]; -#define AGL_NATIVE_ENTER(env, that, func) AGL_nativeFunctionCallCount[func]++; -#define AGL_NATIVE_EXIT(env, that, func) -#else -#ifndef AGL_NATIVE_ENTER -#define AGL_NATIVE_ENTER(env, that, func) -#endif -#ifndef AGL_NATIVE_EXIT -#define AGL_NATIVE_EXIT(env, that, func) -#endif -#endif - -typedef enum { - aglChoosePixelFormat_FUNC, - aglCreateContext_FUNC, - aglDescribePixelFormat_FUNC, - aglDestroyContext_FUNC, - aglDestroyPixelFormat_FUNC, - aglEnable_FUNC, - aglGetCurrentContext_FUNC, - aglGetDrawable_FUNC, - aglSetCurrentContext_FUNC, - aglSetDrawable_FUNC, - aglSetInteger__III_FUNC, - aglSetInteger__II_3I_FUNC, - aglSwapBuffers_FUNC, - aglUpdateContext_FUNC, -} AGL_FUNCS; diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl_structs.h b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl_structs.h deleted file mode 100644 index ef802c2fd5..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/library/agl_structs.h +++ /dev/null @@ -1,13 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "agl.h" - diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/org/eclipse/swt/internal/opengl/carbon/AGL.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/org/eclipse/swt/internal/opengl/carbon/AGL.java deleted file mode 100644 index 73d8ba2772..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/org/eclipse/swt/internal/opengl/carbon/AGL.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.internal.opengl.carbon; - -import org.eclipse.swt.internal.*; - -public class AGL extends Platform { - static { - Library.loadLibrary("swt-agl"); - } - - /* Attributes */ - public static final int AGL_NONE = 0; - public static final int AGL_BUFFER_SIZE = 2; - public static final int AGL_LEVEL = 3; - public static final int AGL_RGBA = 4; - public static final int AGL_DOUBLEBUFFER = 5; - public static final int AGL_STEREO = 6; - public static final int AGL_AUX_BUFFERS = 7; - public static final int AGL_RED_SIZE = 8; - public static final int AGL_GREEN_SIZE = 9; - public static final int AGL_BLUE_SIZE = 10; - public static final int AGL_ALPHA_SIZE = 11; - public static final int AGL_DEPTH_SIZE = 12; - public static final int AGL_STENCIL_SIZE = 13; - public static final int AGL_ACCUM_RED_SIZE = 14; - public static final int AGL_ACCUM_GREEN_SIZE = 15; - public static final int AGL_ACCUM_BLUE_SIZE = 16; - public static final int AGL_ACCUM_ALPHA_SIZE = 17; - - public static final int AGL_SAMPLE_BUFFERS_ARB = 55; - public static final int AGL_SAMPLES_ARB = 56; - - /* Integer parameters */ - public static final int AGL_BUFFER_RECT = 202; - public static final int AGL_SWAP_INTERVAL = 222; - public static final int AGL_BUFFER_NAME = 231; - public static final int AGL_CLIP_REGION = 254; - -/** - * @param gdevs cast=(const AGLDevice *) - * @param attribs cast=(const GLint *) - */ -public static final native int aglChoosePixelFormat(int gdevs, int ndev, int[] attribs); -/** - * @param pix cast=(AGLPixelFormat) - * @param share cast=(AGLContext) - */ -public static final native int aglCreateContext(int pix, int share); -/** - * @param pix cast=(AGLPixelFormat) - * @param attrib cast=(GLint) - * @param value cast=(GLint *) - */ -public static final native boolean aglDescribePixelFormat(int pix, int attrib, int[] value); -/** @param ctx cast=(AGLContext) */ -public static final native boolean aglDestroyContext(int ctx); -/** @param pix cast=(AGLPixelFormat) */ -public static final native void aglDestroyPixelFormat(int pix); -/** - * @param ctx cast=(AGLContext) - * @param pname cast=(GLenum) - */ -public static final native boolean aglEnable(int ctx, int pname); -public static final native int aglGetCurrentContext(); -/** @param ctx cast=(AGLContext) */ -public static final native int aglGetDrawable(int ctx); -/** @param ctx cast=(AGLContext) */ -public static final native boolean aglSetCurrentContext(int ctx); -/** - * @param ctx cast=(AGLContext) - * @param draw cast=(AGLDrawable) - */ -public static final native boolean aglSetDrawable(int ctx, int draw); -/** - * @param ctx cast=(AGLContext) - * @param pname cast=(GLenum) - * @param params cast=(const GLint *) - */ -public static final native boolean aglSetInteger(int ctx, int pname, int[] params); -/** - * @param ctx cast=(AGLContext) - * @param pname cast=(GLenum) - * @param param cast=(const GLint *) - */ -public static final native boolean aglSetInteger(int ctx, int pname, int param); -/** @param ctx cast=(AGLContext) */ -public static final native void aglSwapBuffers(int ctx); -/** @param ctx cast=(AGLContext) */ -public static final native boolean aglUpdateContext(int ctx); -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/org/eclipse/swt/opengl/GLCanvas.java deleted file mode 100755 index 308bdfab05..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/carbon/org/eclipse/swt/opengl/GLCanvas.java +++ /dev/null @@ -1,255 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.opengl; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.carbon.*; -import org.eclipse.swt.internal.opengl.carbon.*; - -/** - * GLCanvas is a widget capable of displaying OpenGL content. - * - * @see GLData - * @see <a href="http://www.eclipse.org/swt/snippets/#opengl">OpenGL snippets</a> - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * - * @since 3.2 - */ - -public class GLCanvas extends Canvas { - int context; - int pixelFormat; - static final int MAX_ATTRIBUTES = 32; - static final String RESET_VISIBLE_REGION = "org.eclipse.swt.internal.resetVisibleRegion"; - -/** - * Create a GLCanvas widget using the attributes described in the GLData - * object provided. - * - * @param parent a composite widget - * @param style the bitwise OR'ing of widget styles - * @param data the requested attributes of the GLCanvas - * - * @exception IllegalArgumentException - * <ul><li>ERROR_NULL_ARGUMENT when the data is null - * <li>ERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided</ul> - * </ul> - */ -public GLCanvas (Composite parent, int style, GLData data) { - super (parent, style); - if (data == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - int aglAttrib [] = new int [MAX_ATTRIBUTES]; - int pos = 0; - aglAttrib [pos++] = AGL.AGL_RGBA; - if (data.doubleBuffer) aglAttrib [pos++] = AGL.AGL_DOUBLEBUFFER; - if (data.stereo) aglAttrib [pos++] = AGL.AGL_STEREO; - if (data.redSize > 0) { - aglAttrib [pos++] = AGL.AGL_RED_SIZE; - aglAttrib [pos++] = data.redSize; - } - if (data.greenSize > 0) { - aglAttrib [pos++] = AGL.AGL_GREEN_SIZE; - aglAttrib [pos++] = data.greenSize; - } - if (data.blueSize > 0) { - aglAttrib [pos++] = AGL.AGL_BLUE_SIZE; - aglAttrib [pos++] = data.blueSize; - } - if (data.alphaSize > 0) { - aglAttrib [pos++] = AGL.AGL_ALPHA_SIZE; - aglAttrib [pos++] = data.alphaSize; - } - if (data.depthSize > 0) { - aglAttrib [pos++] = AGL.AGL_DEPTH_SIZE; - aglAttrib [pos++] = data.depthSize; - } - if (data.stencilSize > 0) { - aglAttrib [pos++] = AGL.AGL_STENCIL_SIZE; - aglAttrib [pos++] = data.stencilSize; - } - if (data.accumRedSize > 0) { - aglAttrib [pos++] = AGL.AGL_ACCUM_RED_SIZE; - aglAttrib [pos++] = data.accumRedSize; - } - if (data.accumGreenSize > 0) { - aglAttrib [pos++] = AGL.AGL_ACCUM_GREEN_SIZE; - aglAttrib [pos++] = data.accumGreenSize; - } - if (data.accumBlueSize > 0) { - aglAttrib [pos++] = AGL.AGL_ACCUM_BLUE_SIZE; - aglAttrib [pos++] = data.accumBlueSize; - } - if (data.accumAlphaSize > 0) { - aglAttrib [pos++] = AGL.AGL_ACCUM_ALPHA_SIZE; - aglAttrib [pos++] = data.accumAlphaSize; - } - if (data.sampleBuffers > 0) { - aglAttrib [pos++] = AGL.AGL_SAMPLE_BUFFERS_ARB; - aglAttrib [pos++] = data.sampleBuffers; - } - if (data.samples > 0) { - aglAttrib [pos++] = AGL.AGL_SAMPLES_ARB; - aglAttrib [pos++] = data.samples; - } - aglAttrib [pos++] = AGL.AGL_NONE; - pixelFormat = AGL.aglChoosePixelFormat (0, 0, aglAttrib); - if (pixelFormat == 0) { - dispose (); - SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH); - } - int share = data.shareContext != null ? data.shareContext.context : 0; - context = AGL.aglCreateContext (pixelFormat, share); - int window = OS.GetControlOwner (handle); - int port = OS.GetWindowPort (window); - AGL.aglSetDrawable (context, port); - - Listener listener = new Listener () { - public void handleEvent (Event event) { - switch (event.type) { - case SWT.Dispose: - AGL.aglDestroyContext (context); - AGL.aglDestroyPixelFormat (pixelFormat); - break; - } - } - }; - addListener (SWT.Dispose, listener); - setData (RESET_VISIBLE_REGION, new Runnable() { - public void run() { - if (isDisposed ()) return; - fixBounds (); - } - }); -} - -void fixBounds () { - Rect bounds = new Rect (); - OS.GetControlBounds (handle, bounds); - int window = OS.GetControlOwner (handle); - int [] contentView = new int [1]; - OS.HIViewFindByID (OS.HIViewGetRoot (window), OS.kHIViewWindowContentID (), contentView); - CGPoint pt = new CGPoint (); - OS.HIViewConvertPoint (pt, OS.HIViewGetSuperview (handle), contentView [0]); - bounds.left += (int) pt.x; - bounds.top += (int) pt.y; - bounds.right += (int) pt.x; - bounds.bottom += (int) pt.y; - int x = bounds.left; - int y = bounds.top; - int width = bounds.right - bounds.left; - int height = bounds.bottom - bounds.top; - int port = OS.GetWindowPort (window); - OS.GetPortBounds (port, bounds); - int [] glbounds = new int [4]; - glbounds[0] = x; - glbounds[1] = bounds.bottom - bounds.top - y - height; - glbounds[2] = width; - glbounds[3] = height; - AGL.aglSetInteger (context, AGL.AGL_BUFFER_RECT, glbounds); - AGL.aglEnable (context, AGL.AGL_BUFFER_RECT); - GCData data = new GCData (); - int gc = internal_new_GC (data); - AGL.aglSetInteger (context, AGL.AGL_CLIP_REGION, data.visibleRgn); - AGL.aglEnable (context, AGL.AGL_CLIP_REGION); - internal_dispose_GC (gc, data); -} - -/** - * Returns a GLData object describing the created context. - * - * @return GLData description of the OpenGL context attributes - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public GLData getGLData () { - checkWidget (); - GLData data = new GLData (); - int [] value = new int [1]; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_DOUBLEBUFFER, value); - data.doubleBuffer = value [0] != 0; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_STEREO, value); - data.stereo = value [0] != 0; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_RED_SIZE, value); - data.redSize = value [0]; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_GREEN_SIZE, value); - data.greenSize = value [0]; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_BLUE_SIZE, value); - data.blueSize = value [0]; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_ALPHA_SIZE, value); - data.alphaSize = value [0]; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_DEPTH_SIZE, value); - data.depthSize = value [0]; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_STENCIL_SIZE, value); - data.stencilSize = value [0]; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_ACCUM_RED_SIZE, value); - data.accumRedSize = value [0]; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_ACCUM_GREEN_SIZE, value); - data.accumGreenSize = value [0]; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_ACCUM_BLUE_SIZE, value); - data.accumBlueSize = value [0]; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_ACCUM_ALPHA_SIZE, value); - data.accumAlphaSize = value [0]; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_SAMPLE_BUFFERS_ARB, value); - data.sampleBuffers = value [0]; - AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_SAMPLES_ARB, value); - data.samples = value [0]; - return data; -} - -/** - * Returns a boolean indicating whether the receiver's OpenGL context - * is the current context. - * - * @return true if the receiver holds the current OpenGL context, - * false otherwise - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public boolean isCurrent () { - checkWidget (); - return AGL.aglGetCurrentContext () == context; -} - -/** - * Sets the OpenGL context associated with this GLCanvas to be the - * current GL context. - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void setCurrent () { - checkWidget (); - if (AGL.aglGetCurrentContext () != context) { - AGL.aglSetCurrentContext (context); - } -} - -/** - * Swaps the front and back color buffers. - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void swapBuffers () { - checkWidget (); - AGL.aglSwapBuffers (context); -} -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/cocoa/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/cocoa/org/eclipse/swt/opengl/GLCanvas.java deleted file mode 100755 index 0f731454dd..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/cocoa/org/eclipse/swt/opengl/GLCanvas.java +++ /dev/null @@ -1,247 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.opengl; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.internal.cocoa.*; -import org.eclipse.swt.opengl.GLData; - -/** - * GLCanvas is a widget capable of displaying OpenGL content. - * - * @see GLData - * @see <a href="http://www.eclipse.org/swt/snippets/#opengl">OpenGL snippets</a> - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * - * @since 3.2 - */ - -public class GLCanvas extends Canvas { - NSOpenGLContext context; - NSOpenGLPixelFormat pixelFormat; - - static final int MAX_ATTRIBUTES = 32; - static final String GLCONTEXT_KEY = "org.eclipse.swt.internal.cocoa.glcontext"; //$NON-NLS-1$ - -/** - * Create a GLCanvas widget using the attributes described in the GLData - * object provided. - * - * @param parent a composite widget - * @param style the bitwise OR'ing of widget styles - * @param data the requested attributes of the GLCanvas - * - * @exception IllegalArgumentException - * <ul><li>ERROR_NULL_ARGUMENT when the data is null - * <li>ERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided</ul> - * </ul> - */ -public GLCanvas (Composite parent, int style, GLData data) { - super (parent, style); - if (data == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - int attrib [] = new int [MAX_ATTRIBUTES]; - int pos = 0; - - if (data.doubleBuffer) attrib [pos++] = OS.NSOpenGLPFADoubleBuffer; - - if (data.stereo) attrib [pos++] = OS.NSOpenGLPFAStereo; - - /* - * Feature in Cocoa: NSOpenGL/CoreOpenGL only supports specifying the total number of bits - * in the size of the color component. If specified, the color size is the sum of the red, green - * and blue values in the GLData. - */ - if ((data.redSize + data.blueSize + data.greenSize) > 0) { - attrib [pos++] = OS.NSOpenGLPFAColorSize; - attrib [pos++] = data.redSize + data.greenSize + data.blueSize; - } - - if (data.alphaSize > 0) { - attrib [pos++] = OS.NSOpenGLPFAAlphaSize; - attrib [pos++] = data.alphaSize; - } - - if (data.depthSize > 0) { - attrib [pos++] = OS.NSOpenGLPFADepthSize; - attrib [pos++] = data.depthSize; - } - - if (data.stencilSize > 0) { - attrib [pos++] = OS.NSOpenGLPFAStencilSize; - attrib [pos++] = data.stencilSize; - } - - /* - * Feature in Cocoa: NSOpenGL/CoreOpenGL only supports specifying the total number of bits - * in the size of the color accumulator component. If specified, the color size is the sum of the red, green, - * blue and alpha accum values in the GLData. - */ - if ((data.accumRedSize + data.accumBlueSize + data.accumGreenSize) > 0) { - attrib [pos++] = OS.NSOpenGLPFAAccumSize; - attrib [pos++] = data.accumRedSize + data.accumGreenSize + data.accumBlueSize + data.accumAlphaSize; - } - - if (data.sampleBuffers > 0) { - attrib [pos++] = OS.NSOpenGLPFASampleBuffers; - attrib [pos++] = data.sampleBuffers; - } - - if (data.samples > 0) { - attrib [pos++] = OS.NSOpenGLPFASamples; - attrib [pos++] = data.samples; - } - - attrib [pos++] = 0; - - pixelFormat = (NSOpenGLPixelFormat)new NSOpenGLPixelFormat().alloc(); - - if (pixelFormat == null) { - dispose (); - SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH); - } - pixelFormat.initWithAttributes(attrib); - - NSOpenGLContext ctx = data.shareContext != null ? data.shareContext.context : null; - context = (NSOpenGLContext) new NSOpenGLContext().alloc(); - if (context == null) { - dispose (); - SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH); - } - context = context.initWithFormat(pixelFormat, ctx); - setData(GLCONTEXT_KEY, context); - NSNotificationCenter.defaultCenter().addObserver(view, OS.sel_updateOpenGLContext_, OS.NSViewGlobalFrameDidChangeNotification, view); - - Listener listener = new Listener () { - public void handleEvent (Event event) { - switch (event.type) { - - case SWT.Dispose: - setData(GLCONTEXT_KEY, null); - NSNotificationCenter.defaultCenter().removeObserver(view); - - if (context != null) { - context.clearDrawable(); - context.release(); - } - context = null; - if (pixelFormat != null) pixelFormat.release(); - pixelFormat = null; - break; - } - } - }; - addListener (SWT.Dispose, listener); -} - -/** - * Returns a GLData object describing the created context. - * - * @return GLData description of the OpenGL context attributes - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public GLData getGLData () { - checkWidget (); - GLData data = new GLData (); - int /*long*/ [] value = new int /*long*/ [1]; - pixelFormat.getValues(value, OS.NSOpenGLPFADoubleBuffer, 0); - data.doubleBuffer = value [0] != 0; - pixelFormat.getValues(value, OS.NSOpenGLPFAStereo, 0); - data.stereo = value [0] != 0; - - pixelFormat.getValues(value, OS.NSOpenGLPFAAlphaSize, 0); - data.alphaSize = (int/*64*/)value [0]; - - /* - * Feature in Cocoa: NSOpenGL/CoreOpenGL only supports specifying the total number of bits - * in the size of the color component. For compatibility we split the color size less any alpha - * into thirds and allocate a third to each color. - */ - pixelFormat.getValues(value, OS.NSOpenGLPFAColorSize, 0); - - int colorSize = ((int/*64*/)(value[0] - data.alphaSize)) / 3; - - data.redSize = colorSize; - data.greenSize = colorSize; - data.blueSize = colorSize; - - pixelFormat.getValues(value, OS.NSOpenGLPFADepthSize, 0); - data.depthSize = (int/*64*/)value [0]; - pixelFormat.getValues(value, OS.NSOpenGLPFAStencilSize, 0); - data.stencilSize = (int/*64*/)value [0]; - - /* - * Feature(?) in Cocoa: NSOpenGL/CoreOpenGL doesn't support setting an accumulation buffer alpha, but - * has an alpha if the color values for the accumulation buffer were set. Allocate the values evenly - * in that case. - */ - pixelFormat.getValues(value, OS.NSOpenGLPFAAccumSize, 0); - - int accumColorSize = (int/*64*/)(value[0]) / 4; - data.accumRedSize = accumColorSize; - data.accumGreenSize = accumColorSize; - data.accumBlueSize = accumColorSize; - data.accumAlphaSize = accumColorSize; - - pixelFormat.getValues(value, OS.NSOpenGLPFASampleBuffers, 0); - data.sampleBuffers = (int/*64*/)value [0]; - pixelFormat.getValues(value, OS.NSOpenGLPFASamples, 0); - data.samples = (int/*64*/)value [0]; - return data; -} - -/** - * Returns a boolean indicating whether the receiver's OpenGL context - * is the current context. - * - * @return true if the receiver holds the current OpenGL context, - * false otherwise - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public boolean isCurrent () { - checkWidget (); - NSOpenGLContext current = NSOpenGLContext.currentContext(); - return current != null && current.id == context.id; -} - -/** - * Sets the OpenGL context associated with this GLCanvas to be the - * current GL context. - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void setCurrent () { - checkWidget (); - context.makeCurrentContext(); -} - -/** - * Swaps the front and back color buffers. - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void swapBuffers () { - checkWidget (); - context.flushBuffer(); -} -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/common/org/eclipse/swt/opengl/GLData.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/common/org/eclipse/swt/opengl/GLData.java deleted file mode 100644 index a2fe9cddef..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/common/org/eclipse/swt/opengl/GLData.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.opengl; - -/** - * The GLData class is a device-independent description - * of the pixel format attributes of a GL drawable. - * - * @see GLCanvas - * @see <a href="http://www.eclipse.org/swt/snippets/#opengl">OpenGL snippets</a> - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * - * @since 3.2 - */ - -public class GLData { - /** - * Specifies a double-buffered surface. During context - * creation, only double-buffered formats are considered - * when set to true. - */ - public boolean doubleBuffer; - - /** - * Specifies a stereo surface. During context creation, - * only stereo formats are considered when set to true. - */ - public boolean stereo; - - /** - * The size in bits of the color buffer's red channel. - * During context creation, this specifies the minimum - * required red bits. - */ - public int redSize; - - /** - * The size in bits of the color buffer's green channel. - * During context creation, this specifies the minimum - * required green bits. - */ - public int greenSize; - - /** - * The size in bits of the color buffer's blue channel. - * During context creation, this specifies the minimum - * required blue bits. - */ - public int blueSize; - - /** - * The size in bits of the color buffer's alpha channel. - * During context creation, this specifies the minimum - * required alpha bits. - */ - public int alphaSize; - - /** - * The size in bits of the depth buffer. During context - * creation, the smallest depth buffer of at least the - * specified value is preferred, or zero for no depth - * buffer. - */ - public int depthSize; - - /** - * The desired number of stencil bitplanes. During - * context creation, the smallest stencil buffer of at - * least the specified value is preferred, or zero for - * no stencil buffer. - */ - public int stencilSize; - - /** - * The size in bits of the accumulation buffer's red - * channel. During context creation, this specifies the - * minimum required red bits. - */ - public int accumRedSize; - - /** - * The size in bits of the accumulation buffer's green - * channel. During context creation, this specifies the - * minimum required green bits. - */ - public int accumGreenSize; - - /** - * The size in bits of the accumulation buffer's blue - * channel. During context creation, this specifies the - * minimum required blue bits. - */ - public int accumBlueSize; - - /** - * The size in bits of the accumulation buffer's alpha - * channel. During context creation, this specifies the - * minimum required alpha bits. - */ - public int accumAlphaSize; - - /** - * The number of multisample buffers used by this context. - * During context creation, this specifies the minimum - * number of multisample buffers requested. - */ - public int sampleBuffers; - - /** - * The number of samples accepted in the multisample buffer. - * During creation, pixel formats with the smallest number of - * samples that meets or exceeds the specified minimum number - * are preferred. - */ - public int samples; - - /** - * Another GLCanvas whose texture namespace and display lists - * should be shared. - * - * @since 3.5 - */ - public GLCanvas shareContext; - -/** - * Returns a string containing a concise, human-readable - * description of the receiver. - * - * @return a string representation of the data - */ -public String toString() { - return (doubleBuffer ? "doubleBuffer," : "") + - (stereo ? "stereo," : "") + - "r:" + redSize + " g:" + greenSize + " b:" + blueSize + " a:" + alphaSize + "," + - "depth:" + depthSize + ",stencil:" + stencilSize + - ",accum r:" + accumRedSize + "g:" + accumGreenSize + "b:" + accumBlueSize + "a:" + accumAlphaSize + - ",sampleBuffers:" + sampleBuffers + ",samples:" + samples; -} -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/common/org/eclipse/swt/opengl/package.html b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/common/org/eclipse/swt/opengl/package.html deleted file mode 100755 index 3ad94aefab..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/common/org/eclipse/swt/opengl/package.html +++ /dev/null @@ -1,15 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <meta name="Author" content="IBM"> - <title>Package-level Javadoc</title> -</head> -<body> -SWT OpenGL support. -<h2> -Package Specification</h2> -This package contains widgets for integrating OpenGL graphics -into SWT applications. -</body> -</html> diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/emulated/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/emulated/org/eclipse/swt/opengl/GLCanvas.java deleted file mode 100644 index 1f03cde626..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/emulated/org/eclipse/swt/opengl/GLCanvas.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.opengl; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * GLCanvas is a widget capable of displaying OpenGL content. - * - * @see GLData - * @see <a href="http://www.eclipse.org/swt/snippets/#opengl">OpenGL snippets</a> - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * - * @since 3.2 - */ - -public class GLCanvas extends Canvas { - -/** - * Create a GLCanvas widget using the attributes described in the GLData - * object provided. - * - * @param parent a composite widget - * @param style the bitwise OR'ing of widget styles - * @param data the requested attributes of the GLCanvas - * - * @exception IllegalArgumentException - * <ul><li>ERROR_NULL_ARGUMENT when the data is null - * <li>ERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided</ul> - * </ul> - */ -public GLCanvas (Composite parent, int style, GLData data) { - super (parent, style); - SWT.error (SWT.ERROR_NOT_IMPLEMENTED); -} - -/** - * Returns a GLData object describing the created context. - * - * @return GLData description of the OpenGL context attributes - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public GLData getGLData () { - checkWidget (); - SWT.error (SWT.ERROR_NOT_IMPLEMENTED); - return null; -} - -/** - * Returns a boolean indicating whether the receiver's OpenGL context - * is the current context. - * - * @return true if the receiver holds the current OpenGL context, - * false otherwise - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public boolean isCurrent () { - checkWidget (); - SWT.error (SWT.ERROR_NOT_IMPLEMENTED); - return false; -} - -/** - * Sets the OpenGL context associated with this GLCanvas to be the - * current GL context. - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void setCurrent () { - checkWidget (); - SWT.error (SWT.ERROR_NOT_IMPLEMENTED); -} - -/** - * Swaps the front and back color buffers. - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void swapBuffers () { - checkWidget (); - SWT.error (SWT.ERROR_NOT_IMPLEMENTED); -} -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx.c b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx.c deleted file mode 100644 index 7adc742281..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx.c +++ /dev/null @@ -1,316 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "glx_structs.h" -#include "glx_stats.h" - -#define GLX_NATIVE(func) Java_org_eclipse_swt_internal_opengl_glx_GLX_##func - -#ifndef NO_XVisualInfo_1sizeof -JNIEXPORT jint JNICALL GLX_NATIVE(XVisualInfo_1sizeof) - (JNIEnv *env, jclass that) -{ - jint rc = 0; - GLX_NATIVE_ENTER(env, that, XVisualInfo_1sizeof_FUNC); - rc = (jint)XVisualInfo_sizeof(); - GLX_NATIVE_EXIT(env, that, XVisualInfo_1sizeof_FUNC); - return rc; -} -#endif - -#ifndef NO__1glGetIntegerv -JNIEXPORT void JNICALL GLX_NATIVE(_1glGetIntegerv) - (JNIEnv *env, jclass that, jint arg0, jintArray arg1) -{ - jint *lparg1=NULL; - GLX_NATIVE_ENTER(env, that, _1glGetIntegerv_FUNC); - if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; - glGetIntegerv((GLenum)arg0, (GLint *)lparg1); -fail: - if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); - GLX_NATIVE_EXIT(env, that, _1glGetIntegerv_FUNC); -} -#endif - -#ifndef NO__1glViewport -JNIEXPORT void JNICALL GLX_NATIVE(_1glViewport) - (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3) -{ - GLX_NATIVE_ENTER(env, that, _1glViewport_FUNC); - glViewport((GLint)arg0, (GLint)arg1, (GLsizei)arg2, (GLsizei)arg3); - GLX_NATIVE_EXIT(env, that, _1glViewport_FUNC); -} -#endif - -#ifndef NO__1glXChooseVisual -JNIEXPORT jintLong JNICALL GLX_NATIVE(_1glXChooseVisual) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintArray arg2) -{ - jint *lparg2=NULL; - jintLong rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXChooseVisual_FUNC); - if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; - rc = (jintLong)glXChooseVisual((Display *)arg0, arg1, lparg2); -fail: - if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); - GLX_NATIVE_EXIT(env, that, _1glXChooseVisual_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXCopyContext -JNIEXPORT void JNICALL GLX_NATIVE(_1glXCopyContext) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jint arg3) -{ - GLX_NATIVE_ENTER(env, that, _1glXCopyContext_FUNC); - glXCopyContext((Display *)arg0, (GLXContext)arg1, (GLXContext)arg2, arg3); - GLX_NATIVE_EXIT(env, that, _1glXCopyContext_FUNC); -} -#endif - -#ifndef NO__1glXCreateContext -JNIEXPORT jintLong JNICALL GLX_NATIVE(_1glXCreateContext) - (JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2, jboolean arg3) -{ - XVisualInfo _arg1, *lparg1=NULL; - jintLong rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXCreateContext_FUNC); - if (arg1) if ((lparg1 = getXVisualInfoFields(env, arg1, &_arg1)) == NULL) goto fail; - rc = (jintLong)glXCreateContext((Display *)arg0, lparg1, (GLXContext)arg2, arg3); -fail: - if (arg1 && lparg1) setXVisualInfoFields(env, arg1, lparg1); - GLX_NATIVE_EXIT(env, that, _1glXCreateContext_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXCreateGLXPixmap -JNIEXPORT jintLong JNICALL GLX_NATIVE(_1glXCreateGLXPixmap) - (JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) -{ - XVisualInfo _arg1, *lparg1=NULL; - jintLong rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXCreateGLXPixmap_FUNC); - if (arg1) if ((lparg1 = getXVisualInfoFields(env, arg1, &_arg1)) == NULL) goto fail; - rc = (jintLong)glXCreateGLXPixmap((Display *)arg0, lparg1, (Pixmap)arg2); -fail: - if (arg1 && lparg1) setXVisualInfoFields(env, arg1, lparg1); - GLX_NATIVE_EXIT(env, that, _1glXCreateGLXPixmap_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXDestroyContext -JNIEXPORT void JNICALL GLX_NATIVE(_1glXDestroyContext) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) -{ - GLX_NATIVE_ENTER(env, that, _1glXDestroyContext_FUNC); - glXDestroyContext((Display *)arg0, (GLXContext)arg1); - GLX_NATIVE_EXIT(env, that, _1glXDestroyContext_FUNC); -} -#endif - -#ifndef NO__1glXDestroyGLXPixmap -JNIEXPORT void JNICALL GLX_NATIVE(_1glXDestroyGLXPixmap) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) -{ - GLX_NATIVE_ENTER(env, that, _1glXDestroyGLXPixmap_FUNC); - glXDestroyGLXPixmap((Display *)arg0, (GLXPixmap)arg1); - GLX_NATIVE_EXIT(env, that, _1glXDestroyGLXPixmap_FUNC); -} -#endif - -#ifndef NO__1glXGetClientString -JNIEXPORT jintLong JNICALL GLX_NATIVE(_1glXGetClientString) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1) -{ - jintLong rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXGetClientString_FUNC); - rc = (jintLong)glXGetClientString((Display *)arg0, arg1); - GLX_NATIVE_EXIT(env, that, _1glXGetClientString_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXGetConfig -JNIEXPORT jint JNICALL GLX_NATIVE(_1glXGetConfig) - (JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jint arg2, jintArray arg3) -{ - XVisualInfo _arg1, *lparg1=NULL; - jint *lparg3=NULL; - jint rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXGetConfig_FUNC); - if (arg1) if ((lparg1 = getXVisualInfoFields(env, arg1, &_arg1)) == NULL) goto fail; - if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail; - rc = (jint)glXGetConfig((Display *)arg0, lparg1, arg2, lparg3); -fail: - if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0); - if (arg1 && lparg1) setXVisualInfoFields(env, arg1, lparg1); - GLX_NATIVE_EXIT(env, that, _1glXGetConfig_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXGetCurrentContext -JNIEXPORT jintLong JNICALL GLX_NATIVE(_1glXGetCurrentContext) - (JNIEnv *env, jclass that) -{ - jintLong rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXGetCurrentContext_FUNC); - rc = (jintLong)glXGetCurrentContext(); - GLX_NATIVE_EXIT(env, that, _1glXGetCurrentContext_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXGetCurrentDrawable -JNIEXPORT jintLong JNICALL GLX_NATIVE(_1glXGetCurrentDrawable) - (JNIEnv *env, jclass that) -{ - jintLong rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXGetCurrentDrawable_FUNC); - rc = (jintLong)glXGetCurrentDrawable(); - GLX_NATIVE_EXIT(env, that, _1glXGetCurrentDrawable_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXIsDirect -JNIEXPORT jboolean JNICALL GLX_NATIVE(_1glXIsDirect) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) -{ - jboolean rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXIsDirect_FUNC); - rc = (jboolean)glXIsDirect((Display *)arg0, (GLXContext)arg1); - GLX_NATIVE_EXIT(env, that, _1glXIsDirect_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXMakeCurrent -JNIEXPORT jboolean JNICALL GLX_NATIVE(_1glXMakeCurrent) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2) -{ - jboolean rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXMakeCurrent_FUNC); - rc = (jboolean)glXMakeCurrent((Display *)arg0, (GLXDrawable)arg1, (GLXContext)arg2); - GLX_NATIVE_EXIT(env, that, _1glXMakeCurrent_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXQueryExtension -JNIEXPORT jboolean JNICALL GLX_NATIVE(_1glXQueryExtension) - (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2) -{ - jint *lparg1=NULL; - jint *lparg2=NULL; - jboolean rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXQueryExtension_FUNC); - if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; - if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; - rc = (jboolean)glXQueryExtension((Display *)arg0, lparg1, lparg2); -fail: - if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); - if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); - GLX_NATIVE_EXIT(env, that, _1glXQueryExtension_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXQueryExtensionsString -JNIEXPORT jintLong JNICALL GLX_NATIVE(_1glXQueryExtensionsString) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1) -{ - jintLong rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXQueryExtensionsString_FUNC); - rc = (jintLong)glXQueryExtensionsString((Display *)arg0, arg1); - GLX_NATIVE_EXIT(env, that, _1glXQueryExtensionsString_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXQueryServerString -JNIEXPORT jintLong JNICALL GLX_NATIVE(_1glXQueryServerString) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2) -{ - jintLong rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXQueryServerString_FUNC); - rc = (jintLong)glXQueryServerString((Display *)arg0, arg1, arg2); - GLX_NATIVE_EXIT(env, that, _1glXQueryServerString_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXQueryVersion -JNIEXPORT jboolean JNICALL GLX_NATIVE(_1glXQueryVersion) - (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2) -{ - jint *lparg1=NULL; - jint *lparg2=NULL; - jboolean rc = 0; - GLX_NATIVE_ENTER(env, that, _1glXQueryVersion_FUNC); - if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; - if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; - rc = (jboolean)glXQueryVersion((Display *)arg0, lparg1, lparg2); -fail: - if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); - if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); - GLX_NATIVE_EXIT(env, that, _1glXQueryVersion_FUNC); - return rc; -} -#endif - -#ifndef NO__1glXSwapBuffers -JNIEXPORT void JNICALL GLX_NATIVE(_1glXSwapBuffers) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) -{ - GLX_NATIVE_ENTER(env, that, _1glXSwapBuffers_FUNC); - glXSwapBuffers((Display *)arg0, (GLXDrawable)arg1); - GLX_NATIVE_EXIT(env, that, _1glXSwapBuffers_FUNC); -} -#endif - -#ifndef NO__1glXWaitGL -JNIEXPORT void JNICALL GLX_NATIVE(_1glXWaitGL) - (JNIEnv *env, jclass that) -{ - GLX_NATIVE_ENTER(env, that, _1glXWaitGL_FUNC); - glXWaitGL(); - GLX_NATIVE_EXIT(env, that, _1glXWaitGL_FUNC); -} -#endif - -#ifndef NO__1glXWaitX -JNIEXPORT void JNICALL GLX_NATIVE(_1glXWaitX) - (JNIEnv *env, jclass that) -{ - GLX_NATIVE_ENTER(env, that, _1glXWaitX_FUNC); - glXWaitX(); - GLX_NATIVE_EXIT(env, that, _1glXWaitX_FUNC); -} -#endif - -#ifndef NO_memmove -JNIEXPORT void JNICALL GLX_NATIVE(memmove) - (JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jint arg2) -{ - XVisualInfo _arg0, *lparg0=NULL; - GLX_NATIVE_ENTER(env, that, memmove_FUNC); - if (arg0) if ((lparg0 = getXVisualInfoFields(env, arg0, &_arg0)) == NULL) goto fail; - memmove(lparg0, (const void *)arg1, (size_t)arg2); -fail: - if (arg0 && lparg0) setXVisualInfoFields(env, arg0, lparg0); - GLX_NATIVE_EXIT(env, that, memmove_FUNC); -} -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx.h b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx.h deleted file mode 100644 index 72d51811e7..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx.h +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#ifndef SWT_GLX_H_INCLUDED -#define SWT_GLX_H_INCLUDED - -#include <GL/glx.h> -#include <X11/Xutil.h> -#include <string.h> - -#endif /* SWT_GLX_H_INCLUDED */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx_stats.c b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx_stats.c deleted file mode 100644 index 1d62603f75..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx_stats.c +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "glx_stats.h" - -#ifdef NATIVE_STATS - -int GLX_nativeFunctionCount = 23; -int GLX_nativeFunctionCallCount[23]; -char * GLX_nativeFunctionNames[] = { - "XVisualInfo_1sizeof", - "_1glGetIntegerv", - "_1glViewport", - "_1glXChooseVisual", - "_1glXCopyContext", - "_1glXCreateContext", - "_1glXCreateGLXPixmap", - "_1glXDestroyContext", - "_1glXDestroyGLXPixmap", - "_1glXGetClientString", - "_1glXGetConfig", - "_1glXGetCurrentContext", - "_1glXGetCurrentDrawable", - "_1glXIsDirect", - "_1glXMakeCurrent", - "_1glXQueryExtension", - "_1glXQueryExtensionsString", - "_1glXQueryServerString", - "_1glXQueryVersion", - "_1glXSwapBuffers", - "_1glXWaitGL", - "_1glXWaitX", - "memmove", -}; - -#define STATS_NATIVE(func) Java_org_eclipse_swt_tools_internal_NativeStats_##func - -JNIEXPORT jint JNICALL STATS_NATIVE(GLX_1GetFunctionCount) - (JNIEnv *env, jclass that) -{ - return GLX_nativeFunctionCount; -} - -JNIEXPORT jstring JNICALL STATS_NATIVE(GLX_1GetFunctionName) - (JNIEnv *env, jclass that, jint index) -{ - return (*env)->NewStringUTF(env, GLX_nativeFunctionNames[index]); -} - -JNIEXPORT jint JNICALL STATS_NATIVE(GLX_1GetFunctionCallCount) - (JNIEnv *env, jclass that, jint index) -{ - return GLX_nativeFunctionCallCount[index]; -} - -#endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx_stats.h b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx_stats.h deleted file mode 100644 index 3c39671663..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx_stats.h +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#ifdef NATIVE_STATS -extern int GLX_nativeFunctionCount; -extern int GLX_nativeFunctionCallCount[]; -extern char* GLX_nativeFunctionNames[]; -#define GLX_NATIVE_ENTER(env, that, func) GLX_nativeFunctionCallCount[func]++; -#define GLX_NATIVE_EXIT(env, that, func) -#else -#ifndef GLX_NATIVE_ENTER -#define GLX_NATIVE_ENTER(env, that, func) -#endif -#ifndef GLX_NATIVE_EXIT -#define GLX_NATIVE_EXIT(env, that, func) -#endif -#endif - -typedef enum { - XVisualInfo_1sizeof_FUNC, - _1glGetIntegerv_FUNC, - _1glViewport_FUNC, - _1glXChooseVisual_FUNC, - _1glXCopyContext_FUNC, - _1glXCreateContext_FUNC, - _1glXCreateGLXPixmap_FUNC, - _1glXDestroyContext_FUNC, - _1glXDestroyGLXPixmap_FUNC, - _1glXGetClientString_FUNC, - _1glXGetConfig_FUNC, - _1glXGetCurrentContext_FUNC, - _1glXGetCurrentDrawable_FUNC, - _1glXIsDirect_FUNC, - _1glXMakeCurrent_FUNC, - _1glXQueryExtension_FUNC, - _1glXQueryExtensionsString_FUNC, - _1glXQueryServerString_FUNC, - _1glXQueryVersion_FUNC, - _1glXSwapBuffers_FUNC, - _1glXWaitGL_FUNC, - _1glXWaitX_FUNC, - memmove_FUNC, -} GLX_FUNCS; diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx_structs.c b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx_structs.c deleted file mode 100644 index 7aec87e5af..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx_structs.c +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "glx_structs.h" - -#ifndef NO_XVisualInfo -typedef struct XVisualInfo_FID_CACHE { - int cached; - jclass clazz; - jfieldID visual, visualid, screen, depth, cclass, red_mask, green_mask, blue_mask, colormap_size, bits_per_rgb; -} XVisualInfo_FID_CACHE; - -XVisualInfo_FID_CACHE XVisualInfoFc; - -void cacheXVisualInfoFields(JNIEnv *env, jobject lpObject) -{ - if (XVisualInfoFc.cached) return; - XVisualInfoFc.clazz = (*env)->GetObjectClass(env, lpObject); - XVisualInfoFc.visual = (*env)->GetFieldID(env, XVisualInfoFc.clazz, "visual", I_J); - XVisualInfoFc.visualid = (*env)->GetFieldID(env, XVisualInfoFc.clazz, "visualid", "I"); - XVisualInfoFc.screen = (*env)->GetFieldID(env, XVisualInfoFc.clazz, "screen", "I"); - XVisualInfoFc.depth = (*env)->GetFieldID(env, XVisualInfoFc.clazz, "depth", "I"); - XVisualInfoFc.cclass = (*env)->GetFieldID(env, XVisualInfoFc.clazz, "cclass", "I"); - XVisualInfoFc.red_mask = (*env)->GetFieldID(env, XVisualInfoFc.clazz, "red_mask", "I"); - XVisualInfoFc.green_mask = (*env)->GetFieldID(env, XVisualInfoFc.clazz, "green_mask", "I"); - XVisualInfoFc.blue_mask = (*env)->GetFieldID(env, XVisualInfoFc.clazz, "blue_mask", "I"); - XVisualInfoFc.colormap_size = (*env)->GetFieldID(env, XVisualInfoFc.clazz, "colormap_size", "I"); - XVisualInfoFc.bits_per_rgb = (*env)->GetFieldID(env, XVisualInfoFc.clazz, "bits_per_rgb", "I"); - XVisualInfoFc.cached = 1; -} - -XVisualInfo *getXVisualInfoFields(JNIEnv *env, jobject lpObject, XVisualInfo *lpStruct) -{ - if (!XVisualInfoFc.cached) cacheXVisualInfoFields(env, lpObject); - lpStruct->visual = (Visual *)(*env)->GetIntLongField(env, lpObject, XVisualInfoFc.visual); - lpStruct->visualid = (*env)->GetIntField(env, lpObject, XVisualInfoFc.visualid); - lpStruct->screen = (*env)->GetIntField(env, lpObject, XVisualInfoFc.screen); - lpStruct->depth = (*env)->GetIntField(env, lpObject, XVisualInfoFc.depth); - lpStruct->class = (*env)->GetIntField(env, lpObject, XVisualInfoFc.cclass); - lpStruct->red_mask = (*env)->GetIntField(env, lpObject, XVisualInfoFc.red_mask); - lpStruct->green_mask = (*env)->GetIntField(env, lpObject, XVisualInfoFc.green_mask); - lpStruct->blue_mask = (*env)->GetIntField(env, lpObject, XVisualInfoFc.blue_mask); - lpStruct->colormap_size = (*env)->GetIntField(env, lpObject, XVisualInfoFc.colormap_size); - lpStruct->bits_per_rgb = (*env)->GetIntField(env, lpObject, XVisualInfoFc.bits_per_rgb); - return lpStruct; -} - -void setXVisualInfoFields(JNIEnv *env, jobject lpObject, XVisualInfo *lpStruct) -{ - if (!XVisualInfoFc.cached) cacheXVisualInfoFields(env, lpObject); - (*env)->SetIntLongField(env, lpObject, XVisualInfoFc.visual, (jintLong)lpStruct->visual); - (*env)->SetIntField(env, lpObject, XVisualInfoFc.visualid, (jint)lpStruct->visualid); - (*env)->SetIntField(env, lpObject, XVisualInfoFc.screen, (jint)lpStruct->screen); - (*env)->SetIntField(env, lpObject, XVisualInfoFc.depth, (jint)lpStruct->depth); - (*env)->SetIntField(env, lpObject, XVisualInfoFc.cclass, (jint)lpStruct->class); - (*env)->SetIntField(env, lpObject, XVisualInfoFc.red_mask, (jint)lpStruct->red_mask); - (*env)->SetIntField(env, lpObject, XVisualInfoFc.green_mask, (jint)lpStruct->green_mask); - (*env)->SetIntField(env, lpObject, XVisualInfoFc.blue_mask, (jint)lpStruct->blue_mask); - (*env)->SetIntField(env, lpObject, XVisualInfoFc.colormap_size, (jint)lpStruct->colormap_size); - (*env)->SetIntField(env, lpObject, XVisualInfoFc.bits_per_rgb, (jint)lpStruct->bits_per_rgb); -} -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx_structs.h b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx_structs.h deleted file mode 100644 index 7a30ea626e..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/library/glx_structs.h +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "glx.h" - -#ifndef NO_XVisualInfo -void cacheXVisualInfoFields(JNIEnv *env, jobject lpObject); -XVisualInfo *getXVisualInfoFields(JNIEnv *env, jobject lpObject, XVisualInfo *lpStruct); -void setXVisualInfoFields(JNIEnv *env, jobject lpObject, XVisualInfo *lpStruct); -#define XVisualInfo_sizeof() sizeof(XVisualInfo) -#else -#define cacheXVisualInfoFields(a,b) -#define getXVisualInfoFields(a,b,c) NULL -#define setXVisualInfoFields(a,b,c) -#define XVisualInfo_sizeof() 0 -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/org/eclipse/swt/internal/opengl/glx/GLX.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/org/eclipse/swt/internal/opengl/glx/GLX.java deleted file mode 100755 index 4f1d979490..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/org/eclipse/swt/internal/opengl/glx/GLX.java +++ /dev/null @@ -1,454 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.internal.opengl.glx; - -import org.eclipse.swt.internal.*; - -public class GLX extends Platform { - static { - Library.loadLibrary("swt-glx"); - } - - /* - ** Visual Config Attributes (glXGetConfig, glXGetFBConfigAttrib) - */ - public static final int GLX_USE_GL = 1; /* support GLX rendering */ - public static final int GLX_BUFFER_SIZE = 2; /* depth of the color buffer */ - public static final int GLX_LEVEL = 3; /* level in plane stacking */ - public static final int GLX_RGBA = 4; /* true if RGBA mode */ - public static final int GLX_DOUBLEBUFFER = 5; /* double buffering supported */ - public static final int GLX_STEREO = 6; /* stereo buffering supported */ - public static final int GLX_AUX_BUFFERS = 7; /* number of aux buffers */ - public static final int GLX_RED_SIZE = 8; /* number of red component bits */ - public static final int GLX_GREEN_SIZE = 9; /* number of green component bits */ - public static final int GLX_BLUE_SIZE = 10; /* number of blue component bits */ - public static final int GLX_ALPHA_SIZE = 11; /* number of alpha component bits */ - public static final int GLX_DEPTH_SIZE = 12; /* number of depth bits */ - public static final int GLX_STENCIL_SIZE = 13; /* number of stencil bits */ - public static final int GLX_ACCUM_RED_SIZE = 14; /* number of red accum bits */ - public static final int GLX_ACCUM_GREEN_SIZE = 15; /* number of green accum bits */ - public static final int GLX_ACCUM_BLUE_SIZE = 16; /* number of blue accum bits */ - public static final int GLX_ACCUM_ALPHA_SIZE = 17; /* number of alpha accum bits */ - /* - ** FBConfig-specific attributes - */ - public static final int GLX_X_VISUAL_TYPE = 0x22; - public static final int GLX_CONFIG_CAVEAT = 0x20; /* Like visual_info VISUAL_CAVEAT_EXT */ - public static final int GLX_TRANSPARENT_TYPE = 0x23; - public static final int GLX_TRANSPARENT_INDEX_VALUE = 0x24; - public static final int GLX_TRANSPARENT_RED_VALUE = 0x25; - public static final int GLX_TRANSPARENT_GREEN_VALUE = 0x26; - public static final int GLX_TRANSPARENT_BLUE_VALUE = 0x27; - public static final int GLX_TRANSPARENT_ALPHA_VALUE = 0x28; - public static final int GLX_DRAWABLE_TYPE = 0x8010; - public static final int GLX_RENDER_TYPE = 0x8011; - public static final int GLX_X_RENDERABLE = 0x8012; - public static final int GLX_FBCONFIG_ID = 0x8013; - public static final int GLX_MAX_PBUFFER_WIDTH = 0x8016; - public static final int GLX_MAX_PBUFFER_HEIGHT = 0x8017; - public static final int GLX_MAX_PBUFFER_PIXELS = 0x8018; - public static final int GLX_VISUAL_ID = 0x800B; - - /* - ** Error return values from glXGetConfig. Success is indicated by - ** a value of 0. - */ - public static final int GLX_BAD_SCREEN = 1; /* screen # is bad */ - public static final int GLX_BAD_ATTRIBUTE = 2; /* attribute to get is bad */ - public static final int GLX_NO_EXTENSION = 3; /* no glx extension on server */ - public static final int GLX_BAD_VISUAL = 4; /* visual # not known by GLX */ - public static final int GLX_BAD_CONTEXT = 5; /* returned only by import_context EXT? */ - public static final int GLX_BAD_VALUE = 6; /* returned only by glXSwapIntervalSGI? */ - public static final int GLX_BAD_ENUM = 7; /* unused? */ - - /* FBConfig attribute values */ - - /* - ** Generic "don't care" value for glX ChooseFBConfig attributes (except - ** GLX_LEVEL) - */ - public static final int GLX_DONT_CARE = 0xFFFFFFFF; - - /* GLX_RENDER_TYPE bits */ - public static final int GLX_RGBA_BIT = 0x00000001; - public static final int GLX_COLOR_INDEX_BIT = 0x00000002; - - /* GLX_DRAWABLE_TYPE bits */ - public static final int GLX_WINDOW_BIT = 0x00000001; - public static final int GLX_PIXMAP_BIT = 0x00000002; - public static final int GLX_PBUFFER_BIT = 0x00000004; - - /* GLX_CONFIG_CAVEAT attribute values */ - public static final int GLX_NONE = 0x8000; - public static final int GLX_SLOW_CONFIG = 0x8001; - public static final int GLX_NON_CONFORMANT_CONFIG = 0x800D; - - /* GLX_X_VISUAL_TYPE attribute values */ - public static final int GLX_TRUE_COLOR = 0x8002; - public static final int GLX_DIRECT_COLOR = 0x8003; - public static final int GLX_PSEUDO_COLOR = 0x8004; - public static final int GLX_STATIC_COLOR = 0x8005; - public static final int GLX_GRAY_SCALE = 0x8006; - public static final int GLX_STATIC_GRAY = 0x8007; - - /* GLX_TRANSPARENT_TYPE attribute values */ - /* public static final int GLX_NONE 0x8000 */ - public static final int GLX_TRANSPARENT_RGB = 0x8008; - public static final int GLX_TRANSPARENT_INDEX = 0x8009; - - /* glXCreateGLXPbuffer attributes */ - public static final int GLX_PRESERVED_CONTENTS = 0x801B; - public static final int GLX_LARGEST_PBUFFER = 0x801C; - public static final int GLX_PBUFFER_HEIGHT = 0x8040; /* New for GLX 1.3 */ - public static final int GLX_PBUFFER_WIDTH = 0x8041; /* New for GLX 1.3 */ - - /* glXQueryGLXPBuffer attributes */ - public static final int GLX_WIDTH = 0x801D; - public static final int GLX_HEIGHT = 0x801E; - public static final int GLX_EVENT_MASK = 0x801F; - - /* glXCreateNewContext render_type attribute values */ - public static final int GLX_RGBA_TYPE = 0x8014; - public static final int GLX_COLOR_INDEX_TYPE = 0x8015; - - /* glXQueryContext attributes */ - /* public static final int GLX_FBCONFIG_ID 0x8013 */ - /* public static final int GLX_RENDER_TYPE 0x8011 */ - public static final int GLX_SCREEN = 0x800C; - - /* glXSelectEvent event mask bits */ - public static final int GLX_PBUFFER_CLOBBER_MASK = 0x08000000; - - /* GLXPbufferClobberEvent event_type values */ - public static final int GLX_DAMAGED = 0x8020; - public static final int GLX_SAVED = 0x8021; - - /* GLXPbufferClobberEvent draw_type values */ - public static final int GLX_WINDOW = 0x8022; - public static final int GLX_PBUFFER = 0x8023; - - /* GLXPbufferClobberEvent buffer_mask bits */ - public static final int GLX_FRONT_LEFT_BUFFER_BIT = 0x00000001; - public static final int GLX_FRONT_RIGHT_BUFFER_BIT = 0x00000002; - public static final int GLX_BACK_LEFT_BUFFER_BIT = 0x00000004; - public static final int GLX_BACK_RIGHT_BUFFER_BIT = 0x00000008; - public static final int GLX_AUX_BUFFERS_BIT = 0x00000010; - public static final int GLX_DEPTH_BUFFER_BIT = 0x00000020; - public static final int GLX_STENCIL_BUFFER_BIT = 0x00000040; - public static final int GLX_ACCUM_BUFFER_BIT = 0x00000080; - - /* - ** Extension return values from glXGetConfig. These are also - ** accepted as parameter values for glXChooseVisual. - */ - - public static final int GLX_X_VISUAL_TYPE_EXT = 0x22; /* visual_info extension type */ - public static final int GLX_TRANSPARENT_TYPE_EXT = 0x23; /* visual_info extension */ - public static final int GLX_TRANSPARENT_INDEX_VALUE_EXT = 0x24; /* visual_info extension */ - public static final int GLX_TRANSPARENT_RED_VALUE_EXT = 0x25; /* visual_info extension */ - public static final int GLX_TRANSPARENT_GREEN_VALUE_EXT = 0x26; /* visual_info extension */ - public static final int GLX_TRANSPARENT_BLUE_VALUE_EXT = 0x27; /* visual_info extension */ - public static final int GLX_TRANSPARENT_ALPHA_VALUE_EXT = 0x28; /* visual_info extension */ - - /* Property values for visual_type */ - public static final int GLX_TRUE_COLOR_EXT = 0x8002; - public static final int GLX_DIRECT_COLOR_EXT = 0x8003; - public static final int GLX_PSEUDO_COLOR_EXT = 0x8004; - public static final int GLX_STATIC_COLOR_EXT = 0x8005; - public static final int GLX_GRAY_SCALE_EXT = 0x8006; - public static final int GLX_STATIC_GRAY_EXT = 0x8007; - - /* Property values for transparent pixel */ - public static final int GLX_NONE_EXT = 0x8000; - public static final int GLX_TRANSPARENT_RGB_EXT = 0x8008; - public static final int GLX_TRANSPARENT_INDEX_EXT = 0x8009; - - /* Property values for visual_rating */ - public static final int GLX_VISUAL_CAVEAT_EXT = 0x20; /* visual_rating extension type */ - public static final int GLX_SLOW_VISUAL_EXT = 0x8001; - public static final int GLX_NON_CONFORMANT_VISUAL_EXT = 0x800D; - - /* - ** Names for attributes to glXGetClientString. - */ - public static final int GLX_VENDOR = 0x1; - public static final int GLX_VERSION = 0x2; - public static final int GLX_EXTENSIONS = 0x3; - - /* - ** Names for attributes to glXQueryContextInfoEXT. - */ - public static final int GLX_SHARE_CONTEXT_EXT = 0x800A; /* id of share context */ - public static final int GLX_VISUAL_ID_EXT = 0x800B; /* id of context's visual */ - public static final int GLX_SCREEN_EXT = 0x800C; /* screen number */ - - /* - * GLX 1.4 - */ - public static final int GLX_SAMPLE_BUFFERS = 100000; - public static final int GLX_SAMPLES = 100001; - - /* - * GL bits - */ - public static final int GL_VIEWPORT = 0x0BA2; - -public static final native int XVisualInfo_sizeof(); -/** - * @param pname cast=(GLenum) - * @param params cast=(GLint *),flags=no_in - */ -public static final native void _glGetIntegerv(int pname, int[] params); -public static final void glGetIntegerv(int pname, int[] params) { - lock.lock(); - try { - _glGetIntegerv(pname, params); - } finally { - lock.unlock(); - } -} -/** - * @param x cast=(GLint) - * @param y cast=(GLint) - * @param width cast=(GLsizei) - * @param height cast=(GLsizei) - */ -public static final native void _glViewport(int x, int y, int width, int height); -public static final void glViewport(int x, int y, int width, int height) { - lock.lock(); - try { - _glViewport(x, y, width, height); - } finally { - lock.unlock(); - } -} -/** @param dpy cast=(Display *) */ -public static final native int /*long*/ _glXChooseVisual(int /*long*/ dpy, int screen, int[] attribList); -public static final int /*long*/ glXChooseVisual(int /*long*/ dpy, int screen, int[] attribList) { - lock.lock(); - try { - return _glXChooseVisual(dpy, screen, attribList); - } finally { - lock.unlock(); - } -} -/** - * @param dpy cast=(Display *) - * @param src cast=(GLXContext) - * @param dst cast=(GLXContext) - */ -public static final native void _glXCopyContext(int /*long*/ dpy, int /*long*/ src, int /*long*/ dst, int mask); -public static final void glXCopyContext(int /*long*/ dpy, int /*long*/ src, int /*long*/ dst, int mask) { - lock.lock(); - try { - _glXCopyContext(dpy, src, dst, mask); - } finally { - lock.unlock(); - } -} -/** - * @param dpy cast=(Display *) - * @param shareList cast=(GLXContext) - */ -public static final native int /*long*/ _glXCreateContext(int /*long*/ dpy, XVisualInfo vis, int /*long*/ shareList, boolean direct); -public static final int /*long*/ glXCreateContext(int /*long*/ dpy, XVisualInfo vis, int /*long*/ shareList, boolean direct) { - lock.lock(); - try { - return _glXCreateContext(dpy, vis, shareList, direct); - } finally { - lock.unlock(); - } -} -/** - * @param dpy cast=(Display *) - * @param pixmap cast=(Pixmap) - */ -public static final native int /*long*/ _glXCreateGLXPixmap(int /*long*/ dpy, XVisualInfo vis, int /*long*/ pixmap); -public static final int /*long*/ glXCreateGLXPixmap(int /*long*/ dpy, XVisualInfo vis, int /*long*/ pixmap) { - lock.lock(); - try { - return _glXCreateGLXPixmap(dpy, vis, pixmap); - } finally { - lock.unlock(); - } -} -/** - * @param dpy cast=(Display *) - * @param ctx cast=(GLXContext) - */ -public static final native void _glXDestroyContext(int /*long*/ dpy, int /*long*/ ctx); -public static final void glXDestroyContext(int /*long*/ dpy, int /*long*/ ctx) { - lock.lock(); - try { - _glXDestroyContext(dpy, ctx); - } finally { - lock.unlock(); - } -} -/** - * @param dpy cast=(Display *) - * @param pix cast=(GLXPixmap) - */ -public static final native void _glXDestroyGLXPixmap(int /*long*/ dpy, int /*long*/ pix); -public static final void glXDestroyGLXPixmap(int /*long*/ dpy, int /*long*/ pix) { - lock.lock(); - try { - _glXDestroyGLXPixmap(dpy, pix); - } finally { - lock.unlock(); - } -} -/** @param dpy cast=(Display *) */ -public static final native int /*long*/ _glXGetClientString(int /*long*/ dpy, int name); -public static final int /*long*/ glXGetClientString(int /*long*/ dpy, int name) { - lock.lock(); - try { - return _glXGetClientString(dpy, name); - } finally { - lock.unlock(); - } -} -/** @param dpy cast=(Display *) */ -public static final native int _glXGetConfig(int /*long*/ dpy, XVisualInfo vis, int attrib, int[] value); -public static final int glXGetConfig(int /*long*/ dpy, XVisualInfo vis, int attrib, int[] value) { - lock.lock(); - try { - return _glXGetConfig(dpy, vis, attrib, value); - } finally { - lock.unlock(); - } -} -public static final native int /*long*/ _glXGetCurrentContext(); -public static final int /*long*/ glXGetCurrentContext() { - lock.lock(); - try { - return _glXGetCurrentContext(); - } finally { - lock.unlock(); - } -} -public static final native int /*long*/ _glXGetCurrentDrawable(); -public static final int /*long*/ glXGetCurrentDrawable() { - lock.lock(); - try { - return _glXGetCurrentDrawable(); - } finally { - lock.unlock(); - } -} -/** - * @param dpy cast=(Display *) - * @param ctx cast=(GLXContext) - */ -public static final native boolean _glXIsDirect(int /*long*/ dpy, int /*long*/ ctx); -public static final boolean glXIsDirect(int /*long*/ dpy, int /*long*/ ctx) { - lock.lock(); - try { - return _glXIsDirect(dpy, ctx); - } finally { - lock.unlock(); - } -} -/** - * @param dpy cast=(Display *) - * @param drawable cast=(GLXDrawable) - * @param ctx cast=(GLXContext) - */ -public static final native boolean _glXMakeCurrent(int /*long*/ dpy, int /*long*/ drawable, int /*long*/ ctx); -public static final boolean glXMakeCurrent(int /*long*/ dpy, int /*long*/ drawable, int /*long*/ ctx) { - lock.lock(); - try { - return _glXMakeCurrent(dpy, drawable, ctx); - } finally { - lock.unlock(); - } -} -/** @param dpy cast=(Display *) */ -public static final native boolean _glXQueryExtension(int /*long*/ dpy, int[] errorBase, int[] eventBase); -public static final boolean glXQueryExtension(int /*long*/ dpy, int[] errorBase, int[] eventBase) { - lock.lock(); - try { - return _glXQueryExtension(dpy, errorBase, eventBase); - } finally { - lock.unlock(); - } -} -/** @param dpy cast=(Display *) */ -public static final native int /*long*/ _glXQueryExtensionsString(int /*long*/ dpy, int screen); -public static final int /*long*/ glXQueryExtensionsString(int /*long*/ dpy, int screen) { - lock.lock(); - try { - return _glXQueryExtensionsString(dpy, screen); - } finally { - lock.unlock(); - } -} -/** @param dpy cast=(Display *) */ -public static final native int /*long*/ _glXQueryServerString(int /*long*/ dpy, int screen, int name); -public static final int /*long*/ glXQueryServerString(int /*long*/ dpy, int screen, int name) { - lock.lock(); - try { - return _glXQueryServerString(dpy, screen, name); - } finally { - lock.unlock(); - } -} -/** - * @param dpy cast=(Display *) - * @param major flags=no_in - * @param minor flags=no_in - */ -public static final native boolean _glXQueryVersion(int /*long*/ dpy, int[] major, int[] minor); -public static final boolean glXQueryVersion(int /*long*/ dpy, int[] major, int[] minor) { - lock.lock(); - try { - return _glXQueryVersion(dpy, major, minor); - } finally { - lock.unlock(); - } -} -/** - * @param dpy cast=(Display *) - * @param drawable cast=(GLXDrawable) - */ -public static final native void _glXSwapBuffers(int /*long*/ dpy, int /*long*/ drawable); -public static final void glXSwapBuffers(int /*long*/ dpy, int /*long*/ drawable) { - lock.lock(); - try { - _glXSwapBuffers(dpy, drawable); - } finally { - lock.unlock(); - } -} -public static final native void _glXWaitGL(); -public static final void glXWaitGL() { - lock.lock(); - try { - _glXWaitGL(); - } finally { - lock.unlock(); - } -} -public static final native void _glXWaitX(); -public static final void glXWaitX() { - lock.lock(); - try { - _glXWaitX(); - } finally { - lock.unlock(); - } -} -/** - * @param src cast=(const void *) - * @param size cast=(size_t) - */ -public static final native void memmove(XVisualInfo dest, int /*long*/ src, int size); -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/org/eclipse/swt/internal/opengl/glx/XVisualInfo.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/org/eclipse/swt/internal/opengl/glx/XVisualInfo.java deleted file mode 100755 index 8faa6cfca2..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx/org/eclipse/swt/internal/opengl/glx/XVisualInfo.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.internal.opengl.glx; - -public class XVisualInfo { - /** @field cast=(Visual *) */ - public int /*long*/ visual; - public int visualid; - public int screen; - public int depth; - /** @field accessor=class */ - public int cclass; - public int red_mask, green_mask, blue_mask; - public int colormap_size; - public int bits_per_rgb; - public static final int sizeof = GLX.XVisualInfo_sizeof(); -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java deleted file mode 100644 index af4b7a671f..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java +++ /dev/null @@ -1,274 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.opengl; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.internal.opengl.glx.*; - -/** - * GLCanvas is a widget capable of displaying OpenGL content. - * - * @see GLData - * @see <a href="http://www.eclipse.org/swt/snippets/#opengl">OpenGL snippets</a> - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * - * @since 3.2 - */ - -public class GLCanvas extends Canvas { - int /*long*/ context; - int /*long*/ xWindow; - int /*long*/ glWindow; - XVisualInfo vinfo; - static final int MAX_ATTRIBUTES = 32; - -/** - * Create a GLCanvas widget using the attributes described in the GLData - * object provided. - * - * @param parent a composite widget - * @param style the bitwise OR'ing of widget styles - * @param data the requested attributes of the GLCanvas - * - * @exception IllegalArgumentException - * <ul><li>ERROR_NULL_ARGUMENT when the data is null - * <li>ERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided</ul> - * </ul> - */ -public GLCanvas (Composite parent, int style, GLData data) { - super (parent, style); - if (data == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - int glxAttrib [] = new int [MAX_ATTRIBUTES]; - int pos = 0; - glxAttrib [pos++] = GLX.GLX_RGBA; - if (data.doubleBuffer) glxAttrib [pos++] = GLX.GLX_DOUBLEBUFFER; - if (data.stereo) glxAttrib [pos++] = GLX.GLX_STEREO; - if (data.redSize > 0) { - glxAttrib [pos++] = GLX.GLX_RED_SIZE; - glxAttrib [pos++] = data.redSize; - } - if (data.greenSize > 0) { - glxAttrib [pos++] = GLX.GLX_GREEN_SIZE; - glxAttrib [pos++] = data.greenSize; - } - if (data.blueSize > 0) { - glxAttrib [pos++] = GLX.GLX_BLUE_SIZE; - glxAttrib [pos++] = data.blueSize; - } - if (data.alphaSize > 0) { - glxAttrib [pos++] = GLX.GLX_ALPHA_SIZE; - glxAttrib [pos++] = data.alphaSize; - } - if (data.depthSize > 0) { - glxAttrib [pos++] = GLX.GLX_DEPTH_SIZE; - glxAttrib [pos++] = data.depthSize; - } - if (data.stencilSize > 0) { - glxAttrib [pos++] = GLX.GLX_STENCIL_SIZE; - glxAttrib [pos++] = data.stencilSize; - } - if (data.accumRedSize > 0) { - glxAttrib [pos++] = GLX.GLX_ACCUM_RED_SIZE; - glxAttrib [pos++] = data.accumRedSize; - } - if (data.accumGreenSize > 0) { - glxAttrib [pos++] = GLX.GLX_ACCUM_GREEN_SIZE; - glxAttrib [pos++] = data.accumGreenSize; - } - if (data.accumBlueSize > 0) { - glxAttrib [pos++] = GLX.GLX_ACCUM_BLUE_SIZE; - glxAttrib [pos++] = data.accumBlueSize; - } - if (data.accumAlphaSize > 0) { - glxAttrib [pos++] = GLX.GLX_ACCUM_ALPHA_SIZE; - glxAttrib [pos++] = data.accumAlphaSize; - } - if (data.sampleBuffers > 0) { - glxAttrib [pos++] = GLX.GLX_SAMPLE_BUFFERS; - glxAttrib [pos++] = data.sampleBuffers; - } - if (data.samples > 0) { - glxAttrib [pos++] = GLX.GLX_SAMPLES; - glxAttrib [pos++] = data.samples; - } - glxAttrib [pos++] = 0; - OS.gtk_widget_realize (handle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); - int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); - int /*long*/ infoPtr = GLX.glXChooseVisual (xDisplay, OS.XDefaultScreen (xDisplay), glxAttrib); - if (infoPtr == 0) { - dispose (); - SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH); - } - vinfo = new XVisualInfo (); - GLX.memmove (vinfo, infoPtr, XVisualInfo.sizeof); - OS.XFree (infoPtr); - int /*long*/ screen = OS.gdk_screen_get_default (); - int /*long*/ gdkvisual = OS.gdk_x11_screen_lookup_visual (screen, vinfo.visualid); - int /*long*/ share = data.shareContext != null ? data.shareContext.context : 0; - context = GLX.glXCreateContext (xDisplay, vinfo, share, true); - if (context == 0) SWT.error (SWT.ERROR_NO_HANDLES); - GdkWindowAttr attrs = new GdkWindowAttr (); - attrs.width = 1; - attrs.height = 1; - attrs.event_mask = OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK | - OS.GDK_FOCUS_CHANGE_MASK | OS.GDK_POINTER_MOTION_MASK | - OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK | - OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK | - OS.GDK_EXPOSURE_MASK | OS.GDK_VISIBILITY_NOTIFY_MASK | - OS.GDK_POINTER_MOTION_HINT_MASK; - attrs.window_type = OS.GDK_WINDOW_CHILD; - attrs.visual = gdkvisual; - glWindow = OS.gdk_window_new (window, attrs, OS.GDK_WA_VISUAL); - OS.gdk_window_set_user_data (glWindow, handle); - if ((style & SWT.NO_BACKGROUND) != 0) OS.gdk_window_set_back_pixmap (window, 0, false); - xWindow = OS.gdk_x11_drawable_get_xid (glWindow); - OS.gdk_window_show (glWindow); - - Listener listener = new Listener () { - public void handleEvent (Event event) { - switch (event.type) { - case SWT.Paint: - /** - * Bug in MESA. MESA does some nasty sort of polling to try - * and ensure that their buffer sizes match the current X state. - * This state can be updated using glViewport(). - * FIXME: There has to be a better way of doing this. - */ - int [] viewport = new int [4]; - GLX.glGetIntegerv (GLX.GL_VIEWPORT, viewport); - GLX.glViewport (viewport [0],viewport [1],viewport [2],viewport [3]); - break; - case SWT.Resize: - Rectangle clientArea = getClientArea(); - OS.gdk_window_move (glWindow, clientArea.x, clientArea.y); - OS.gdk_window_resize (glWindow, clientArea.width, clientArea.height); - break; - case SWT.Dispose: - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); - int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); - if (context != 0) { - if (GLX.glXGetCurrentContext () == context) { - GLX.glXMakeCurrent (xDisplay, 0, 0); - } - GLX.glXDestroyContext (xDisplay, context); - context = 0; - } - if (glWindow != 0) { - OS.gdk_window_destroy (glWindow); - glWindow = 0; - } - break; - } - } - }; - addListener (SWT.Resize, listener); - addListener (SWT.Paint, listener); - addListener (SWT.Dispose, listener); -} - -/** - * Returns a GLData object describing the created context. - * - * @return GLData description of the OpenGL context attributes - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public GLData getGLData () { - checkWidget (); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); - int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); - GLData data = new GLData (); - int [] value = new int [1]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_DOUBLEBUFFER, value); - data.doubleBuffer = value [0] != 0; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_STEREO, value); - data.stereo = value [0] != 0; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_RED_SIZE, value); - data.redSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_GREEN_SIZE, value); - data.greenSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_BLUE_SIZE, value); - data.blueSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_ALPHA_SIZE, value); - data.alphaSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_DEPTH_SIZE, value); - data.depthSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_STENCIL_SIZE, value); - data.stencilSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_ACCUM_RED_SIZE, value); - data.accumRedSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_ACCUM_GREEN_SIZE, value); - data.accumGreenSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_ACCUM_BLUE_SIZE, value); - data.accumBlueSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_ACCUM_ALPHA_SIZE, value); - data.accumAlphaSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_SAMPLE_BUFFERS, value); - data.sampleBuffers = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_SAMPLES, value); - data.samples = value [0]; - return data; -} - -/** - * Returns a boolean indicating whether the receiver's OpenGL context - * is the current context. - * - * @return true if the receiver holds the current OpenGL context, - * false otherwise - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public boolean isCurrent () { - checkWidget (); - return GLX.glXGetCurrentContext () == context; -} - -/** - * Sets the OpenGL context associated with this GLCanvas to be the - * current GL context. - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void setCurrent () { - checkWidget (); - if (GLX.glXGetCurrentContext () == context) return; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); - int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); - GLX.glXMakeCurrent (xDisplay, xWindow, context); -} - -/** - * Swaps the front and back color buffers. - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void swapBuffers () { - checkWidget (); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); - int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); - GLX.glXSwapBuffers (xDisplay, xWindow); -} -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/motif/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/motif/org/eclipse/swt/opengl/GLCanvas.java deleted file mode 100644 index c0ce0f9e4a..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/motif/org/eclipse/swt/opengl/GLCanvas.java +++ /dev/null @@ -1,281 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.opengl; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.motif.*; -import org.eclipse.swt.internal.opengl.glx.*; - -/** - * GLCanvas is a widget capable of displaying OpenGL content. - * - * @see GLData - * @see <a href="http://www.eclipse.org/swt/snippets/#opengl">OpenGL snippets</a> - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * - * @since 3.2 - */ - -public class GLCanvas extends Canvas { - int xWindow; - int context; - int colormap; - XVisualInfo vinfo; - static final int MAX_ATTRIBUTES = 32; - -/** - * Create a GLCanvas widget using the attributes described in the GLData - * object provided. - * - * @param parent a composite widget - * @param style the bitwise OR'ing of widget styles - * @param data the requested attributes of the GLCanvas - * - * @exception IllegalArgumentException - * <ul><li>ERROR_NULL_ARGUMENT when the data is null - * <li>ERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided</ul> - * </ul> - */ -public GLCanvas (Composite parent, int style, GLData data) { - super (parent, style); - if (data == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - int glxAttrib [] = new int [MAX_ATTRIBUTES]; - int pos = 0; - glxAttrib [pos++] = GLX.GLX_RGBA; - if (data.doubleBuffer) glxAttrib [pos++] = GLX.GLX_DOUBLEBUFFER; - if (data.stereo) glxAttrib [pos++] = GLX.GLX_STEREO; - if (data.redSize > 0) { - glxAttrib [pos++] = GLX.GLX_RED_SIZE; - glxAttrib [pos++] = data.redSize; - } - if (data.greenSize > 0) { - glxAttrib [pos++] = GLX.GLX_GREEN_SIZE; - glxAttrib [pos++] = data.greenSize; - } - if (data.blueSize > 0) { - glxAttrib [pos++] = GLX.GLX_BLUE_SIZE; - glxAttrib [pos++] = data.blueSize; - } - if (data.alphaSize > 0) { - glxAttrib [pos++] = GLX.GLX_ALPHA_SIZE; - glxAttrib [pos++] = data.alphaSize; - } - if (data.depthSize > 0) { - glxAttrib [pos++] = GLX.GLX_DEPTH_SIZE; - glxAttrib [pos++] = data.depthSize; - } - if (data.stencilSize > 0) { - glxAttrib [pos++] = GLX.GLX_STENCIL_SIZE; - glxAttrib [pos++] = data.stencilSize; - } - if (data.accumRedSize > 0) { - glxAttrib [pos++] = GLX.GLX_ACCUM_RED_SIZE; - glxAttrib [pos++] = data.accumRedSize; - } - if (data.accumGreenSize > 0) { - glxAttrib [pos++] = GLX.GLX_ACCUM_GREEN_SIZE; - glxAttrib [pos++] = data.accumGreenSize; - } - if (data.accumBlueSize > 0) { - glxAttrib [pos++] = GLX.GLX_ACCUM_BLUE_SIZE; - glxAttrib [pos++] = data.accumBlueSize; - } - if (data.accumAlphaSize > 0) { - glxAttrib [pos++] = GLX.GLX_ACCUM_ALPHA_SIZE; - glxAttrib [pos++] = data.accumAlphaSize; - } - if (data.sampleBuffers > 0) { - glxAttrib [pos++] = GLX.GLX_SAMPLE_BUFFERS; - glxAttrib [pos++] = data.sampleBuffers; - } - if (data.samples > 0) { - glxAttrib [pos++] = GLX.GLX_SAMPLES; - glxAttrib [pos++] = data.samples; - } - glxAttrib [pos++] = 0; - - //FIXME - need to ensure the widget is realized at this point - new GC(this).dispose(); - - int xDisplay = OS.XtDisplay (handle); - int xScreen = OS.XDefaultScreen (xDisplay); - int infoPtr = GLX.glXChooseVisual (xDisplay, xScreen, glxAttrib); - if (infoPtr == 0) { - dispose (); - SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH); - } - vinfo = new XVisualInfo (); - GLX.memmove (vinfo, infoPtr, XVisualInfo.sizeof); - OS.XFree (infoPtr); - int /*long*/ share = data.shareContext != null ? data.shareContext.context : 0; - context = GLX.glXCreateContext (xDisplay, vinfo, share, true); - if (context == 0) SWT.error (SWT.ERROR_NO_HANDLES); - - int xParent = OS.XtWindow (handle); - XSetWindowAttributes attributes = new XSetWindowAttributes (); - int mask = OS.CWDontPropagate | OS.CWEventMask | OS.CWColormap; - colormap = OS.XCreateColormap(xDisplay, xParent, vinfo.visual, OS.AllocNone); - attributes.colormap = colormap; - xWindow = OS.XCreateWindow (xDisplay, xParent, 0, 0, 1, 1, 0, - vinfo.depth, 1, vinfo.visual, mask, attributes); - int event_mask = OS.XtBuildEventMask (handle); - /* - * Attempting to propogate EnterWindowMask and LeaveWindowMask - * causes an X error so these must be specially cleared out from - * the event mask, not included in the propogate mask. - */ - //FIXME - check this - //event_mask = event_mask | ~(OS.EnterWindowMask | OS.LeaveWindowMask); - OS.XSelectInput (xDisplay, xWindow, event_mask); - OS.XMapWindow (xDisplay, xWindow); - OS.XtRegisterDrawable (xDisplay, xWindow, handle); - - Listener listener = new Listener () { - public void handleEvent (Event event) { - int xDisplay = OS.XtDisplay (handle); - switch (event.type) { - case SWT.Paint: - /** - * Bug in MESA. MESA does some nasty sort of polling to try - * and ensure that their buffer sizes match the current X state. - * This state can be updated using glViewport(). - * FIXME: There has to be a better way of doing this. - */ - int [] viewport = new int [4]; - GLX.glGetIntegerv (GLX.GL_VIEWPORT, viewport); - GLX.glViewport (viewport [0],viewport [1],viewport [2],viewport [3]); - break; - case SWT.KeyDown: - break; - case SWT.Resize: - Rectangle clientArea = getClientArea(); - OS.XMoveResizeWindow (xDisplay, xWindow, clientArea.x, clientArea.y, clientArea.width, clientArea.height); - break; - case SWT.Dispose: - if (context != 0) { - if (GLX.glXGetCurrentContext () == context) { - GLX.glXMakeCurrent (xDisplay, 0, 0); - } - GLX.glXDestroyContext (xDisplay, context); - context = 0; - } - if (xWindow != 0) { - OS.XtUnregisterDrawable (xDisplay, xWindow); - OS.XDestroyWindow (xDisplay, xWindow); - xWindow = 0; - } - if (colormap != 0) { - OS.XFreeColormap (xDisplay, colormap); - colormap = 0; - } - break; - } - } - }; - addListener (SWT.KeyDown, listener); - addListener (SWT.Resize, listener); - addListener (SWT.Paint, listener); - addListener (SWT.Dispose, listener); -} - -/** - * Returns a GLData object describing the created context. - * - * @return GLData description of the OpenGL context attributes - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public GLData getGLData () { - checkWidget (); - int xDisplay = OS.XtDisplay (handle); - GLData data = new GLData (); - int [] value = new int [1]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_DOUBLEBUFFER, value); - data.doubleBuffer = value [0] != 0; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_STEREO, value); - data.stereo = value [0] != 0; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_RED_SIZE, value); - data.redSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_GREEN_SIZE, value); - data.greenSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_BLUE_SIZE, value); - data.blueSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_ALPHA_SIZE, value); - data.alphaSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_DEPTH_SIZE, value); - data.depthSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_STENCIL_SIZE, value); - data.stencilSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_ACCUM_RED_SIZE, value); - data.accumRedSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_ACCUM_GREEN_SIZE, value); - data.accumGreenSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_ACCUM_BLUE_SIZE, value); - data.accumBlueSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_ACCUM_ALPHA_SIZE, value); - data.accumAlphaSize = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_SAMPLE_BUFFERS, value); - data.sampleBuffers = value [0]; - GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_SAMPLES, value); - data.samples = value [0]; - return data; -} - -/** - * Returns a boolean indicating whether the receiver's OpenGL context - * is the current context. - * - * @return true if the receiver holds the current OpenGL context, - * false otherwise - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public boolean isCurrent () { - checkWidget (); - return GLX.glXGetCurrentContext () == context; -} - -/** - * Sets the OpenGL context associated with this GLCanvas to be the - * current GL context. - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void setCurrent () { - checkWidget (); - if (GLX.glXGetCurrentContext () == context) return; - int xDisplay = OS.XtDisplay (handle); - GLX.glXMakeCurrent (xDisplay, xWindow, context); -} - -/** - * Swaps the front and back color buffers. - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void swapBuffers () { - checkWidget (); - int xDisplay = OS.XtDisplay (handle); - GLX.glXSwapBuffers (xDisplay, xWindow); -} -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/swt_wgl.rc b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/swt_wgl.rc deleted file mode 100644 index e46095f457..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/swt_wgl.rc +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "windows.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION SWT_COMMA_VERSION - PRODUCTVERSION 0,0,0,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40000L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "Eclipse Foundation\0" - VALUE "FileDescription", "SWT for Windows native library\0" - VALUE "FileVersion", SWT_FILE_VERSION - VALUE "InternalName", "SWT\0" - VALUE "LegalCopyright", "Copyright (c) 2000, 2006 IBM Corp. All Rights Reserved.\0" - VALUE "OriginalFilename", SWT_ORG_FILENAME - VALUE "ProductName", "Standard Widget Toolkit\0" - VALUE "ProductVersion", "0,0,0,0\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl.c b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl.c deleted file mode 100644 index 85eed92707..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl.c +++ /dev/null @@ -1,273 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "wgl_structs.h" -#include "wgl_stats.h" - -#define WGL_NATIVE(func) Java_org_eclipse_swt_internal_opengl_win32_WGL_##func - -#ifndef NO_ChoosePixelFormat -JNIEXPORT jint JNICALL WGL_NATIVE(ChoosePixelFormat) - (JNIEnv *env, jclass that, jintLong arg0, jobject arg1) -{ - PIXELFORMATDESCRIPTOR _arg1, *lparg1=NULL; - jint rc = 0; - WGL_NATIVE_ENTER(env, that, ChoosePixelFormat_FUNC); - if (arg1) if ((lparg1 = getPIXELFORMATDESCRIPTORFields(env, arg1, &_arg1)) == NULL) goto fail; - rc = (jint)ChoosePixelFormat((HDC)arg0, lparg1); -fail: - if (arg1 && lparg1) setPIXELFORMATDESCRIPTORFields(env, arg1, lparg1); - WGL_NATIVE_EXIT(env, that, ChoosePixelFormat_FUNC); - return rc; -} -#endif - -#ifndef NO_DescribePixelFormat -JNIEXPORT jint JNICALL WGL_NATIVE(DescribePixelFormat) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jobject arg3) -{ - PIXELFORMATDESCRIPTOR _arg3, *lparg3=NULL; - jint rc = 0; - WGL_NATIVE_ENTER(env, that, DescribePixelFormat_FUNC); - if (arg3) if ((lparg3 = getPIXELFORMATDESCRIPTORFields(env, arg3, &_arg3)) == NULL) goto fail; - rc = (jint)DescribePixelFormat((HDC)arg0, arg1, arg2, lparg3); -fail: - if (arg3 && lparg3) setPIXELFORMATDESCRIPTORFields(env, arg3, lparg3); - WGL_NATIVE_EXIT(env, that, DescribePixelFormat_FUNC); - return rc; -} -#endif - -#ifndef NO_GetPixelFormat -JNIEXPORT jint JNICALL WGL_NATIVE(GetPixelFormat) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jint rc = 0; - WGL_NATIVE_ENTER(env, that, GetPixelFormat_FUNC); - rc = (jint)GetPixelFormat((HDC)arg0); - WGL_NATIVE_EXIT(env, that, GetPixelFormat_FUNC); - return rc; -} -#endif - -#ifndef NO_SetPixelFormat -JNIEXPORT jboolean JNICALL WGL_NATIVE(SetPixelFormat) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2) -{ - PIXELFORMATDESCRIPTOR _arg2, *lparg2=NULL; - jboolean rc = 0; - WGL_NATIVE_ENTER(env, that, SetPixelFormat_FUNC); - if (arg2) if ((lparg2 = getPIXELFORMATDESCRIPTORFields(env, arg2, &_arg2)) == NULL) goto fail; - rc = (jboolean)SetPixelFormat((HDC)arg0, arg1, lparg2); -fail: - if (arg2 && lparg2) setPIXELFORMATDESCRIPTORFields(env, arg2, lparg2); - WGL_NATIVE_EXIT(env, that, SetPixelFormat_FUNC); - return rc; -} -#endif - -#ifndef NO_SwapBuffers -JNIEXPORT jboolean JNICALL WGL_NATIVE(SwapBuffers) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jboolean rc = 0; - WGL_NATIVE_ENTER(env, that, SwapBuffers_FUNC); - rc = (jboolean)SwapBuffers((HDC)arg0); - WGL_NATIVE_EXIT(env, that, SwapBuffers_FUNC); - return rc; -} -#endif - -#ifndef NO_wglCopyContext -JNIEXPORT jboolean JNICALL WGL_NATIVE(wglCopyContext) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2) -{ - jboolean rc = 0; - WGL_NATIVE_ENTER(env, that, wglCopyContext_FUNC); - rc = (jboolean)wglCopyContext((HGLRC)arg0, (HGLRC)arg1, arg2); - WGL_NATIVE_EXIT(env, that, wglCopyContext_FUNC); - return rc; -} -#endif - -#ifndef NO_wglCreateContext -JNIEXPORT jintLong JNICALL WGL_NATIVE(wglCreateContext) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jintLong rc = 0; - WGL_NATIVE_ENTER(env, that, wglCreateContext_FUNC); - rc = (jintLong)wglCreateContext((HDC)arg0); - WGL_NATIVE_EXIT(env, that, wglCreateContext_FUNC); - return rc; -} -#endif - -#ifndef NO_wglCreateLayerContext -JNIEXPORT jintLong JNICALL WGL_NATIVE(wglCreateLayerContext) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1) -{ - jintLong rc = 0; - WGL_NATIVE_ENTER(env, that, wglCreateLayerContext_FUNC); - rc = (jintLong)wglCreateLayerContext((HDC)arg0, arg1); - WGL_NATIVE_EXIT(env, that, wglCreateLayerContext_FUNC); - return rc; -} -#endif - -#ifndef NO_wglDeleteContext -JNIEXPORT jboolean JNICALL WGL_NATIVE(wglDeleteContext) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jboolean rc = 0; - WGL_NATIVE_ENTER(env, that, wglDeleteContext_FUNC); - rc = (jboolean)wglDeleteContext((HGLRC)arg0); - WGL_NATIVE_EXIT(env, that, wglDeleteContext_FUNC); - return rc; -} -#endif - -#ifndef NO_wglDescribeLayerPlane -JNIEXPORT jboolean JNICALL WGL_NATIVE(wglDescribeLayerPlane) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jint arg3, jobject arg4) -{ - LAYERPLANEDESCRIPTOR _arg4, *lparg4=NULL; - jboolean rc = 0; - WGL_NATIVE_ENTER(env, that, wglDescribeLayerPlane_FUNC); - if (arg4) if ((lparg4 = getLAYERPLANEDESCRIPTORFields(env, arg4, &_arg4)) == NULL) goto fail; - rc = (jboolean)wglDescribeLayerPlane((HDC)arg0, arg1, arg2, arg3, lparg4); -fail: - if (arg4 && lparg4) setLAYERPLANEDESCRIPTORFields(env, arg4, lparg4); - WGL_NATIVE_EXIT(env, that, wglDescribeLayerPlane_FUNC); - return rc; -} -#endif - -#ifndef NO_wglGetCurrentContext -JNIEXPORT jintLong JNICALL WGL_NATIVE(wglGetCurrentContext) - (JNIEnv *env, jclass that) -{ - jintLong rc = 0; - WGL_NATIVE_ENTER(env, that, wglGetCurrentContext_FUNC); - rc = (jintLong)wglGetCurrentContext(); - WGL_NATIVE_EXIT(env, that, wglGetCurrentContext_FUNC); - return rc; -} -#endif - -#ifndef NO_wglGetCurrentDC -JNIEXPORT jintLong JNICALL WGL_NATIVE(wglGetCurrentDC) - (JNIEnv *env, jclass that) -{ - jintLong rc = 0; - WGL_NATIVE_ENTER(env, that, wglGetCurrentDC_FUNC); - rc = (jintLong)wglGetCurrentDC(); - WGL_NATIVE_EXIT(env, that, wglGetCurrentDC_FUNC); - return rc; -} -#endif - -#ifndef NO_wglGetLayerPaletteEntries -JNIEXPORT jint JNICALL WGL_NATIVE(wglGetLayerPaletteEntries) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jint arg3, jintArray arg4) -{ - jint *lparg4=NULL; - jint rc = 0; - WGL_NATIVE_ENTER(env, that, wglGetLayerPaletteEntries_FUNC); - if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail; - rc = (jint)wglGetLayerPaletteEntries((HDC)arg0, arg1, arg2, arg3, (COLORREF *)lparg4); -fail: - if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); - WGL_NATIVE_EXIT(env, that, wglGetLayerPaletteEntries_FUNC); - return rc; -} -#endif - -#ifndef NO_wglGetProcAddress -JNIEXPORT jintLong JNICALL WGL_NATIVE(wglGetProcAddress) - (JNIEnv *env, jclass that, jbyteArray arg0) -{ - jbyte *lparg0=NULL; - jintLong rc = 0; - WGL_NATIVE_ENTER(env, that, wglGetProcAddress_FUNC); - if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; - rc = (jintLong)wglGetProcAddress(lparg0); -fail: - if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - WGL_NATIVE_EXIT(env, that, wglGetProcAddress_FUNC); - return rc; -} -#endif - -#ifndef NO_wglMakeCurrent -JNIEXPORT jboolean JNICALL WGL_NATIVE(wglMakeCurrent) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) -{ - jboolean rc = 0; - WGL_NATIVE_ENTER(env, that, wglMakeCurrent_FUNC); - rc = (jboolean)wglMakeCurrent((HDC)arg0, (HGLRC)arg1); - WGL_NATIVE_EXIT(env, that, wglMakeCurrent_FUNC); - return rc; -} -#endif - -#ifndef NO_wglRealizeLayerPalette -JNIEXPORT jboolean JNICALL WGL_NATIVE(wglRealizeLayerPalette) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jboolean arg2) -{ - jboolean rc = 0; - WGL_NATIVE_ENTER(env, that, wglRealizeLayerPalette_FUNC); - rc = (jboolean)wglRealizeLayerPalette((HDC)arg0, arg1, arg2); - WGL_NATIVE_EXIT(env, that, wglRealizeLayerPalette_FUNC); - return rc; -} -#endif - -#ifndef NO_wglSetLayerPaletteEntries -JNIEXPORT jint JNICALL WGL_NATIVE(wglSetLayerPaletteEntries) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jint arg3, jintArray arg4) -{ - jint *lparg4=NULL; - jint rc = 0; - WGL_NATIVE_ENTER(env, that, wglSetLayerPaletteEntries_FUNC); - if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail; - rc = (jint)wglSetLayerPaletteEntries((HDC)arg0, arg1, arg2, arg3, (COLORREF *)lparg4); -fail: - if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); - WGL_NATIVE_EXIT(env, that, wglSetLayerPaletteEntries_FUNC); - return rc; -} -#endif - -#ifndef NO_wglShareLists -JNIEXPORT jboolean JNICALL WGL_NATIVE(wglShareLists) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) -{ - jboolean rc = 0; - WGL_NATIVE_ENTER(env, that, wglShareLists_FUNC); - rc = (jboolean)wglShareLists((HGLRC)arg0, (HGLRC)arg1); - WGL_NATIVE_EXIT(env, that, wglShareLists_FUNC); - return rc; -} -#endif - -#ifndef NO_wglSwapLayerBuffers -JNIEXPORT jboolean JNICALL WGL_NATIVE(wglSwapLayerBuffers) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1) -{ - jboolean rc = 0; - WGL_NATIVE_ENTER(env, that, wglSwapLayerBuffers_FUNC); - rc = (jboolean)wglSwapLayerBuffers((HDC)arg0, arg1); - WGL_NATIVE_EXIT(env, that, wglSwapLayerBuffers_FUNC); - return rc; -} -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl.h b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl.h deleted file mode 100644 index 7a65730562..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl.h +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#ifndef SWT_WGL_H_INCLUDED -#define SWT_WGL_H_INCLUDED - -#include <windows.h> -#include <winuser.h> -#include <commctrl.h> -#include <commdlg.h> -#include <oaidl.h> -#include <shlobj.h> -#include <ole2.h> -#include <olectl.h> -#include <objbase.h> -#include <shlwapi.h> -#include <shellapi.h> -#include <wingdi.h> - -#endif /* SWT_WGL_H_INCLUDED */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl_stats.c b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl_stats.c deleted file mode 100644 index cb879220c0..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl_stats.c +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "wgl_stats.h" - -#ifdef NATIVE_STATS - -int WGL_nativeFunctionCount = 19; -int WGL_nativeFunctionCallCount[19]; -char * WGL_nativeFunctionNames[] = { - "ChoosePixelFormat", - "DescribePixelFormat", - "GetPixelFormat", - "SetPixelFormat", - "SwapBuffers", - "wglCopyContext", - "wglCreateContext", - "wglCreateLayerContext", - "wglDeleteContext", - "wglDescribeLayerPlane", - "wglGetCurrentContext", - "wglGetCurrentDC", - "wglGetLayerPaletteEntries", - "wglGetProcAddress", - "wglMakeCurrent", - "wglRealizeLayerPalette", - "wglSetLayerPaletteEntries", - "wglShareLists", - "wglSwapLayerBuffers", -}; - -#define STATS_NATIVE(func) Java_org_eclipse_swt_tools_internal_NativeStats_##func - -JNIEXPORT jint JNICALL STATS_NATIVE(WGL_1GetFunctionCount) - (JNIEnv *env, jclass that) -{ - return WGL_nativeFunctionCount; -} - -JNIEXPORT jstring JNICALL STATS_NATIVE(WGL_1GetFunctionName) - (JNIEnv *env, jclass that, jint index) -{ - return (*env)->NewStringUTF(env, WGL_nativeFunctionNames[index]); -} - -JNIEXPORT jint JNICALL STATS_NATIVE(WGL_1GetFunctionCallCount) - (JNIEnv *env, jclass that, jint index) -{ - return WGL_nativeFunctionCallCount[index]; -} - -#endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl_stats.h b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl_stats.h deleted file mode 100644 index c6a9c4f741..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl_stats.h +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#ifdef NATIVE_STATS -extern int WGL_nativeFunctionCount; -extern int WGL_nativeFunctionCallCount[]; -extern char* WGL_nativeFunctionNames[]; -#define WGL_NATIVE_ENTER(env, that, func) WGL_nativeFunctionCallCount[func]++; -#define WGL_NATIVE_EXIT(env, that, func) -#else -#ifndef WGL_NATIVE_ENTER -#define WGL_NATIVE_ENTER(env, that, func) -#endif -#ifndef WGL_NATIVE_EXIT -#define WGL_NATIVE_EXIT(env, that, func) -#endif -#endif - -typedef enum { - ChoosePixelFormat_FUNC, - DescribePixelFormat_FUNC, - GetPixelFormat_FUNC, - SetPixelFormat_FUNC, - SwapBuffers_FUNC, - wglCopyContext_FUNC, - wglCreateContext_FUNC, - wglCreateLayerContext_FUNC, - wglDeleteContext_FUNC, - wglDescribeLayerPlane_FUNC, - wglGetCurrentContext_FUNC, - wglGetCurrentDC_FUNC, - wglGetLayerPaletteEntries_FUNC, - wglGetProcAddress_FUNC, - wglMakeCurrent_FUNC, - wglRealizeLayerPalette_FUNC, - wglSetLayerPaletteEntries_FUNC, - wglShareLists_FUNC, - wglSwapLayerBuffers_FUNC, -} WGL_FUNCS; diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl_structs.c b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl_structs.c deleted file mode 100644 index 3f0bbcb428..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl_structs.c +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "wgl_structs.h" - -#ifndef NO_LAYERPLANEDESCRIPTOR -typedef struct LAYERPLANEDESCRIPTOR_FID_CACHE { - int cached; - jclass clazz; - jfieldID nSize, nVersion, dwFlags, iPixelType, cColorBits, cRedBits, cRedShift, cGreenBits, cGreenShift, cBlueBits, cBlueShift, cAlphaBits, cAlphaShift, cAccumBits, cAccumRedBits, cAccumGreenBits, cAccumBlueBits, cAccumAlphaBits, cDepthBits, cStencilBits, cAuxBuffers, iLayerPlane, bReserved, crTransparent; -} LAYERPLANEDESCRIPTOR_FID_CACHE; - -LAYERPLANEDESCRIPTOR_FID_CACHE LAYERPLANEDESCRIPTORFc; - -void cacheLAYERPLANEDESCRIPTORFields(JNIEnv *env, jobject lpObject) -{ - if (LAYERPLANEDESCRIPTORFc.cached) return; - LAYERPLANEDESCRIPTORFc.clazz = (*env)->GetObjectClass(env, lpObject); - LAYERPLANEDESCRIPTORFc.nSize = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "nSize", "S"); - LAYERPLANEDESCRIPTORFc.nVersion = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "nVersion", "S"); - LAYERPLANEDESCRIPTORFc.dwFlags = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "dwFlags", "I"); - LAYERPLANEDESCRIPTORFc.iPixelType = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "iPixelType", "B"); - LAYERPLANEDESCRIPTORFc.cColorBits = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cColorBits", "B"); - LAYERPLANEDESCRIPTORFc.cRedBits = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cRedBits", "B"); - LAYERPLANEDESCRIPTORFc.cRedShift = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cRedShift", "B"); - LAYERPLANEDESCRIPTORFc.cGreenBits = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cGreenBits", "B"); - LAYERPLANEDESCRIPTORFc.cGreenShift = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cGreenShift", "B"); - LAYERPLANEDESCRIPTORFc.cBlueBits = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cBlueBits", "B"); - LAYERPLANEDESCRIPTORFc.cBlueShift = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cBlueShift", "B"); - LAYERPLANEDESCRIPTORFc.cAlphaBits = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cAlphaBits", "B"); - LAYERPLANEDESCRIPTORFc.cAlphaShift = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cAlphaShift", "B"); - LAYERPLANEDESCRIPTORFc.cAccumBits = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cAccumBits", "B"); - LAYERPLANEDESCRIPTORFc.cAccumRedBits = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cAccumRedBits", "B"); - LAYERPLANEDESCRIPTORFc.cAccumGreenBits = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cAccumGreenBits", "B"); - LAYERPLANEDESCRIPTORFc.cAccumBlueBits = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cAccumBlueBits", "B"); - LAYERPLANEDESCRIPTORFc.cAccumAlphaBits = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cAccumAlphaBits", "B"); - LAYERPLANEDESCRIPTORFc.cDepthBits = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cDepthBits", "B"); - LAYERPLANEDESCRIPTORFc.cStencilBits = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cStencilBits", "B"); - LAYERPLANEDESCRIPTORFc.cAuxBuffers = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "cAuxBuffers", "B"); - LAYERPLANEDESCRIPTORFc.iLayerPlane = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "iLayerPlane", "B"); - LAYERPLANEDESCRIPTORFc.bReserved = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "bReserved", "B"); - LAYERPLANEDESCRIPTORFc.crTransparent = (*env)->GetFieldID(env, LAYERPLANEDESCRIPTORFc.clazz, "crTransparent", "I"); - LAYERPLANEDESCRIPTORFc.cached = 1; -} - -LAYERPLANEDESCRIPTOR *getLAYERPLANEDESCRIPTORFields(JNIEnv *env, jobject lpObject, LAYERPLANEDESCRIPTOR *lpStruct) -{ - if (!LAYERPLANEDESCRIPTORFc.cached) cacheLAYERPLANEDESCRIPTORFields(env, lpObject); - lpStruct->nSize = (*env)->GetShortField(env, lpObject, LAYERPLANEDESCRIPTORFc.nSize); - lpStruct->nVersion = (*env)->GetShortField(env, lpObject, LAYERPLANEDESCRIPTORFc.nVersion); - lpStruct->dwFlags = (*env)->GetIntField(env, lpObject, LAYERPLANEDESCRIPTORFc.dwFlags); - lpStruct->iPixelType = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.iPixelType); - lpStruct->cColorBits = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cColorBits); - lpStruct->cRedBits = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cRedBits); - lpStruct->cRedShift = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cRedShift); - lpStruct->cGreenBits = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cGreenBits); - lpStruct->cGreenShift = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cGreenShift); - lpStruct->cBlueBits = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cBlueBits); - lpStruct->cBlueShift = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cBlueShift); - lpStruct->cAlphaBits = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAlphaBits); - lpStruct->cAlphaShift = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAlphaShift); - lpStruct->cAccumBits = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAccumBits); - lpStruct->cAccumRedBits = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAccumRedBits); - lpStruct->cAccumGreenBits = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAccumGreenBits); - lpStruct->cAccumBlueBits = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAccumBlueBits); - lpStruct->cAccumAlphaBits = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAccumAlphaBits); - lpStruct->cDepthBits = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cDepthBits); - lpStruct->cStencilBits = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cStencilBits); - lpStruct->cAuxBuffers = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAuxBuffers); - lpStruct->iLayerPlane = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.iLayerPlane); - lpStruct->bReserved = (*env)->GetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.bReserved); - lpStruct->crTransparent = (*env)->GetIntField(env, lpObject, LAYERPLANEDESCRIPTORFc.crTransparent); - return lpStruct; -} - -void setLAYERPLANEDESCRIPTORFields(JNIEnv *env, jobject lpObject, LAYERPLANEDESCRIPTOR *lpStruct) -{ - if (!LAYERPLANEDESCRIPTORFc.cached) cacheLAYERPLANEDESCRIPTORFields(env, lpObject); - (*env)->SetShortField(env, lpObject, LAYERPLANEDESCRIPTORFc.nSize, (jshort)lpStruct->nSize); - (*env)->SetShortField(env, lpObject, LAYERPLANEDESCRIPTORFc.nVersion, (jshort)lpStruct->nVersion); - (*env)->SetIntField(env, lpObject, LAYERPLANEDESCRIPTORFc.dwFlags, (jint)lpStruct->dwFlags); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.iPixelType, (jbyte)lpStruct->iPixelType); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cColorBits, (jbyte)lpStruct->cColorBits); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cRedBits, (jbyte)lpStruct->cRedBits); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cRedShift, (jbyte)lpStruct->cRedShift); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cGreenBits, (jbyte)lpStruct->cGreenBits); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cGreenShift, (jbyte)lpStruct->cGreenShift); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cBlueBits, (jbyte)lpStruct->cBlueBits); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cBlueShift, (jbyte)lpStruct->cBlueShift); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAlphaBits, (jbyte)lpStruct->cAlphaBits); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAlphaShift, (jbyte)lpStruct->cAlphaShift); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAccumBits, (jbyte)lpStruct->cAccumBits); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAccumRedBits, (jbyte)lpStruct->cAccumRedBits); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAccumGreenBits, (jbyte)lpStruct->cAccumGreenBits); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAccumBlueBits, (jbyte)lpStruct->cAccumBlueBits); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAccumAlphaBits, (jbyte)lpStruct->cAccumAlphaBits); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cDepthBits, (jbyte)lpStruct->cDepthBits); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cStencilBits, (jbyte)lpStruct->cStencilBits); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.cAuxBuffers, (jbyte)lpStruct->cAuxBuffers); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.iLayerPlane, (jbyte)lpStruct->iLayerPlane); - (*env)->SetByteField(env, lpObject, LAYERPLANEDESCRIPTORFc.bReserved, (jbyte)lpStruct->bReserved); - (*env)->SetIntField(env, lpObject, LAYERPLANEDESCRIPTORFc.crTransparent, (jint)lpStruct->crTransparent); -} -#endif - -#ifndef NO_PIXELFORMATDESCRIPTOR -typedef struct PIXELFORMATDESCRIPTOR_FID_CACHE { - int cached; - jclass clazz; - jfieldID nSize, nVersion, dwFlags, iPixelType, cColorBits, cRedBits, cRedShift, cGreenBits, cGreenShift, cBlueBits, cBlueShift, cAlphaBits, cAlphaShift, cAccumBits, cAccumRedBits, cAccumGreenBits, cAccumBlueBits, cAccumAlphaBits, cDepthBits, cStencilBits, cAuxBuffers, iLayerType, bReserved, dwLayerMask, dwVisibleMask, dwDamageMask; -} PIXELFORMATDESCRIPTOR_FID_CACHE; - -PIXELFORMATDESCRIPTOR_FID_CACHE PIXELFORMATDESCRIPTORFc; - -void cachePIXELFORMATDESCRIPTORFields(JNIEnv *env, jobject lpObject) -{ - if (PIXELFORMATDESCRIPTORFc.cached) return; - PIXELFORMATDESCRIPTORFc.clazz = (*env)->GetObjectClass(env, lpObject); - PIXELFORMATDESCRIPTORFc.nSize = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "nSize", "S"); - PIXELFORMATDESCRIPTORFc.nVersion = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "nVersion", "S"); - PIXELFORMATDESCRIPTORFc.dwFlags = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "dwFlags", "I"); - PIXELFORMATDESCRIPTORFc.iPixelType = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "iPixelType", "B"); - PIXELFORMATDESCRIPTORFc.cColorBits = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cColorBits", "B"); - PIXELFORMATDESCRIPTORFc.cRedBits = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cRedBits", "B"); - PIXELFORMATDESCRIPTORFc.cRedShift = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cRedShift", "B"); - PIXELFORMATDESCRIPTORFc.cGreenBits = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cGreenBits", "B"); - PIXELFORMATDESCRIPTORFc.cGreenShift = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cGreenShift", "B"); - PIXELFORMATDESCRIPTORFc.cBlueBits = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cBlueBits", "B"); - PIXELFORMATDESCRIPTORFc.cBlueShift = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cBlueShift", "B"); - PIXELFORMATDESCRIPTORFc.cAlphaBits = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cAlphaBits", "B"); - PIXELFORMATDESCRIPTORFc.cAlphaShift = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cAlphaShift", "B"); - PIXELFORMATDESCRIPTORFc.cAccumBits = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cAccumBits", "B"); - PIXELFORMATDESCRIPTORFc.cAccumRedBits = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cAccumRedBits", "B"); - PIXELFORMATDESCRIPTORFc.cAccumGreenBits = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cAccumGreenBits", "B"); - PIXELFORMATDESCRIPTORFc.cAccumBlueBits = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cAccumBlueBits", "B"); - PIXELFORMATDESCRIPTORFc.cAccumAlphaBits = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cAccumAlphaBits", "B"); - PIXELFORMATDESCRIPTORFc.cDepthBits = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cDepthBits", "B"); - PIXELFORMATDESCRIPTORFc.cStencilBits = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cStencilBits", "B"); - PIXELFORMATDESCRIPTORFc.cAuxBuffers = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "cAuxBuffers", "B"); - PIXELFORMATDESCRIPTORFc.iLayerType = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "iLayerType", "B"); - PIXELFORMATDESCRIPTORFc.bReserved = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "bReserved", "B"); - PIXELFORMATDESCRIPTORFc.dwLayerMask = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "dwLayerMask", "I"); - PIXELFORMATDESCRIPTORFc.dwVisibleMask = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "dwVisibleMask", "I"); - PIXELFORMATDESCRIPTORFc.dwDamageMask = (*env)->GetFieldID(env, PIXELFORMATDESCRIPTORFc.clazz, "dwDamageMask", "I"); - PIXELFORMATDESCRIPTORFc.cached = 1; -} - -PIXELFORMATDESCRIPTOR *getPIXELFORMATDESCRIPTORFields(JNIEnv *env, jobject lpObject, PIXELFORMATDESCRIPTOR *lpStruct) -{ - if (!PIXELFORMATDESCRIPTORFc.cached) cachePIXELFORMATDESCRIPTORFields(env, lpObject); - lpStruct->nSize = (*env)->GetShortField(env, lpObject, PIXELFORMATDESCRIPTORFc.nSize); - lpStruct->nVersion = (*env)->GetShortField(env, lpObject, PIXELFORMATDESCRIPTORFc.nVersion); - lpStruct->dwFlags = (*env)->GetIntField(env, lpObject, PIXELFORMATDESCRIPTORFc.dwFlags); - lpStruct->iPixelType = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.iPixelType); - lpStruct->cColorBits = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cColorBits); - lpStruct->cRedBits = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cRedBits); - lpStruct->cRedShift = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cRedShift); - lpStruct->cGreenBits = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cGreenBits); - lpStruct->cGreenShift = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cGreenShift); - lpStruct->cBlueBits = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cBlueBits); - lpStruct->cBlueShift = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cBlueShift); - lpStruct->cAlphaBits = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAlphaBits); - lpStruct->cAlphaShift = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAlphaShift); - lpStruct->cAccumBits = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAccumBits); - lpStruct->cAccumRedBits = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAccumRedBits); - lpStruct->cAccumGreenBits = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAccumGreenBits); - lpStruct->cAccumBlueBits = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAccumBlueBits); - lpStruct->cAccumAlphaBits = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAccumAlphaBits); - lpStruct->cDepthBits = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cDepthBits); - lpStruct->cStencilBits = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cStencilBits); - lpStruct->cAuxBuffers = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAuxBuffers); - lpStruct->iLayerType = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.iLayerType); - lpStruct->bReserved = (*env)->GetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.bReserved); - lpStruct->dwLayerMask = (*env)->GetIntField(env, lpObject, PIXELFORMATDESCRIPTORFc.dwLayerMask); - lpStruct->dwVisibleMask = (*env)->GetIntField(env, lpObject, PIXELFORMATDESCRIPTORFc.dwVisibleMask); - lpStruct->dwDamageMask = (*env)->GetIntField(env, lpObject, PIXELFORMATDESCRIPTORFc.dwDamageMask); - return lpStruct; -} - -void setPIXELFORMATDESCRIPTORFields(JNIEnv *env, jobject lpObject, PIXELFORMATDESCRIPTOR *lpStruct) -{ - if (!PIXELFORMATDESCRIPTORFc.cached) cachePIXELFORMATDESCRIPTORFields(env, lpObject); - (*env)->SetShortField(env, lpObject, PIXELFORMATDESCRIPTORFc.nSize, (jshort)lpStruct->nSize); - (*env)->SetShortField(env, lpObject, PIXELFORMATDESCRIPTORFc.nVersion, (jshort)lpStruct->nVersion); - (*env)->SetIntField(env, lpObject, PIXELFORMATDESCRIPTORFc.dwFlags, (jint)lpStruct->dwFlags); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.iPixelType, (jbyte)lpStruct->iPixelType); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cColorBits, (jbyte)lpStruct->cColorBits); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cRedBits, (jbyte)lpStruct->cRedBits); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cRedShift, (jbyte)lpStruct->cRedShift); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cGreenBits, (jbyte)lpStruct->cGreenBits); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cGreenShift, (jbyte)lpStruct->cGreenShift); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cBlueBits, (jbyte)lpStruct->cBlueBits); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cBlueShift, (jbyte)lpStruct->cBlueShift); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAlphaBits, (jbyte)lpStruct->cAlphaBits); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAlphaShift, (jbyte)lpStruct->cAlphaShift); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAccumBits, (jbyte)lpStruct->cAccumBits); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAccumRedBits, (jbyte)lpStruct->cAccumRedBits); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAccumGreenBits, (jbyte)lpStruct->cAccumGreenBits); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAccumBlueBits, (jbyte)lpStruct->cAccumBlueBits); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAccumAlphaBits, (jbyte)lpStruct->cAccumAlphaBits); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cDepthBits, (jbyte)lpStruct->cDepthBits); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cStencilBits, (jbyte)lpStruct->cStencilBits); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.cAuxBuffers, (jbyte)lpStruct->cAuxBuffers); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.iLayerType, (jbyte)lpStruct->iLayerType); - (*env)->SetByteField(env, lpObject, PIXELFORMATDESCRIPTORFc.bReserved, (jbyte)lpStruct->bReserved); - (*env)->SetIntField(env, lpObject, PIXELFORMATDESCRIPTORFc.dwLayerMask, (jint)lpStruct->dwLayerMask); - (*env)->SetIntField(env, lpObject, PIXELFORMATDESCRIPTORFc.dwVisibleMask, (jint)lpStruct->dwVisibleMask); - (*env)->SetIntField(env, lpObject, PIXELFORMATDESCRIPTORFc.dwDamageMask, (jint)lpStruct->dwDamageMask); -} -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl_structs.h b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl_structs.h deleted file mode 100644 index a656f5445d..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library/wgl_structs.h +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "wgl.h" - -#ifndef NO_LAYERPLANEDESCRIPTOR -void cacheLAYERPLANEDESCRIPTORFields(JNIEnv *env, jobject lpObject); -LAYERPLANEDESCRIPTOR *getLAYERPLANEDESCRIPTORFields(JNIEnv *env, jobject lpObject, LAYERPLANEDESCRIPTOR *lpStruct); -void setLAYERPLANEDESCRIPTORFields(JNIEnv *env, jobject lpObject, LAYERPLANEDESCRIPTOR *lpStruct); -#define LAYERPLANEDESCRIPTOR_sizeof() sizeof(LAYERPLANEDESCRIPTOR) -#else -#define cacheLAYERPLANEDESCRIPTORFields(a,b) -#define getLAYERPLANEDESCRIPTORFields(a,b,c) NULL -#define setLAYERPLANEDESCRIPTORFields(a,b,c) -#define LAYERPLANEDESCRIPTOR_sizeof() 0 -#endif - -#ifndef NO_PIXELFORMATDESCRIPTOR -void cachePIXELFORMATDESCRIPTORFields(JNIEnv *env, jobject lpObject); -PIXELFORMATDESCRIPTOR *getPIXELFORMATDESCRIPTORFields(JNIEnv *env, jobject lpObject, PIXELFORMATDESCRIPTOR *lpStruct); -void setPIXELFORMATDESCRIPTORFields(JNIEnv *env, jobject lpObject, PIXELFORMATDESCRIPTOR *lpStruct); -#define PIXELFORMATDESCRIPTOR_sizeof() sizeof(PIXELFORMATDESCRIPTOR) -#else -#define cachePIXELFORMATDESCRIPTORFields(a,b) -#define getPIXELFORMATDESCRIPTORFields(a,b,c) NULL -#define setPIXELFORMATDESCRIPTORFields(a,b,c) -#define PIXELFORMATDESCRIPTOR_sizeof() 0 -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/internal/opengl/win32/LAYERPLANEDESCRIPTOR.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/internal/opengl/win32/LAYERPLANEDESCRIPTOR.java deleted file mode 100755 index 49d2361d76..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/internal/opengl/win32/LAYERPLANEDESCRIPTOR.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.internal.opengl.win32; - - -public class LAYERPLANEDESCRIPTOR { - public short nSize; - public short nVersion; - public int dwFlags; - public byte iPixelType; - public byte cColorBits; - public byte cRedBits; - public byte cRedShift; - public byte cGreenBits; - public byte cGreenShift; - public byte cBlueBits; - public byte cBlueShift; - public byte cAlphaBits; - public byte cAlphaShift; - public byte cAccumBits; - public byte cAccumRedBits; - public byte cAccumGreenBits; - public byte cAccumBlueBits; - public byte cAccumAlphaBits; - public byte cDepthBits; - public byte cStencilBits; - public byte cAuxBuffers; - public byte iLayerPlane; - public byte bReserved; - public int crTransparent; - public static final int sizeof = 36; -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/internal/opengl/win32/PIXELFORMATDESCRIPTOR.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/internal/opengl/win32/PIXELFORMATDESCRIPTOR.java deleted file mode 100755 index 29024643b1..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/internal/opengl/win32/PIXELFORMATDESCRIPTOR.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.internal.opengl.win32; - - -public class PIXELFORMATDESCRIPTOR { - public short nSize; - public short nVersion; - public int dwFlags; - public byte iPixelType; - public byte cColorBits; - public byte cRedBits; - public byte cRedShift; - public byte cGreenBits; - public byte cGreenShift; - public byte cBlueBits; - public byte cBlueShift; - public byte cAlphaBits; - public byte cAlphaShift; - public byte cAccumBits; - public byte cAccumRedBits; - public byte cAccumGreenBits; - public byte cAccumBlueBits; - public byte cAccumAlphaBits; - public byte cDepthBits; - public byte cStencilBits; - public byte cAuxBuffers; - public byte iLayerType; - public byte bReserved; - public int dwLayerMask; - public int dwVisibleMask; - public int dwDamageMask; - public static final int sizeof = 40; -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/internal/opengl/win32/WGL.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/internal/opengl/win32/WGL.java deleted file mode 100755 index 4904161221..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/internal/opengl/win32/WGL.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.internal.opengl.win32; - -import org.eclipse.swt.internal.*; - -public class WGL extends Platform { - static { - Library.loadLibrary("swt-wgl"); - } - - public static final int WGL_FONT_LINES = 0; - public static final int WGL_FONT_POLYGONS = 1; - - /* LAYERPLANEDESCRIPTOR flags */ - public static final int LPD_DOUBLEBUFFER = 0x00000001; - public static final int LPD_STEREO = 0x00000002; - public static final int LPD_SUPPORT_GDI = 0x00000010; - public static final int LPD_SUPPORT_OPENGL = 0x00000020; - public static final int LPD_SHARE_DEPTH = 0x00000040; - public static final int LPD_SHARE_STENCIL = 0x00000080; - public static final int LPD_SHARE_ACCUM = 0x00000100; - public static final int LPD_SWAP_EXCHANGE = 0x00000200; - public static final int LPD_SWAP_COPY = 0x00000400; - public static final int LPD_TRANSPARENT = 0x00001000; - - public static final int LPD_TYPE_RGBA = 0; - public static final int LPD_TYPE_COLORINDEX = 1; - - /* wglSwapLayerBuffers flags */ - public static final int WGL_SWAP_MAIN_PLANE = 0x00000001; - public static final int WGL_SWAP_OVERLAY1 = 0x00000002; - public static final int WGL_SWAP_OVERLAY2 = 0x00000004; - public static final int WGL_SWAP_OVERLAY3 = 0x00000008; - public static final int WGL_SWAP_OVERLAY4 = 0x00000010; - public static final int WGL_SWAP_OVERLAY5 = 0x00000020; - public static final int WGL_SWAP_OVERLAY6 = 0x00000040; - public static final int WGL_SWAP_OVERLAY7 = 0x00000080; - public static final int WGL_SWAP_OVERLAY8 = 0x00000100; - public static final int WGL_SWAP_OVERLAY9 = 0x00000200; - public static final int WGL_SWAP_OVERLAY10 = 0x00000400; - public static final int WGL_SWAP_OVERLAY11 = 0x00000800; - public static final int WGL_SWAP_OVERLAY12 = 0x00001000; - public static final int WGL_SWAP_OVERLAY13 = 0x00002000; - public static final int WGL_SWAP_OVERLAY14 = 0x00004000; - public static final int WGL_SWAP_OVERLAY15 = 0x00008000; - public static final int WGL_SWAP_UNDERLAY1 = 0x00010000; - public static final int WGL_SWAP_UNDERLAY2 = 0x00020000; - public static final int WGL_SWAP_UNDERLAY3 = 0x00040000; - public static final int WGL_SWAP_UNDERLAY4 = 0x00080000; - public static final int WGL_SWAP_UNDERLAY5 = 0x00100000; - public static final int WGL_SWAP_UNDERLAY6 = 0x00200000; - public static final int WGL_SWAP_UNDERLAY7 = 0x00400000; - public static final int WGL_SWAP_UNDERLAY8 = 0x00800000; - public static final int WGL_SWAP_UNDERLAY9 = 0x01000000; - public static final int WGL_SWAP_UNDERLAY10 = 0x02000000; - public static final int WGL_SWAP_UNDERLAY11 = 0x04000000; - public static final int WGL_SWAP_UNDERLAY12 = 0x08000000; - public static final int WGL_SWAP_UNDERLAY13 = 0x10000000; - public static final int WGL_SWAP_UNDERLAY14 = 0x20000000; - public static final int WGL_SWAP_UNDERLAY15 = 0x40000000; - - /* pixel types */ - public static final int PFD_TYPE_RGBA = 0; - public static final int PFD_TYPE_COLORINDEX = 1; - - /* layer types */ - public static final int PFD_MAIN_PLANE = 0; - public static final int PFD_OVERLAY_PLANE = 1; - public static final int PFD_UNDERLAY_PLANE = (-1); - - /* PIXELFORMATDESCRIPTOR flags */ - public static final int PFD_DOUBLEBUFFER = 0x00000001; - public static final int PFD_STEREO = 0x00000002; - public static final int PFD_DRAW_TO_WINDOW = 0x00000004; - public static final int PFD_DRAW_TO_BITMAP = 0x00000008; - public static final int PFD_SUPPORT_GDI = 0x00000010; - public static final int PFD_SUPPORT_OPENGL = 0x00000020; - public static final int PFD_GENERIC_FORMAT = 0x00000040; - public static final int PFD_NEED_PALETTE = 0x00000080; - public static final int PFD_NEED_SYSTEM_PALETTE = 0x00000100; - public static final int PFD_SWAP_EXCHANGE = 0x00000200; - public static final int PFD_SWAP_COPY = 0x00000400; - public static final int PFD_SWAP_LAYER_BUFFERS = 0x00000800; - public static final int PFD_GENERIC_ACCELERATED = 0x00001000; - public static final int PFD_SUPPORT_DIRECTDRAW = 0x00002000; - - /* PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only */ - public static final int PFD_DEPTH_DONTCARE = 0x20000000; - public static final int PFD_DOUBLEBUFFER_DONTCARE = 0x40000000; - public static final int PFD_STEREO_DONTCARE = 0x80000000; - -/** @param hdc cast=(HDC) */ -public static final native int ChoosePixelFormat(int /*long*/ hdc, PIXELFORMATDESCRIPTOR ppfd); -/** @param hdc cast=(HDC) */ -public static final native int DescribePixelFormat(int /*long*/ hdc, int iPixelFormat, int nBytes, PIXELFORMATDESCRIPTOR ppfd); -/** @param hdc cast=(HDC) */ -public static final native int GetPixelFormat(int /*long*/ hdc); -/** @param hdc cast=(HDC) */ -public static final native boolean SetPixelFormat(int /*long*/ hdc, int iPixelFormat, PIXELFORMATDESCRIPTOR ppfd); -/** @param hdc cast=(HDC) */ -public static final native boolean SwapBuffers(int /*long*/ hdc); -/** - * @param hglrcSrc cast=(HGLRC) - * @param hglrcDst cast=(HGLRC) - */ -public static final native boolean wglCopyContext(int /*long*/ hglrcSrc, int /*long*/ hglrcDst, int mask); -/** @param hdc cast=(HDC) */ -public static final native int /*long*/ wglCreateContext(int /*long*/ hdc); -/** @param hdc cast=(HDC) */ -public static final native int /*long*/ wglCreateLayerContext(int /*long*/ hdc, int iLayerPlane); -/** @param hglrc cast=(HGLRC) */ -public static final native boolean wglDeleteContext(int /*long*/ hglrc); -public static final native int /*long*/ wglGetCurrentContext(); -public static final native int /*long*/ wglGetCurrentDC(); -public static final native int /*long*/ wglGetProcAddress(byte[] lpszProc); -/** - * @param hdc cast=(HDC) - * @param hglrc cast=(HGLRC) - */ -public static final native boolean wglMakeCurrent(int /*long*/ hdc, int /*long*/ hglrc); -/** - * @param hglrc1 cast=(HGLRC) - * @param hglrc2 cast=(HGLRC) - */ -public static final native boolean wglShareLists(int /*long*/ hglrc1, int /*long*/ hglrc2); -/** @param hdc cast=(HDC) */ -public static final native boolean wglDescribeLayerPlane(int /*long*/ hdc, int iPixelFormat, int iLayerPlane, int nBytes, LAYERPLANEDESCRIPTOR plpd); -/** - * @param hdc cast=(HDC) - * @param pcr cast=(COLORREF *) - */ -public static final native int wglSetLayerPaletteEntries(int /*long*/ hdc, int iLayerPlane, int iStart, int cEntries, int[] pcr); -/** - * @param hdc cast=(HDC) - * @param pcr cast=(COLORREF *) - */ -public static final native int wglGetLayerPaletteEntries(int /*long*/ hdc, int iLayerPlane, int iStart, int cEntries, int[] pcr); -/** @param hdc cast=(HDC) */ -public static final native boolean wglRealizeLayerPalette(int /*long*/ hdc, int iLayerPlane, boolean bRealize); -/** @param hdc cast=(HDC) */ -public static final native boolean wglSwapLayerBuffers(int /*long*/ hdc, int fuPlanes); -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/opengl/GLCanvas.java deleted file mode 100644 index 39b6350898..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/opengl/GLCanvas.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.opengl; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.internal.win32.*; -import org.eclipse.swt.internal.opengl.win32.*; - -/** - * GLCanvas is a widget capable of displaying OpenGL content. - * - * @see GLData - * @see <a href="http://www.eclipse.org/swt/snippets/#opengl">OpenGL snippets</a> - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * - * @since 3.2 - */ - -public class GLCanvas extends Canvas { - int /*long*/ context; - int pixelFormat; - static final String USE_OWNDC_KEY = "org.eclipse.swt.internal.win32.useOwnDC"; //$NON-NLS-1$ -/** - * Create a GLCanvas widget using the attributes described in the GLData - * object provided. - * - * @param parent a composite widget - * @param style the bitwise OR'ing of widget styles - * @param data the requested attributes of the GLCanvas - * - * @exception IllegalArgumentException - * <ul><li>ERROR_NULL_ARGUMENT when the data is null - * <li>ERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided</ul> - * </ul> - */ -public GLCanvas (Composite parent, int style, GLData data) { - super (parent, checkStyle (parent, style)); - parent.getDisplay ().setData (USE_OWNDC_KEY, new Boolean (false)); - if (data == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - PIXELFORMATDESCRIPTOR pfd = new PIXELFORMATDESCRIPTOR (); - pfd.nSize = (short) PIXELFORMATDESCRIPTOR.sizeof; - pfd.nVersion = 1; - pfd.dwFlags = WGL.PFD_DRAW_TO_WINDOW | WGL.PFD_SUPPORT_OPENGL; - pfd.dwLayerMask = WGL.PFD_MAIN_PLANE; - pfd.iPixelType = (byte) WGL.PFD_TYPE_RGBA; - if (data.doubleBuffer) pfd.dwFlags |= WGL.PFD_DOUBLEBUFFER; - if (data.stereo) pfd.dwFlags |= WGL.PFD_STEREO; - pfd.cRedBits = (byte) data.redSize; - pfd.cGreenBits = (byte) data.greenSize; - pfd.cBlueBits = (byte) data.blueSize; - pfd.cAlphaBits = (byte) data.alphaSize; - pfd.cDepthBits = (byte) data.depthSize; - pfd.cStencilBits = (byte) data.stencilSize; - pfd.cAccumRedBits = (byte) data.accumRedSize; - pfd.cAccumGreenBits = (byte) data.accumGreenSize; - pfd.cAccumBlueBits = (byte) data.accumBlueSize; - pfd.cAccumAlphaBits = (byte) data.accumAlphaSize; - pfd.cAccumBits = (byte) (pfd.cAccumRedBits + pfd.cAccumGreenBits + pfd.cAccumBlueBits + pfd.cAccumAlphaBits); - - //FIXME - use wglChoosePixelFormatARB -// if (data.sampleBuffers > 0) { -// wglAttrib [pos++] = WGL.WGL_SAMPLE_BUFFERS_ARB; -// wglAttrib [pos++] = data.sampleBuffers; -// } -// if (data.samples > 0) { -// wglAttrib [pos++] = WGL.WGL_SAMPLES_ARB; -// wglAttrib [pos++] = data.samples; -// } - - int /*long*/ hDC = OS.GetDC (handle); - pixelFormat = WGL.ChoosePixelFormat (hDC, pfd); - if (pixelFormat == 0 || !WGL.SetPixelFormat (hDC, pixelFormat, pfd)) { - OS.ReleaseDC (handle, hDC); - dispose (); - SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH); - } - context = WGL.wglCreateContext (hDC); - if (context == 0) { - OS.ReleaseDC (handle, hDC); - SWT.error (SWT.ERROR_NO_HANDLES); - } - OS.ReleaseDC (handle, hDC); - if (data.shareContext != null) { - WGL.wglShareLists (data.shareContext.context, context); - } - - Listener listener = new Listener () { - public void handleEvent (Event event) { - switch (event.type) { - case SWT.Dispose: - WGL.wglDeleteContext (context); - break; - } - } - }; - addListener (SWT.Dispose, listener); -} - -static int checkStyle(Composite parent, int style) { - if (parent != null) { - if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { - parent.getDisplay ().setData (USE_OWNDC_KEY, new Boolean (true)); - } - } - return style; -} - -/** - * Returns a GLData object describing the created context. - * - * @return GLData description of the OpenGL context attributes - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public GLData getGLData () { - checkWidget (); - GLData data = new GLData (); - PIXELFORMATDESCRIPTOR pfd = new PIXELFORMATDESCRIPTOR (); - pfd.nSize = (short) PIXELFORMATDESCRIPTOR.sizeof; - int /*long*/ hDC = OS.GetDC (handle); - WGL.DescribePixelFormat (hDC, pixelFormat, PIXELFORMATDESCRIPTOR.sizeof, pfd); - OS.ReleaseDC (handle, hDC); - data.doubleBuffer = (pfd.dwFlags & WGL.PFD_DOUBLEBUFFER) != 0; - data.stereo = (pfd.dwFlags & WGL.PFD_STEREO) != 0; - data.redSize = pfd.cRedBits; - data.greenSize = pfd.cGreenBits; - data.blueSize = pfd.cBlueBits; - data.alphaSize = pfd.cAlphaBits; - data.depthSize = pfd.cDepthBits; - data.stencilSize = pfd.cStencilBits; - data.accumRedSize = pfd.cAccumRedBits; - data.accumGreenSize = pfd.cAccumGreenBits; - data.accumBlueSize = pfd.cAccumBlueBits; - data.accumAlphaSize = pfd.cAccumAlphaBits; - return data; -} - -/** - * Returns a boolean indicating whether the receiver's OpenGL context - * is the current context. - * - * @return true if the receiver holds the current OpenGL context, - * false otherwise - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public boolean isCurrent () { - checkWidget (); - return WGL.wglGetCurrentContext () == context; -} - -/** - * Sets the OpenGL context associated with this GLCanvas to be the - * current GL context. - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void setCurrent () { - checkWidget (); - if (WGL.wglGetCurrentContext () == context) return; - int /*long*/ hDC = OS.GetDC (handle); - WGL.wglMakeCurrent (hDC, context); - OS.ReleaseDC (handle, hDC); -} - -/** - * Swaps the front and back color buffers. - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void swapBuffers () { - checkWidget (); - int /*long*/ hDC = OS.GetDC (handle); - WGL.SwapBuffers (hDC); - OS.ReleaseDC (handle, hDC); -} -} |