# This .cfg file is used to generate the interface to the GLX routines
# used internally by the X11GLContext implementation.
Package jogamp.nativewindow.x11
JavaClass X11Lib
Style AllStatic

HierarchicalNativeOutput false

JavaOutputDir gensrc/classes
NativeOutputDir gensrc/native/X11

# Imports needed by all glue code
Import java.nio.*
Import java.util.*
Import javax.media.nativewindow.util.Point

# XID needs to be treated as a long for 32/64 bit compatibility
Opaque long XID

Opaque long Display *
Opaque boolean Bool
Opaque long GLXFBConfig
Opaque long Visual *

IncludeAs CustomJavaCode X11Lib x11-CustomJavaCode.java

ArgumentIsString XOpenDisplay 0
ReturnsString XDisplayString
ReturnValueCapacity XRenderFindVisualFormat sizeof(XRenderPictFormat)

# We have Custom code for the following
Ignore XGetVisualInfo

ManuallyImplement XCloseDisplay
ManuallyImplement XUnlockDisplay
ManuallyImplement XLockDisplay

# Helper routine to make the ReturnedArrayLength expression below work correctly
CustomJavaCode X11Lib private static int getFirstElement(IntBuffer buf)         { return buf.get(buf.position()); }
CustomJavaCode X11Lib private static int getFirstElement(int[] arr, int offset) { return arr[offset]; }

CustomJavaCode XVisualInfo public static XVisualInfo create(XVisualInfo s) { XVisualInfo d = XVisualInfo.create(); d.getBuffer().put(s.getBuffer()); d.getBuffer().rewind(); s.getBuffer().rewind(); return d; }

CustomCCode #include <gluegen_stdint.h>
CustomCCode #include <gluegen_stddef.h>
CustomCCode #include <X11/Xlib.h>
CustomCCode #include <X11/Xutil.h>
CustomCCode #include <X11/extensions/Xrender.h>

