summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/glx-x11.cfg13
1 files changed, 5 insertions, 8 deletions
diff --git a/make/glx-x11.cfg b/make/glx-x11.cfg
index 801c035ee..5680a419a 100644
--- a/make/glx-x11.cfg
+++ b/make/glx-x11.cfg
@@ -27,14 +27,11 @@ CustomJavaCode GLX public static native long RootWindow(long display, int screen
TemporaryCVariableDeclaration XGetVisualInfo int count;
TemporaryCVariableAssignment XGetVisualInfo count = _ptr3[0];
ReturnValueCapacity XGetVisualInfo count * sizeof(XVisualInfo)
-# FIXME: this is terrible but currently needed because we have two
-# overloadings for the third argument (IntBuffer and int[]) and can't
-# specify different glue code for different overloadings
-#
-# The NoNio directive which was present in an earlier version of
-# GlueGen, which resolved this more cleanly, is also not yet available
-# in this version.
-ReturnedArrayLength XGetVisualInfo ((((Object) {3}) instanceof Buffer) ? ((IntBuffer) ((Object) {3})).get(0) : ((int[]) ((Object) {3}))[0])
+
+# Helper routine to make the ReturnedArrayLength expression below work correctly
+CustomJavaCode GLX private static int getFirstElement(IntBuffer buf) { return buf.get(buf.position()); }
+CustomJavaCode GLX private static int getFirstElement(int[] arr, int offset) { return arr[offset]; }
+ReturnedArrayLength XGetVisualInfo getFirstElement({3})
ReturnValueCapacity glXChooseVisual sizeof(XVisualInfo)
ReturnValueCapacity glXGetVisualFromFBConfig sizeof(XVisualInfo)
ReturnValueCapacity glXGetVisualFromFBConfigSGIX sizeof(XVisualInfo)