More progress, nearly fixed native header generation

BufferUtils.c and CallbackUtil.c have been modified to not include the
generated header file. This is because `javac` is choosing to ignore
those files for generation of headers for unknown reasons.
This commit is contained in:
Michael Pfaff 2022-08-10 11:43:59 -04:00
parent 134263f5cd
commit 325db15a1d
Signed by: michael
GPG Key ID: CF402C4A012AA9D4
26 changed files with 234 additions and 247 deletions

186
build.xml
View File

@ -74,7 +74,10 @@
<target name="all" description="Creates the Java archives and the natives for the current platform" depends="jars, compile_native"/> <target name="all" description="Creates the Java archives and the natives for the current platform" depends="jars, compile_native"/>
<!-- Create ONLY the jar archives --> <!-- Create ONLY the jar archives -->
<target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="-initialize, generate-all, compile, -createjars"> <target name="jars+NoDeps" description="Creates the Java archives ONLY and places them in libs/" depends="-createjars">
</target>
<target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="generate-all, compile, jars+NoDeps">
</target> </target>
<!-- Create ONLY the jar archives for the ES build --> <!-- Create ONLY the jar archives for the ES build -->
@ -83,7 +86,7 @@
</target> </target>
<!-- Packages the java files --> <!-- Packages the java files -->
<target name="-createdebugjars"> <target name="-createdebugjars" depends="-initialize">
<!-- Create lwjgl.jar --> <!-- Create lwjgl.jar -->
<jar destfile="${lwjgl.target.staging}/jar/lwjgl-debug.jar" taskname="lwjgl-debug.jar"> <jar destfile="${lwjgl.target.staging}/jar/lwjgl-debug.jar" taskname="lwjgl-debug.jar">
<fileset refid="lwjgl.fileset" /> <fileset refid="lwjgl.fileset" />
@ -95,7 +98,7 @@
</target> </target>
<!-- Packages the java files --> <!-- Packages the java files -->
<target name="-createjars"> <target name="-createjars" depends="-initialize">
<!-- Create lwjgl.jar --> <!-- Create lwjgl.jar -->
<jar destfile="${lwjgl.target.jars}/lwjgl.jar" taskname="lwjgl.jar"> <jar destfile="${lwjgl.target.jars}/lwjgl.jar" taskname="lwjgl.jar">
<fileset refid="lwjgl.fileset" /> <fileset refid="lwjgl.fileset" />
@ -165,32 +168,32 @@
</target> </target>
<!-- Generates the native headers from source files --> <!-- Generates the native headers from source files -->
<target name="headers" description="invokes javah on java classes" depends="compile"> <!--<target name="headers" description="invokes javah on java classes" depends="compile">
<javac <javac
srcdir="${lwjgl.target.gen.java}" srcdir="${lwjgl.src.java}"
source="1.8" source="1.8"
target="1.8" target="1.8"
fork="true" fork="true"
taskname="headers"> taskname="headers">
<compilerarg value="-cp"/> <compilerarg value="-s"/>
<compilerarg path="${lwjgl.target.gen.classes}"/> <compilerarg path="${lwjgl.src.java}"/>
<compilerarg value="-h"/> <compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/linux"/> <compilerarg value="${lwjgl.src.native}/linux"/>
<src> <src>
<fileset dir="${lwjgl.target.gen.java}"> <fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/LinuxSysImplementation.java"/> <include name="org/lwjgl/LinuxSysImplementation.java"/>
<include name="org/lwjgl/opengl/LinuxEvent.java"/> <include name="org/lwjgl/opengl/LinuxEvent.java"/>
<include name="org/lwjgl/opengl/LinuxMouse.java"/> <include name="org/lwjgl/opengl/LinuxMouse.java"/>
<include name="org/lwjgl/opengl/LinuxKeyboard.java"/> <include name="org/lwjgl/opengl/LinuxKeyboard.java"/>
<include name="org/lwjgl/opengl/LinuxDisplay.java"/> <include name="org/lwjgl/opengl/LinuxDisplay.java"/>
<include name="org/lwjgl/opengl/LinuxPeerInfo.java"/> <include name="org/lwjgl/opengl/LinuxPeerInfo.java"/>
</fileset> </fileset>
</src> </src>
</javac> </javac>
<javac <javac
srcdir="${lwjgl.target.gen.java}" srcdir="${lwjgl.src.java}"
source="1.8" source="1.8"
target="1.8" target="1.8"
fork="true" fork="true"
@ -200,18 +203,18 @@
<compilerarg value="-h"/> <compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/linux/opengl"/> <compilerarg value="${lwjgl.src.native}/linux/opengl"/>
<src> <src>
<fileset dir="${lwjgl.target.gen.java}"> <fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/LinuxPbufferPeerInfo.java"/> <include name="org/lwjgl/opengl/LinuxPbufferPeerInfo.java"/>
<include name="org/lwjgl/opengl/LinuxDisplayPeerInfo.java"/> <include name="org/lwjgl/opengl/LinuxDisplayPeerInfo.java"/>
<include name="org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java"/> <include name="org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java"/>
<include name="org/lwjgl/opengl/LinuxContextImplementation.java"/> <include name="org/lwjgl/opengl/LinuxContextImplementation.java"/>
<include name="org/lwjgl/opengl/LinuxCanvasImplementation.java"/> <include name="org/lwjgl/opengl/LinuxCanvasImplementation.java"/>
</fileset> </fileset>
</src> </src>
</javac> </javac>
<javac <javac
srcdir="${lwjgl.target.gen.java}" srcdir="${lwjgl.src.java}"
source="1.8" source="1.8"
target="1.8" target="1.8"
fork="true" fork="true"
@ -221,19 +224,19 @@
<compilerarg value="-h"/> <compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/windows"/> <compilerarg value="${lwjgl.src.native}/windows"/>
<src> <src>
<fileset dir="${lwjgl.target.gen.java}"> <fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/WindowsSysImplementation.java"/> <include name="org/lwjgl/WindowsSysImplementation.java"/>
<include name="org/lwjgl/opengl/WindowsKeyboard.java"/> <include name="org/lwjgl/opengl/WindowsKeyboard.java"/>
<include name="org/lwjgl/opengl/WindowsRegistry.java"/> <include name="org/lwjgl/opengl/WindowsRegistry.java"/>
<include name="org/lwjgl/opengl/WindowsDisplay.java"/> <include name="org/lwjgl/opengl/WindowsDisplay.java"/>
<include name="org/lwjgl/opengl/WindowsDisplayPeerInfo.java"/> <include name="org/lwjgl/opengl/WindowsDisplayPeerInfo.java"/>
<include name="org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java"/> <include name="org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java"/>
</fileset> </fileset>
</src> </src>
</javac> </javac>
<javac <javac
srcdir="${lwjgl.target.gen.java}" srcdir="${lwjgl.src.java}"
source="1.8" source="1.8"
target="1.8" target="1.8"
fork="true" fork="true"
@ -243,16 +246,16 @@
<compilerarg value="-h"/> <compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/windows/opengl"/> <compilerarg value="${lwjgl.src.native}/windows/opengl"/>
<src> <src>
<fileset dir="${lwjgl.target.gen.java}"> <fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/WindowsPbufferPeerInfo.java"/> <include name="org/lwjgl/opengl/WindowsPbufferPeerInfo.java"/>
<include name="org/lwjgl/opengl/WindowsPeerInfo.java"/> <include name="org/lwjgl/opengl/WindowsPeerInfo.java"/>
<include name="org/lwjgl/opengl/WindowsContextImplementation.java"/> <include name="org/lwjgl/opengl/WindowsContextImplementation.java"/>
</fileset> </fileset>
</src> </src>
</javac> </javac>
<javac <javac
srcdir="${lwjgl.target.gen.java}" srcdir="${lwjgl.src.java}"
source="1.8" source="1.8"
target="1.8" target="1.8"
fork="true" fork="true"
@ -262,14 +265,14 @@
<compilerarg value="-h"/> <compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/windows/opengles"/> <compilerarg value="${lwjgl.src.native}/windows/opengles"/>
<src> <src>
<fileset dir="${lwjgl.target.gen.java}"> <fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/WindowsPeerInfo.java"/> <include name="org/lwjgl/opengl/WindowsPeerInfo.java"/>
</fileset> </fileset>
</src> </src>
</javac> </javac>
<javac <javac
srcdir="${lwjgl.target.gen.java}" srcdir="${lwjgl.src.java}"
source="1.8" source="1.8"
target="1.8" target="1.8"
fork="true" fork="true"
@ -279,22 +282,22 @@
<compilerarg value="-h"/> <compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/macosx"/> <compilerarg value="${lwjgl.src.native}/macosx"/>
<src> <src>
<fileset dir="${lwjgl.target.gen.java}"> <fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/MacOSXSysImplementation.java"/> <include name="org/lwjgl/MacOSXSysImplementation.java"/>
<include name="org/lwjgl/opengl/MacOSXCanvasPeerInfo.java"/> <include name="org/lwjgl/opengl/MacOSXCanvasPeerInfo.java"/>
<include name="org/lwjgl/opengl/MacOSXPeerInfo.java"/> <include name="org/lwjgl/opengl/MacOSXPeerInfo.java"/>
<include name="org/lwjgl/opengl/MacOSXPbufferPeerInfo.java"/> <include name="org/lwjgl/opengl/MacOSXPbufferPeerInfo.java"/>
<include name="org/lwjgl/opengl/MacOSXDisplay.java"/> <include name="org/lwjgl/opengl/MacOSXDisplay.java"/>
<include name="org/lwjgl/opengl/MacOSXContextImplementation.java"/> <include name="org/lwjgl/opengl/MacOSXContextImplementation.java"/>
<include name="org/lwjgl/opengl/MacOSXNativeKeyboard.java"/> <include name="org/lwjgl/opengl/MacOSXNativeKeyboard.java"/>
<include name="org/lwjgl/opengl/MacOSXNativeMouse.java"/> <include name="org/lwjgl/opengl/MacOSXNativeMouse.java"/>
<include name="org/lwjgl/opengl/MacOSXMouseEventQueue.java"/> <include name="org/lwjgl/opengl/MacOSXMouseEventQueue.java"/>
</fileset> </fileset>
</src> </src>
</javac> </javac>
<javac <javac
srcdir="${lwjgl.target.gen.java}" srcdir="${lwjgl.src.java}"
source="1.8" source="1.8"
target="1.8" target="1.8"
fork="true" fork="true"
@ -302,24 +305,24 @@
<compilerarg value="-cp"/> <compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/> <compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/> <compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.headers}"/> <compilerarg value="${lwjgl.target.gen.headers}"/>
<src> <src>
<fileset dir="${lwjgl.target.gen.java}"> <fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/AWTSurfaceLock.java"/> <include name="org/lwjgl/opengl/AWTSurfaceLock.java"/>
<include name="org/lwjgl/DefaultSysImplementation.java"/> <include name="org/lwjgl/DefaultSysImplementation.java"/>
<include name="org/lwjgl/input/Cursor.java"/> <include name="org/lwjgl/input/Cursor.java"/>
<include name="org/lwjgl/input/Keyboard.java"/> <include name="org/lwjgl/input/Keyboard.java"/>
<include name="org/lwjgl/input/Mouse.java"/> <include name="org/lwjgl/input/Mouse.java"/>
<include name="org/lwjgl/openal/AL.java"/> <include name="org/lwjgl/openal/AL.java"/>
<include name="org/lwjgl/opencl/CL.java"/> <include name="org/lwjgl/opencl/CL.java"/>
<include name="org/lwjgl/opencl/CallbackUtil.java"/> <include name="org/lwjgl/opencl/CallbackUtil.java"/>
<include name="org/lwjgl/BufferUtils.java"/> <include name="org/lwjgl/BufferUtils.java"/>
</fileset> </fileset>
</src> </src>
</javac> </javac>
<javac <javac
srcdir="${lwjgl.target.gen.java}" srcdir="${lwjgl.src.java}"
source="1.8" source="1.8"
target="1.8" target="1.8"
fork="true" fork="true"
@ -327,20 +330,20 @@
<compilerarg value="-cp"/> <compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/> <compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/> <compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.headers}/opengl"/> <compilerarg value="${lwjgl.target.gen.headers}/opengl"/>
<src> <src>
<fileset dir="${lwjgl.target.gen.java}"> <fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/GLContext.java"/> <include name="org/lwjgl/opengl/GLContext.java"/>
<include name="org/lwjgl/opengl/Pbuffer.java"/> <include name="org/lwjgl/opengl/Pbuffer.java"/>
<include name="org/lwjgl/opengl/CallbackUtil.java"/> <include name="org/lwjgl/opengl/CallbackUtil.java"/>
<include name="org/lwjgl/opengl/NVPresentVideoUtil.java"/> <include name="org/lwjgl/opengl/NVPresentVideoUtil.java"/>
<include name="org/lwjgl/opengl/NVVideoCaptureUtil.java"/> <include name="org/lwjgl/opengl/NVVideoCaptureUtil.java"/>
</fileset> </fileset>
</src> </src>
</javac> </javac>
<javac <javac
srcdir="${lwjgl.target.gen.java}" srcdir="${lwjgl.src.java}"
source="1.8" source="1.8"
target="1.8" target="1.8"
fork="true" fork="true"
@ -348,19 +351,19 @@
<compilerarg value="-cp"/> <compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/> <compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/> <compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.headers}/opengles"/> <compilerarg value="${lwjgl.target.gen.headers}/opengles"/>
<src> <src>
<fileset dir="${lwjgl.target.gen.java}"> <fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengles/EGL.java"/> <include name="org/lwjgl/opengles/EGL.java"/>
<include name="org/lwjgl/opengles/EGLKHRFenceSync.java"/> <include name="org/lwjgl/opengles/EGLKHRFenceSync.java"/>
<include name="org/lwjgl/opengles/EGLKHRReusableSync.java"/> <include name="org/lwjgl/opengles/EGLKHRReusableSync.java"/>
<include name="org/lwjgl/opengles/EGLNVSync.java"/> <include name="org/lwjgl/opengles/EGLNVSync.java"/>
<include name="org/lwjgl/opengles/GLContext.java"/> <include name="org/lwjgl/opengles/GLContext.java"/>
<include name="org/lwjgl/opengles/CallbackUtil.java"/> <include name="org/lwjgl/opengles/CallbackUtil.java"/>
</fileset> </fileset>
</src> </src>
</javac> </javac>
</target> </target>-->
<target name="touch-version"> <target name="touch-version">
<touch file="${lwjgl.src.native}/windows/org_lwjgl_opengl_Display.c"/> <touch file="${lwjgl.src.native}/windows/org_lwjgl_opengl_Display.c"/>
@ -390,21 +393,21 @@
</tokenfilter> </tokenfilter>
</filterchain> </filterchain>
</loadfile> </loadfile>
<loadfile srcfile="${lwjgl.src.native}/windows/org_lwjgl_WindowsSysImplementation.h" property="lwjgl.native.windows.version"> <loadfile srcfile="${lwjgl.target.gen.headers}/org_lwjgl_WindowsSysImplementation.h" property="lwjgl.native.windows.version">
<filterchain> <filterchain>
<tokenfilter> <tokenfilter>
<containsstring contains="#define org_lwjgl_WindowsSysImplementation_JNI_VERSION"/> <containsstring contains="#define org_lwjgl_WindowsSysImplementation_JNI_VERSION"/>
</tokenfilter> </tokenfilter>
</filterchain> </filterchain>
</loadfile> </loadfile>
<loadfile srcfile="${lwjgl.src.native}/linux/org_lwjgl_LinuxSysImplementation.h" property="lwjgl.native.linux.version"> <loadfile srcfile="${lwjgl.target.gen.headers}/org_lwjgl_LinuxSysImplementation.h" property="lwjgl.native.linux.version">
<filterchain> <filterchain>
<tokenfilter> <tokenfilter>
<containsstring contains="#define org_lwjgl_LinuxSysImplementation_JNI_VERSION"/> <containsstring contains="#define org_lwjgl_LinuxSysImplementation_JNI_VERSION"/>
</tokenfilter> </tokenfilter>
</filterchain> </filterchain>
</loadfile> </loadfile>
<loadfile srcfile="${lwjgl.src.native}/macosx/org_lwjgl_MacOSXSysImplementation.h" property="lwjgl.native.macosx.version"> <loadfile srcfile="${lwjgl.target.gen.headers}/org_lwjgl_MacOSXSysImplementation.h" property="lwjgl.native.macosx.version">
<filterchain> <filterchain>
<tokenfilter> <tokenfilter>
<containsstring contains="#define org_lwjgl_MacOSXSysImplementation_JNI_VERSION"/> <containsstring contains="#define org_lwjgl_MacOSXSysImplementation_JNI_VERSION"/>
@ -447,24 +450,17 @@
<!-- Compiles the Java source code --> <!-- Compiles the Java source code -->
<target name="compile" description="Compiles the java source code" depends="-initialize"> <target name="compile" description="Compiles the java source code" depends="-initialize">
<javac debug="yes" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar:${lwjgl.lib}/asm-debug-all.jar" taskname="core"> <javac debug="yes" destdir="${lwjgl.target.gen.classes}" nativeHeaderDir="${lwjgl.target.gen.headers}" source="1.8" target="1.8" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar:${lwjgl.lib}/asm-debug-all.jar" taskname="core">
<!--<compilerarg value="-Xlint:unchecked"/>--> <!--<compilerarg value="-Xlint:unchecked"/>-->
<src path="${lwjgl.src}/java/"/> <src path="${lwjgl.src.java}"/>
<src path="${lwjgl.target.gen.java}/"/> <src path="${lwjgl.target.gen.java}"/>
<include name="org/lwjgl/*.java"/>
<include name="org/lwjgl/input/**"/>
<include name="org/lwjgl/opengl/**"/>
<include name="org/lwjgl/opengles/**"/>
<include name="org/lwjgl/openal/**"/>
<include name="org/lwjgl/opencl/**"/>
<include name="org/lwjgl/util/**"/>
<exclude name="org/lwjgl/util/generator/**"/> <exclude name="org/lwjgl/util/generator/**"/>
</javac> </javac>
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.target.gen.classes}" includes="org/lwjgl/test/**" source="1.8" target="1.8" taskname="test" /> <javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" includes="org/lwjgl/test/**" source="1.8" target="1.8" taskname="test" />
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.target.gen.classes}" includes="org/lwjgl/examples/**" source="1.8" target="1.8" taskname="examples" /> <javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" includes="org/lwjgl/examples/**" source="1.8" target="1.8" taskname="examples" />
</target> </target>
<target name="compile_native" depends="-initialize, headers, touch-version, version-mismatch" description="Compiles the native files"> <target name="compile_native" depends="-initialize, compile, touch-version, version-mismatch" description="Compiles the native files">
<condition property="lwjgl.platform.windows"> <condition property="lwjgl.platform.windows">
<os family="windows" /> <os family="windows" />
</condition> </condition>
@ -532,7 +528,7 @@
<version-check platform="macosx"/> <version-check platform="macosx"/>
</target> </target>
<target name="compile_native_es" depends="-initialize, headers, touch-version, version-mismatch" description="Compiles the native files"> <target name="compile_native_es" depends="-initialize, compile, touch-version, version-mismatch" description="Compiles the native files">
<condition property="lwjgl.platform.windows"> <condition property="lwjgl.platform.windows">
<os family="windows"/> <os family="windows"/>
</condition> </condition>

View File

@ -77,7 +77,7 @@
<target name="compile32" unless="build.64bit.only"> <target name="compile32" unless="build.64bit.only">
<mkdir dir="x32"/> <mkdir dir="x32"/>
<apply dir="x32" executable="cc" skipemptyfilesets="true" failonerror="true"> <apply dir="x32" executable="cc" failonerror="true">
<arg line="${cflags32} ${cflags_pthread}"/> <arg line="${cflags32} ${cflags_pthread}"/>
<arg value="-I${java.home}/include"/> <arg value="-I${java.home}/include"/>
<arg value="-I${java.home}/include/freebsd"/> <arg value="-I${java.home}/include/freebsd"/>
@ -91,6 +91,7 @@
<arg value="-I${native}/common/opengl"/> <arg value="-I${native}/common/opengl"/>
<arg value="-I${native}/linux"/> <arg value="-I${native}/linux"/>
<arg value="-I${native}/linux/opengl"/> <arg value="-I${native}/linux/opengl"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<mapper type="glob" from="*.c" to="*.o"/> <mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*.c"/> <fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengl" includes="*.c"/> <fileset dir="${native}/common/opengl" includes="*.c"/>
@ -112,7 +113,7 @@
<target name="compile64" unless="build.32bit.only"> <target name="compile64" unless="build.32bit.only">
<mkdir dir="x64"/> <mkdir dir="x64"/>
<apply dir="x64" executable="cc" skipemptyfilesets="true" failonerror="true"> <apply dir="x64" executable="cc" failonerror="true">
<arg line="${cflags64} ${cflags_pthread}"/> <arg line="${cflags64} ${cflags_pthread}"/>
<arg value="-I${java.home}/include"/> <arg value="-I${java.home}/include"/>
<arg value="-I${java.home}/include/freebsd"/> <arg value="-I${java.home}/include/freebsd"/>
@ -126,6 +127,7 @@
<arg value="-I${native}/common/opengl"/> <arg value="-I${native}/common/opengl"/>
<arg value="-I${native}/linux"/> <arg value="-I${native}/linux"/>
<arg value="-I${native}/linux/opengl"/> <arg value="-I${native}/linux/opengl"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<mapper type="glob" from="*.c" to="*.o"/> <mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*.c"/> <fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengl" includes="*.c"/> <fileset dir="${native}/common/opengl" includes="*.c"/>

View File

@ -11,6 +11,7 @@
<property name="lwjgl.target.gen" location="${lwjgl.target}/gen" /> <property name="lwjgl.target.gen" location="${lwjgl.target}/gen" />
<property name="lwjgl.target.gen.classes" location="${lwjgl.target.gen}/classes" /> <property name="lwjgl.target.gen.classes" location="${lwjgl.target.gen}/classes" />
<property name="lwjgl.target.gen.java" location="${lwjgl.target.gen}/java" /> <property name="lwjgl.target.gen.java" location="${lwjgl.target.gen}/java" />
<property name="lwjgl.target.gen.headers" location="${lwjgl.target.gen}/headers" />
<property name="lwjgl.target.gen.native" location="${lwjgl.target.gen}/native" /> <property name="lwjgl.target.gen.native" location="${lwjgl.target.gen}/native" />
<property name="lwjgl.target.gen.obj" location="${lwjgl.target.gen}/obj" /> <property name="lwjgl.target.gen.obj" location="${lwjgl.target.gen}/obj" />
<property name="lwjgl.target.staging" location="${lwjgl.target}/staging" /> <property name="lwjgl.target.staging" location="${lwjgl.target}/staging" />
@ -25,7 +26,6 @@
<property name="lwjgl.src" location="src" /> <property name="lwjgl.src" location="src" />
<property name="lwjgl.src.java" location="${lwjgl.src}/java" /> <property name="lwjgl.src.java" location="${lwjgl.src}/java" />
<property name="lwjgl.src.native" location="${lwjgl.src}/native" /> <property name="lwjgl.src.native" location="${lwjgl.src}/native" />
<property name="lwjgl.src.headers" location="${lwjgl.src.native}/common" />
<property name="lwjgl.src.templates" location="${lwjgl.src}/templates" /> <property name="lwjgl.src.templates" location="${lwjgl.src}/templates" />
<property name="lwjgl.src.templates.al" location="${lwjgl.src.templates}/org/lwjgl/openal"/> <property name="lwjgl.src.templates.al" location="${lwjgl.src.templates}/org/lwjgl/openal"/>

View File

@ -11,14 +11,21 @@
<mkdir dir="${lwjgl.target.gen.classes}"/> <mkdir dir="${lwjgl.target.gen.classes}"/>
<!-- Compile helper classes used by the templates --> <!-- Compile helper classes used by the templates -->
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" taskname="generator"> <javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" taskname="generator">
<include name="org/lwjgl/PointerWrapper.java"/> <include name="org/lwjgl/PointerWrapper.java"/>
<include name="org/lwjgl/PointerBuffer.java"/> <include name="org/lwjgl/PointerBuffer.java"/>
</javac> </javac>
</target> </target>
<!-- Proxy target to generate it all --> <!-- Proxy target to generate it all -->
<target name="generate-all" depends="generate-openal, generate-opengl, generate-opengles, generate-opencl" description="Generates java and native source"/> <target name="generate-all" depends="-generate-common" description="Generates java and native source">
<parallel>
<antcall target="generate-openal"/>
<antcall target="generate-opengl"/>
<antcall target="generate-opengles"/>
<antcall target="generate-opencl"/>
</parallel>
</target>
<!-- ******************************************************************************** <!-- ********************************************************************************
********************************************************************************* *********************************************************************************
@ -30,7 +37,7 @@
<target name="generate-openal" depends="-generate-common" description="Generates java and native source for AL"> <target name="generate-openal" depends="-generate-common" description="Generates java and native source for AL">
<mkdir dir="${lwjgl.target.gen.native}/openal"/> <mkdir dir="${lwjgl.target.gen.native}/openal"/>
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" includes="org/lwjgl/util/generator/**.java" taskname="generator"> <javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" includes="org/lwjgl/util/generator/**.java" taskname="generator">
<include name="org/lwjgl/util/generator/openal/**.java"/> <include name="org/lwjgl/util/generator/openal/**.java"/>
<compilerarg value="-Xlint:none"/> <compilerarg value="-Xlint:none"/>
</javac> </javac>
@ -68,13 +75,13 @@
<target name="generate-opengl" depends="-generate-common, -compile-opencl-helpers" description="Generates java and native source for GL"> <target name="generate-opengl" depends="-generate-common, -compile-opencl-helpers" description="Generates java and native source for GL">
<mkdir dir="${lwjgl.target.gen.native}/opengl"/> <mkdir dir="${lwjgl.target.gen.native}/opengl"/>
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" includes="org/lwjgl/util/generator/**.java" taskname="generator"> <javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" includes="org/lwjgl/util/generator/**.java" taskname="generator">
<include name="org/lwjgl/util/generator/opengl/**.java"/> <include name="org/lwjgl/util/generator/opengl/**.java"/>
<compilerarg value="-Xlint:none"/> <compilerarg value="-Xlint:none"/>
</javac> </javac>
<!-- Compile helper classes used by the templates --> <!-- Compile helper classes used by the templates -->
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" taskname="generator"> <javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" taskname="generator">
<include name="org/lwjgl/opengl/GLSync.java"/> <include name="org/lwjgl/opengl/GLSync.java"/>
<include name="org/lwjgl/opengl/AMDDebugOutputCallback.java"/> <include name="org/lwjgl/opengl/AMDDebugOutputCallback.java"/>
<include name="org/lwjgl/opengl/ARBDebugOutputCallback.java"/> <include name="org/lwjgl/opengl/ARBDebugOutputCallback.java"/>
@ -152,13 +159,13 @@
<target name="generate-opengles" depends="-generate-common" description="Generates java and native source for GL ES"> <target name="generate-opengles" depends="-generate-common" description="Generates java and native source for GL ES">
<mkdir dir="${lwjgl.target.gen.native}/opengles"/> <mkdir dir="${lwjgl.target.gen.native}/opengles"/>
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" includes="org/lwjgl/util/generator/**.java" taskname="generator"> <javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" includes="org/lwjgl/util/generator/**.java" taskname="generator">
<include name="org/lwjgl/util/generator/opengles/**.java"/> <include name="org/lwjgl/util/generator/opengles/**.java"/>
<compilerarg value="-Xlint:none"/> <compilerarg value="-Xlint:none"/>
</javac> </javac>
<!-- Compile helper classes used by the templates --> <!-- Compile helper classes used by the templates -->
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" taskname="generator"> <javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" taskname="generator">
<include name="org/lwjgl/opengles/EGLImageOES.java"/> <include name="org/lwjgl/opengles/EGLImageOES.java"/>
<include name="org/lwjgl/opengles/KHRDebugCallback.java"/> <include name="org/lwjgl/opengles/KHRDebugCallback.java"/>
</javac> </javac>
@ -214,7 +221,7 @@
<target name="-compile-opencl-helpers" depends="-generate-common" description="Compiles java helpers for CL"> <target name="-compile-opencl-helpers" depends="-generate-common" description="Compiles java helpers for CL">
<!-- Compile helper classes used by the templates --> <!-- Compile helper classes used by the templates -->
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" taskname="generator"> <javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" taskname="generator">
<include name="org/lwjgl/opencl/CLPlatform.java"/> <include name="org/lwjgl/opencl/CLPlatform.java"/>
<include name="org/lwjgl/opencl/CLDevice.java"/> <include name="org/lwjgl/opencl/CLDevice.java"/>
<include name="org/lwjgl/opencl/CLContext.java"/> <include name="org/lwjgl/opencl/CLContext.java"/>
@ -229,7 +236,7 @@
<target name="generate-opencl" depends="-generate-common, -compile-opencl-helpers" description="Generates java and native source for CL"> <target name="generate-opencl" depends="-generate-common, -compile-opencl-helpers" description="Generates java and native source for CL">
<mkdir dir="${lwjgl.target.gen.native}/opencl"/> <mkdir dir="${lwjgl.target.gen.native}/opencl"/>
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" includes="org/lwjgl/util/generator/**.java" taskname="generator"> <javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" includes="org/lwjgl/util/generator/**.java" taskname="generator">
<include name="org/lwjgl/util/generator/opencl/**.java"/> <include name="org/lwjgl/util/generator/opencl/**.java"/>
<compilerarg value="-Xlint:none"/> <compilerarg value="-Xlint:none"/>
</javac> </javac>

View File

@ -63,6 +63,7 @@
<arg value="-I${lwjgl.src.native}/common/opengl"/> <arg value="-I${lwjgl.src.native}/common/opengl"/>
<arg value="-I${lwjgl.src.native}/linux"/> <arg value="-I${lwjgl.src.native}/linux"/>
<arg value="-I${lwjgl.src.native}/linux/opengl"/> <arg value="-I${lwjgl.src.native}/linux/opengl"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<mapper type="glob" from="*.c" to="*.o"/> <mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${lwjgl.src.native}/common" includes="*.c"/> <fileset dir="${lwjgl.src.native}/common" includes="*.c"/>
<fileset dir="${lwjgl.src.native}/common/opengl" includes="*.c"/> <fileset dir="${lwjgl.src.native}/common/opengl" includes="*.c"/>
@ -95,6 +96,7 @@
<arg value="-I${lwjgl.src.native}/common/opengl"/> <arg value="-I${lwjgl.src.native}/common/opengl"/>
<arg value="-I${lwjgl.src.native}/linux"/> <arg value="-I${lwjgl.src.native}/linux"/>
<arg value="-I${lwjgl.src.native}/linux/opengl"/> <arg value="-I${lwjgl.src.native}/linux/opengl"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<mapper type="glob" from="*.c" to="*.o"/> <mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${lwjgl.src.native}/common" includes="*.c"/> <fileset dir="${lwjgl.src.native}/common" includes="*.c"/>
<fileset dir="${lwjgl.src.native}/common/opengl" includes="*.c"/> <fileset dir="${lwjgl.src.native}/common/opengl" includes="*.c"/>

View File

@ -9,15 +9,6 @@
<property name="libs64" value="-L${lib_folder}/x64 -lEGL -L/usr/X11R6/lib64 -L/usr/X11/lib64 -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib -L${java.home}/lib/amd64 -ljawt" /> <property name="libs64" value="-L${lib_folder}/x64 -lEGL -L/usr/X11R6/lib64 -L/usr/X11/lib64 -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib -L${java.home}/lib/amd64 -ljawt" />
<property name="cflags32" value="-O3 -Wall -c -fPIC -std=c99 -Wunused"/> <property name="cflags32" value="-O3 -Wall -c -fPIC -std=c99 -Wunused"/>
<target name="clean">
<delete>
<fileset dir="x32"/>
<fileset dir="x64"/>
<fileset dir="." includes="*.o"/>
<fileset dir="." includes="*.so"/>
</delete>
</target>
<target name="compile"> <target name="compile">
<exec executable="uname" outputproperty="hwplatform"> <exec executable="uname" outputproperty="hwplatform">
<arg value="-m"/> <arg value="-m"/>
@ -63,7 +54,7 @@
<target name="compile32" unless="build.64bit.only"> <target name="compile32" unless="build.64bit.only">
<mkdir dir="x32"/> <mkdir dir="x32"/>
<apply dir="x32" executable="gcc" skipemptyfilesets="true" failonerror="true"> <apply dir="x32" executable="gcc" failonerror="true">
<arg line="${cflags32} ${cflags_pthread}"/> <arg line="${cflags32} ${cflags_pthread}"/>
<arg value="-I${java.home}/include"/> <arg value="-I${java.home}/include"/>
<arg value="-I${java.home}/include/linux"/> <arg value="-I${java.home}/include/linux"/>
@ -74,6 +65,7 @@
<arg value="-I${native}/common/opengles"/> <arg value="-I${native}/common/opengles"/>
<arg value="-I${native}/linux"/> <arg value="-I${native}/linux"/>
<arg value="-I${native}/linux/opengles"/> <arg value="-I${native}/linux/opengles"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<mapper type="glob" from="*.c" to="*.o"/> <mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*.c"/> <fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengles" includes="*.c"/> <fileset dir="${native}/common/opengles" includes="*.c"/>
@ -106,6 +98,7 @@
<arg value="-I${native}/common/opengles"/> <arg value="-I${native}/common/opengles"/>
<arg value="-I${native}/linux"/> <arg value="-I${native}/linux"/>
<arg value="-I${native}/linux/opengles"/> <arg value="-I${native}/linux/opengles"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<mapper type="glob" from="*.c" to="*.o"/> <mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*.c"/> <fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengles" includes="*.c"/> <fileset dir="${native}/common/opengles" includes="*.c"/>

View File

@ -97,6 +97,7 @@
<mkdir dir="${dstdir}" taskname="initializing ${dstdir} folder"/> <mkdir dir="${dstdir}" taskname="initializing ${dstdir} folder"/>
<apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" failonerror="true" dest="${dstdir}"> <apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" failonerror="true" dest="${dstdir}">
<arg line="${cflags} -ObjC -O3 -Wall -Wunused -c -fPIC -I${javavmroot}/${jvm_headers_path_md} -I${javavmroot}/${jvm_headers_path} -I${lwjgl.src.native}/common -I${lwjgl.src.native}/common/opengl -I${lwjgl.src.native}/macosx"/> <arg line="${cflags} -ObjC -O3 -Wall -Wunused -c -fPIC -I${javavmroot}/${jvm_headers_path_md} -I${javavmroot}/${jvm_headers_path} -I${lwjgl.src.native}/common -I${lwjgl.src.native}/common/opengl -I${lwjgl.src.native}/macosx"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<!-- Map from *.m and *.c to .o --> <!-- Map from *.m and *.c to .o -->
<mapper type="regexp" from="^(.*)\.(c|m)" to="\1.o"/> <mapper type="regexp" from="^(.*)\.(c|m)" to="\1.o"/>
<fileset dir="${lwjgl.src.native}/macosx" includes="*.m"/> <fileset dir="${lwjgl.src.native}/macosx" includes="*.m"/>

View File

@ -11,7 +11,7 @@
<property name="dllname" value="lwjgl64.dll"/> <property name="dllname" value="lwjgl64.dll"/>
<target name="compile_dir"> <target name="compile_dir">
<apply dir="." failonerror="true" executable="${gcc}" dest="." skipemptyfilesets="true"> <apply dir="." failonerror="true" executable="${gcc}" dest=".">
<arg line="-c -Wall -O2 -std=gnu99 -D_JNI_IMPLEMENTATION_"/> <arg line="-c -Wall -O2 -std=gnu99 -D_JNI_IMPLEMENTATION_"/>
<arg value="-I${dxhome}/include"/> <arg value="-I${dxhome}/include"/>
<arg value="-I${alhome}/include"/> <arg value="-I${alhome}/include"/>
@ -19,6 +19,7 @@
<arg value="-I${jdkhome}/include/win32"/> <arg value="-I${jdkhome}/include/win32"/>
<arg value="-I${native}/common"/> <arg value="-I${native}/common"/>
<arg value="-I${native}/windows"/> <arg value="-I${native}/windows"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<srcfile/> <srcfile/>
<fileset dir="${native}/windows" includes="*.c"/> <fileset dir="${native}/windows" includes="*.c"/>
<fileset dir="${native}/common" includes="*.c"/> <fileset dir="${native}/common" includes="*.c"/>
@ -49,13 +50,6 @@
</apply> </apply>
</target> </target>
<target name="clean">
<delete>
<fileset dir="." includes="*.o"/>
<fileset dir="." includes="*.dll"/>
</delete>
</target>
<target name="compile"> <target name="compile">
<property name="libs" value="-lkernel32 -lole32 -lopengl32 -lversion -luser32 -lgdi32 -ladvapi32 -lwinmm"/> <property name="libs" value="-lkernel32 -lole32 -lopengl32 -lversion -luser32 -lgdi32 -ladvapi32 -lwinmm"/>
<antcall target="compile_dir"/> <antcall target="compile_dir"/>

View File

@ -6,7 +6,7 @@
<property name="sdkhome" location="${env.MSSDK}"/> <property name="sdkhome" location="${env.MSSDK}"/>
<target name="compile_dir"> <target name="compile_dir">
<apply dir="." failonerror="true" executable="cl" dest="." skipemptyfilesets="true" parallel="true"> <apply dir="." failonerror="true" executable="cl" dest="." parallel="true">
<arg line="/c /W2 /EHsc /Ox /Gy /MT /MP /nologo"/> <arg line="/c /W2 /EHsc /Ox /Gy /MT /MP /nologo"/>
<arg value="/I${sdkhome}\include"/> <arg value="/I${sdkhome}\include"/>
<arg value="/I${java.home}\..\include"/> <arg value="/I${java.home}\..\include"/>
@ -15,6 +15,7 @@
<arg value="/I${native}\common\opengl"/> <arg value="/I${native}\common\opengl"/>
<arg value="/I${native}\windows"/> <arg value="/I${native}\windows"/>
<arg value="/I${native}\windows\opengl"/> <arg value="/I${native}\windows\opengl"/>
<arg value="/I${lwjgl.target.gen.headers}"/>
<srcfile/> <srcfile/>
<fileset dir="${native}/common" includes="*.c"/> <fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengl" includes="*.c"/> <fileset dir="${native}/common/opengl" includes="*.c"/>
@ -41,15 +42,6 @@
</apply> </apply>
</target> </target>
<target name="clean">
<delete>
<fileset dir="." includes="*.obj"/>
<fileset dir="." includes="*.dll"/>
<fileset dir="." includes="*.exp"/>
<fileset dir="." includes="*.lib"/>
</delete>
</target>
<target name="compile"> <target name="compile">
<condition property="sdkhomelib" value="${sdkhome}\lib" else="${sdkhome}\lib\x64"> <condition property="sdkhomelib" value="${sdkhome}\lib" else="${sdkhome}\lib\x64">
<equals arg1="${os.arch}" arg2="x86"/> <equals arg1="${os.arch}" arg2="x86"/>

View File

@ -6,7 +6,7 @@
<property name="sdkhome" location="${env.MSSDK}"/> <property name="sdkhome" location="${env.MSSDK}"/>
<target name="compile_dir"> <target name="compile_dir">
<apply dir="." failonerror="true" executable="cl" dest="." skipemptyfilesets="true" parallel="true"> <apply dir="." failonerror="true" executable="cl" dest="." parallel="true">
<arg line="/c /W2 /EHsc /Ox /Gy /MT /MP /nologo"/> <arg line="/c /W2 /EHsc /Ox /Gy /MT /MP /nologo"/>
<arg value="/I${sdkhome}\include"/> <arg value="/I${sdkhome}\include"/>
<arg value="/I${java.home}\..\include"/> <arg value="/I${java.home}\..\include"/>
@ -15,6 +15,7 @@
<arg value="/I${native}\common\opengles"/> <arg value="/I${native}\common\opengles"/>
<arg value="/I${native}\windows"/> <arg value="/I${native}\windows"/>
<arg value="/I${native}\windows\opengles"/> <arg value="/I${native}\windows\opengles"/>
<arg value="/I${lwjgl.target.gen.headers}"/>
<srcfile/> <srcfile/>
<fileset dir="${native}/common" includes="*.c"/> <fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengles" includes="*.c"/> <fileset dir="${native}/common/opengles" includes="*.c"/>
@ -42,15 +43,6 @@
</apply> </apply>
</target> </target>
<target name="clean">
<delete>
<fileset dir="." includes="*.obj"/>
<fileset dir="." includes="*.dll"/>
<fileset dir="." includes="*.exp"/>
<fileset dir="." includes="*.lib"/>
</delete>
</target>
<target name="compile"> <target name="compile">
<condition property="sdkhomelib" value="${sdkhome}\lib" else="${sdkhome}\lib\x64"> <condition property="sdkhomelib" value="${sdkhome}\lib" else="${sdkhome}\lib\x64">
<equals arg1="${os.arch}" arg2="x86"/> <equals arg1="${os.arch}" arg2="x86"/>

View File

@ -50,6 +50,8 @@ import java.nio.ShortBuffer;
*/ */
public final class BufferUtils { public final class BufferUtils {
@java.lang.annotation.Native
private static final int __FORCE_NATIVE_HEADER = 0;
/** /**
* Construct a direct native-ordered bytebuffer with the specified size. * Construct a direct native-ordered bytebuffer with the specified size.

View File

@ -425,13 +425,9 @@ public class LWJGLUtil {
return possible_paths.toArray(new String[possible_paths.size()]); return possible_paths.toArray(new String[possible_paths.size()]);
} }
static void execPrivileged(final String[] cmd_array) throws Exception { static void execPrivileged(String... cmd_array) throws Exception {
try { try {
Process process = AccessController.doPrivileged(new PrivilegedExceptionAction<Process>() { Process process = AccessController.doPrivileged((PrivilegedExceptionAction<Process>) () -> Runtime.getRuntime().exec(cmd_array));
public Process run() throws Exception {
return Runtime.getRuntime().exec(cmd_array);
}
});
// Close unused streams to make sure the child process won't hang // Close unused streams to make sure the child process won't hang
process.getInputStream().close(); process.getInputStream().close();
process.getOutputStream().close(); process.getOutputStream().close();
@ -441,62 +437,25 @@ public class LWJGLUtil {
} }
} }
private static String getPrivilegedProperty(final String property_name) { private static String getPrivilegedProperty(String property_name) {
return AccessController.doPrivileged(new PrivilegedAction<String>() { return AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty(property_name));
public String run() {
return System.getProperty(property_name);
}
});
} }
/** /** Gets a boolean property as a privileged action. */
* Tries to locate named library from the current ClassLoader public static boolean getPrivilegedBoolean(String property_name) {
* This method exists because native libraries are loaded from native code, and as such String s = getPrivilegedProperty(property_name);
* is exempt from ClassLoader library loading rutines. It therefore always fails. if (s == null || s.equals("false")) return false;
* We therefore invoke the protected method of the ClassLoader to see if it can if (LWJGLUtil.DEBUG) {
* locate it. if (!s.equals("true")) {
* LWJGLUtil.logger().log(() -> "Value of boolean property " + property_name + " is not one of [true, false]: " + s);
* @param libname Name of library to search for
* @param classloader Classloader to use
* @return Absolute path to library if found, otherwise null
*/
private static String getPathFromClassLoader(final String libname, final ClassLoader classloader) {
Class<?> c = null;
try {
log("getPathFromClassLoader: searching for: " + libname);
c = classloader.getClass();
while (c != null) {
final Class<?> clazz = c;
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
public String run() throws Exception {
Method findLibrary = clazz.getDeclaredMethod("findLibrary", String.class);
findLibrary.setAccessible(true);
String path = (String)findLibrary.invoke(classloader, libname);
return path;
}
});
} catch (PrivilegedActionException e) {
log("Failed to locate findLibrary method: " + e.getCause());
c = c.getSuperclass();
}
} }
} catch (Exception e) {
log("Failure locating " + e + " using classloader:" + c);
} }
return null; return true;
} }
/** /** Gets a string property as a privileged action. */
* Gets a boolean property as a privileged action. public static String getPrivilegedString(String property_name) {
*/ return getPrivilegedProperty(property_name);
public static boolean getPrivilegedBoolean(final String property_name) {
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() {
return Boolean.getBoolean(property_name);
}
});
} }
/** /**
@ -530,6 +489,46 @@ public class LWJGLUtil {
}); });
} }
/**
* Tries to locate named library from the current ClassLoader
* This method exists because native libraries are loaded from native code, and as such
* is exempt from ClassLoader library loading rutines. It therefore always fails.
* We therefore invoke the protected method of the ClassLoader to see if it can
* locate it.
*
* @param libname Name of library to search for
* @param classloader Classloader to use
* @return Absolute path to library if found, otherwise null
*/
private static String getPathFromClassLoader(final String libname, final ClassLoader classloader) {
Class<?> c = null;
try {
if (LWJGLUtil.DEBUG) {
logger().log(() -> "getPathFromClassLoader: searching for: " + libname);
}
c = classloader.getClass();
while (c != null) {
final Class<?> clazz = c;
try {
return AccessController.doPrivileged((PrivilegedExceptionAction<String>) () -> {
Method findLibrary = clazz.getDeclaredMethod("findLibrary", String.class);
findLibrary.setAccessible(true);
String path = (String)findLibrary.invoke(classloader, libname);
return path;
});
} catch (PrivilegedActionException e) {
logger().log("Failed to locate findLibrary method", e.getCause());
c = c.getSuperclass();
}
}
} catch (Exception e) {
Class<?> c1 = c;
logger().log(() -> "Failure locating using classloader " + c1, e);
}
return null;
}
/** /**
* Method to determine if the current system is running a version of * Method to determine if the current system is running a version of
* Mac OS X better than the given version. This is only useful for Mac OS X * Mac OS X better than the given version. This is only useful for Mac OS X

View File

@ -35,6 +35,7 @@ import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import java.lang.UnsatisfiedLinkError; import java.lang.UnsatisfiedLinkError;
import java.lang.annotation.Native;
/** /**
* *
@ -43,6 +44,7 @@ import java.lang.UnsatisfiedLinkError;
* $Id$ * $Id$
*/ */
final class LinuxSysImplementation extends J2SESysImplementation { final class LinuxSysImplementation extends J2SESysImplementation {
@Native
private static final int JNI_VERSION = 19; private static final int JNI_VERSION = 19;
static { static {
@ -71,7 +73,7 @@ final class LinuxSysImplementation extends J2SESysImplementation {
// Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it // Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it
// right anyway. // right anyway.
String[] browsers = {"sensible-browser", "xdg-open", "google-chrome", "chromium", "firefox", "iceweasel", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"}; String[] browsers = {"xdg-open", "sensible-browser"};
for ( final String browser : browsers ) { for ( final String browser : browsers ) {
try { try {

View File

@ -36,6 +36,7 @@ import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import java.lang.UnsatisfiedLinkError; import java.lang.UnsatisfiedLinkError;
import java.lang.annotation.Native;
/** /**
* *
@ -44,6 +45,7 @@ import java.lang.UnsatisfiedLinkError;
* $Id$ * $Id$
*/ */
final class MacOSXSysImplementation extends J2SESysImplementation { final class MacOSXSysImplementation extends J2SESysImplementation {
@Native
private static final int JNI_VERSION = 25; private static final int JNI_VERSION = 25;
static { static {
@ -57,7 +59,7 @@ final class MacOSXSysImplementation extends J2SESysImplementation {
public boolean openURL(String url) { public boolean openURL(String url) {
try { try {
FileManager.openURL(url); LWJGLUtil.execPrivileged("open", url);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
LWJGLUtil.log("Exception occurred while trying to invoke browser: " + e); LWJGLUtil.log("Exception occurred while trying to invoke browser: " + e);

View File

@ -51,12 +51,15 @@ import org.lwjgl.Sys;
public class Cursor { public class Cursor {
/** 1 bit transparency for native cursor */ /** 1 bit transparency for native cursor */
@java.lang.annotation.Native
public static final int CURSOR_ONE_BIT_TRANSPARENCY = 1; public static final int CURSOR_ONE_BIT_TRANSPARENCY = 1;
/** 8 bit alhpa native cursor */ /** 8 bit alhpa native cursor */
@java.lang.annotation.Native
public static final int CURSOR_8_BIT_ALPHA = 2; public static final int CURSOR_8_BIT_ALPHA = 2;
/** animation native cursor */ /** animation native cursor */
@java.lang.annotation.Native
public static final int CURSOR_ANIMATION = 4; public static final int CURSOR_ANIMATION = 4;
/** First element to display */ /** First element to display */

View File

@ -45,6 +45,8 @@ import org.lwjgl.Sys;
import org.lwjgl.opengl.Display; import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.InputImplementation; import org.lwjgl.opengl.InputImplementation;
import static org.lwjgl.LWJGLUtil.getPrivilegedBoolean;
/** /**
* <br> * <br>
@ -690,16 +692,6 @@ public class Mouse {
} }
} }
/** Gets a boolean property as a privileged action. */
static boolean getPrivilegedBoolean(final String property_name) {
Boolean value = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() {
return Boolean.getBoolean(property_name);
}
});
return value;
}
/** /**
* Retrieves whether or not the mouse cursor is within the bounds of the window. * Retrieves whether or not the mouse cursor is within the bounds of the window.
* If the mouse cursor was moved outside the display during a drag, then the result of calling * If the mouse cursor was moved outside the display during a drag, then the result of calling

View File

@ -40,6 +40,8 @@ import java.util.Map;
* @author Spasi * @author Spasi
*/ */
final class CallbackUtil { final class CallbackUtil {
@java.lang.annotation.Native
private static final int __NATIVE_HEADER = 0;
private static final Map<CLContext, Long> contextUserData = new HashMap<CLContext, Long>(); private static final Map<CLContext, Long> contextUserData = new HashMap<CLContext, Long>();
@ -169,4 +171,4 @@ final class CallbackUtil {
*/ */
static native long getLogMessageToStderrAPPLE(); static native long getLogMessageToStderrAPPLE();
} }

View File

@ -62,6 +62,8 @@ import java.security.PrivilegedAction;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import static org.lwjgl.LWJGLUtil.getPrivilegedBoolean;
public final class Display { public final class Display {
private static final Thread shutdown_hook = new Thread() { private static final Thread shutdown_hook = new Thread() {
@ -1034,23 +1036,6 @@ public final class Display {
return display_impl; return display_impl;
} }
/** Gets a boolean property as a privileged action. */
static boolean getPrivilegedBoolean(final String property_name) {
String s = getPrivilegedString(property_name);
if (s == null || s.equals("false")) return false;
if (LWJGLUtil.DEBUG) {
if (!s.equals("true")) {
LWJGLUtil.logger().log(() -> "Value of boolean property " + property_name + " is not one of [true, false]: " + s);
}
}
return true;
}
/** Gets a string property as a privileged action. */
static String getPrivilegedString(final String property_name) {
return AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty(property_name));
}
private static void initControls() { private static void initControls() {
// Automatically create mouse, keyboard and controller // Automatically create mouse, keyboard and controller
if ( !getPrivilegedBoolean("org.lwjgl.opengl.Display.noinput") ) { if ( !getPrivilegedBoolean("org.lwjgl.opengl.Display.noinput") ) {

View File

@ -208,7 +208,7 @@ final class LinuxDisplay implements DisplayImplementation {
} }
private static boolean isXrandrSupported() { private static boolean isXrandrSupported() {
if (Display.getPrivilegedBoolean("LWJGL_DISABLE_XRANDR")) if (LWJGLUtil.getPrivilegedBoolean("LWJGL_DISABLE_XRANDR"))
return false; return false;
try (LinuxDisplay.AWTLock _lock = awtLock()) { try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay(); incDisplay();
@ -240,7 +240,7 @@ final class LinuxDisplay implements DisplayImplementation {
private static native boolean nIsXF86VidModeSupported(long display) throws LWJGLException; private static native boolean nIsXF86VidModeSupported(long display) throws LWJGLException;
private static boolean isNetWMFullscreenSupported() throws LWJGLException { private static boolean isNetWMFullscreenSupported() throws LWJGLException {
if (Display.getPrivilegedBoolean("LWJGL_DISABLE_NETWM")) if (LWJGLUtil.getPrivilegedBoolean("LWJGL_DISABLE_NETWM"))
return false; return false;
try (LinuxDisplay.AWTLock _lock = awtLock()) { try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay(); incDisplay();
@ -467,7 +467,7 @@ final class LinuxDisplay implements DisplayImplementation {
// managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore, // managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore,
// unless org.lwjgl.opengl.Window.undecorated_fs has been specified. // unless org.lwjgl.opengl.Window.undecorated_fs has been specified.
// See native/linux/org_lwjgl_opengl_Display.c, createWindow function. // See native/linux/org_lwjgl_opengl_Display.c, createWindow function.
boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs")); boolean undecorated = LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs"));
this.parent = parent; this.parent = parent;
parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen()); parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen());
@ -490,7 +490,7 @@ final class LinuxDisplay implements DisplayImplementation {
current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable); current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable);
// Set the WM_CLASS hint which is needed by some WM's e.g. Gnome Shell // Set the WM_CLASS hint which is needed by some WM's e.g. Gnome Shell
wm_class = Display.getPrivilegedString("LWJGL_WM_CLASS"); wm_class = LWJGLUtil.getPrivilegedString("LWJGL_WM_CLASS");
if (wm_class == null) wm_class = Display.getTitle(); if (wm_class == null) wm_class = Display.getTitle();
setClassHint(Display.getTitle(), wm_class); setClassHint(Display.getTitle(), wm_class);
@ -1414,7 +1414,7 @@ final class LinuxDisplay implements DisplayImplementation {
} }
static void init() { static void init() {
if ( Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.nocompiz_lfs") ) if ( LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.nocompiz_lfs") )
return; return;
AccessController.doPrivileged(new PrivilegedAction<Object>() { AccessController.doPrivileged(new PrivilegedAction<Object>() {

View File

@ -127,7 +127,7 @@ final class MacOSXDisplay implements DisplayImplementation {
private native boolean nIsNativeMode(ByteBuffer peer_info_handle); private native boolean nIsNativeMode(ByteBuffer peer_info_handle);
private static boolean isUndecorated() { private static boolean isUndecorated() {
return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); return LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");
} }
public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException { public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
@ -137,11 +137,11 @@ final class MacOSXDisplay implements DisplayImplementation {
// OS X fullscreen mode API is only available on OS X 10.7+ // OS X fullscreen mode API is only available on OS X 10.7+
boolean enableFullscreenModeAPI = LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 7) && parent == null && boolean enableFullscreenModeAPI = LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 7) && parent == null &&
!Display.getPrivilegedBoolean("org.lwjgl.opengl.Display.disableOSXFullscreenModeAPI"); !LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Display.disableOSXFullscreenModeAPI");
// OS X high DPI mode is only available on OS X 10.7+ // OS X high DPI mode is only available on OS X 10.7+
enableHighDPI = LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 7) && parent == null && enableHighDPI = LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 7) && parent == null &&
(Display.getPrivilegedBoolean("org.lwjgl.opengl.Display.enableHighDPI") || fullscreen); (LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Display.enableHighDPI") || fullscreen);
if (parented) this.canvas = parent; if (parented) this.canvas = parent;
else this.canvas = null; else this.canvas = null;

View File

@ -52,86 +52,103 @@ public final class Pbuffer extends DrawableGL {
/** /**
* Indicates that Pbuffers can be created. * Indicates that Pbuffers can be created.
*/ */
@java.lang.annotation.Native
public static final int PBUFFER_SUPPORTED = 1 << 0; public static final int PBUFFER_SUPPORTED = 1 << 0;
/** /**
* Indicates that Pbuffers can be used as render-textures. * Indicates that Pbuffers can be used as render-textures.
*/ */
@java.lang.annotation.Native
public static final int RENDER_TEXTURE_SUPPORTED = 1 << 1; public static final int RENDER_TEXTURE_SUPPORTED = 1 << 1;
/** /**
* Indicates that Pbuffers can be used as non-power-of-two render-textures. * Indicates that Pbuffers can be used as non-power-of-two render-textures.
*/ */
@java.lang.annotation.Native
public static final int RENDER_TEXTURE_RECTANGLE_SUPPORTED = 1 << 2; public static final int RENDER_TEXTURE_RECTANGLE_SUPPORTED = 1 << 2;
/** /**
* Indicates that Pbuffers can be used as depth render-textures. * Indicates that Pbuffers can be used as depth render-textures.
*/ */
@java.lang.annotation.Native
public static final int RENDER_DEPTH_TEXTURE_SUPPORTED = 1 << 3; public static final int RENDER_DEPTH_TEXTURE_SUPPORTED = 1 << 3;
/** /**
* The render-to-texture mipmap level attribute. * The render-to-texture mipmap level attribute.
*/ */
@java.lang.annotation.Native
public static final int MIPMAP_LEVEL = RenderTexture.WGL_MIPMAP_LEVEL_ARB; public static final int MIPMAP_LEVEL = RenderTexture.WGL_MIPMAP_LEVEL_ARB;
/** /**
* The render-to-texture cube map face attribute. * The render-to-texture cube map face attribute.
*/ */
@java.lang.annotation.Native
public static final int CUBE_MAP_FACE = RenderTexture.WGL_CUBE_MAP_FACE_ARB; public static final int CUBE_MAP_FACE = RenderTexture.WGL_CUBE_MAP_FACE_ARB;
/** /**
* The render-to-texture cube map positive X face value. * The render-to-texture cube map positive X face value.
*/ */
@java.lang.annotation.Native
public static final int TEXTURE_CUBE_MAP_POSITIVE_X = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB; public static final int TEXTURE_CUBE_MAP_POSITIVE_X = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB;
/** /**
* The render-to-texture cube map negative X face value. * The render-to-texture cube map negative X face value.
*/ */
@java.lang.annotation.Native
public static final int TEXTURE_CUBE_MAP_NEGATIVE_X = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB; public static final int TEXTURE_CUBE_MAP_NEGATIVE_X = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB;
/** /**
* The render-to-texture cube map positive Y face value. * The render-to-texture cube map positive Y face value.
*/ */
@java.lang.annotation.Native
public static final int TEXTURE_CUBE_MAP_POSITIVE_Y = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB; public static final int TEXTURE_CUBE_MAP_POSITIVE_Y = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB;
/** /**
* The render-to-texture cube map negative Y face value. * The render-to-texture cube map negative Y face value.
*/ */
@java.lang.annotation.Native
public static final int TEXTURE_CUBE_MAP_NEGATIVE_Y = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB; public static final int TEXTURE_CUBE_MAP_NEGATIVE_Y = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB;
/** /**
* The render-to-texture cube map positive Z face value. * The render-to-texture cube map positive Z face value.
*/ */
@java.lang.annotation.Native
public static final int TEXTURE_CUBE_MAP_POSITIVE_Z = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB; public static final int TEXTURE_CUBE_MAP_POSITIVE_Z = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB;
/** /**
* The render-to-texture cube map negative Z face value. * The render-to-texture cube map negative Z face value.
*/ */
@java.lang.annotation.Native
public static final int TEXTURE_CUBE_MAP_NEGATIVE_Z = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB; public static final int TEXTURE_CUBE_MAP_NEGATIVE_Z = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB;
/** /**
* The Pbuffer front left buffer. * The Pbuffer front left buffer.
*/ */
@java.lang.annotation.Native
public static final int FRONT_LEFT_BUFFER = RenderTexture.WGL_FRONT_LEFT_ARB; public static final int FRONT_LEFT_BUFFER = RenderTexture.WGL_FRONT_LEFT_ARB;
/** /**
* The Pbuffer front right buffer. * The Pbuffer front right buffer.
*/ */
@java.lang.annotation.Native
public static final int FRONT_RIGHT_BUFFER = RenderTexture.WGL_FRONT_RIGHT_ARB; public static final int FRONT_RIGHT_BUFFER = RenderTexture.WGL_FRONT_RIGHT_ARB;
/** /**
* The Pbuffer back left buffer. * The Pbuffer back left buffer.
*/ */
@java.lang.annotation.Native
public static final int BACK_LEFT_BUFFER = RenderTexture.WGL_BACK_LEFT_ARB; public static final int BACK_LEFT_BUFFER = RenderTexture.WGL_BACK_LEFT_ARB;
/** /**
* The Pbuffer back right buffer. * The Pbuffer back right buffer.
*/ */
@java.lang.annotation.Native
public static final int BACK_RIGHT_BUFFER = RenderTexture.WGL_BACK_RIGHT_ARB; public static final int BACK_RIGHT_BUFFER = RenderTexture.WGL_BACK_RIGHT_ARB;
/** /**
* The Pbuffer depth buffer. * The Pbuffer depth buffer.
*/ */
@java.lang.annotation.Native
public static final int DEPTH_BUFFER = RenderTexture.WGL_DEPTH_COMPONENT_NV; public static final int DEPTH_BUFFER = RenderTexture.WGL_DEPTH_COMPONENT_NV;
/** /**

View File

@ -289,7 +289,7 @@ final class WindowsDisplay implements DisplayImplementation {
private static native long nCreateWindow(int x, int y, int width, int height, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException; private static native long nCreateWindow(int x, int y, int width, int height, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException;
private static boolean isUndecorated() { private static boolean isUndecorated() {
return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); return LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");
} }
private static long getHwnd(Canvas parent) throws LWJGLException { private static long getHwnd(Canvas parent) throws LWJGLException {
@ -1232,4 +1232,4 @@ final class WindowsDisplay implements DisplayImplementation {
return "Rect: left = " + left + " top = " + top + " right = " + right + " bottom = " + bottom + ", width: " + (right - left) + ", height: " + (bottom - top); return "Rect: left = " + left + " top = " + top + " right = " + right + " bottom = " + bottom + ", width: " + (right - left) + ", height: " + (bottom - top);
} }
} }
} }

View File

@ -1,4 +1,4 @@
#include "org_lwjgl_BufferUtils.h" //#include "org_lwjgl_BufferUtils.h"
#include "common_tools.h" #include "common_tools.h"
JNIEXPORT void JNICALL Java_org_lwjgl_BufferUtils_zeroBuffer0(JNIEnv *env, jclass clazz, jobject buffer, jlong offset, jlong size) { JNIEXPORT void JNICALL Java_org_lwjgl_BufferUtils_zeroBuffer0(JNIEnv *env, jclass clazz, jobject buffer, jlong offset, jlong size) {

View File

@ -39,7 +39,7 @@
#include <jni.h> #include <jni.h>
#include "common_tools.h" #include "common_tools.h"
#include "extcl.h" #include "extcl.h"
#include "org_lwjgl_opencl_CallbackUtil.h" //#include "org_lwjgl_opencl_CallbackUtil.h"
static jmethodID contextCallbackJ; static jmethodID contextCallbackJ;
static jmethodID memObjectDestructorCallbackJ; static jmethodID memObjectDestructorCallbackJ;

View File

@ -228,17 +228,20 @@ static XVisualInfo *chooseVisualGLXFromBPP(JNIEnv *env, Display *disp, int scree
putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe); putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe);
putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe); putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe);
putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha); putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha);
if (stereo) if (stereo) {
putAttrib(&attrib_list, GLX_STEREO); putAttrib(&attrib_list, GLX_STEREO);
}
// Assume the caller has checked support for multisample // Assume the caller has checked support for multisample
if (samples > 0) { if (samples > 0) {
putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1);
putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); // GLX_COVERAGE_SAMPLES_NV if colorSamples > 0 putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); // GLX_COVERAGE_SAMPLES_NV if colorSamples > 0
if ( colorSamples > 0 ) if ( colorSamples > 0 ) {
putAttrib(&attrib_list, GLX_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); putAttrib(&attrib_list, GLX_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples);
}
} }
if (sRGB) if (sRGB) {
putAttrib(&attrib_list, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); putAttrib(&attrib_list, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB);
}
putAttrib(&attrib_list, None); putAttrib(&attrib_list, None);
return lwjgl_glXChooseVisual(disp, screen, attrib_list.attribs); return lwjgl_glXChooseVisual(disp, screen, attrib_list.attribs);
} }

View File

@ -78,6 +78,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_lookupModifierMap(JNI
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_keycodeToKeySym(JNIEnv *env, jclass unused, jlong display_ptr, jint key_code) { JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_keycodeToKeySym(JNIEnv *env, jclass unused, jlong display_ptr, jint key_code) {
Display *disp = (Display *)(intptr_t)display_ptr; Display *disp = (Display *)(intptr_t)display_ptr;
// TODO: verify that XkbKeycodeToKeysym does not introduce any unwanted behaviour, then switch to it.
KeySym key_sym = XKeycodeToKeysym(disp, key_code, 0); KeySym key_sym = XKeycodeToKeysym(disp, key_code, 0);
return key_sym; return key_sym;
} }